Help Wikitravel grow by contributing to an article! Learn how.

User:IBobi/StatScript

From Wikitravel
Jump to: navigation, search

Script[edit]

Written in luvvly-jubbly awk, also requires wget. Now uses Mediawiki's internal raw statistics.

BEGIN {
  LIST="en fr ro de sv ja nl pt es pl it"

  split(LIST, list)
  for(i in list) {
    #print list[i]
    cmd = "wget -O " list[i] " 'http://wikitravel.org/wiki/" list[i] "/index.php?title=Special:Statistics&action=raw'; sleep 3"
    system(cmd) 
    ARGV[i]=list[i]
    n++
  }
  ARGC=++n
}
 
/total=/ { split($0, fields, ";")
           split(fields[2], values, "=")
           num[j++]=values[2]
           total+=values[2] }

END {
  CONVFMT="%.2f"
  print "|-"
  printf "| " strftime("%d %b %Y") " "
  for (i=0;i<j;i++) {
    printf "|| " num[i] " (" (100*num[i])/total "%) "
  }
  printf "|| " total
}

Variants

Actions

Destination Docents

In other languages