Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Thanks. That makes my script that extracted the information from the Wayback Machine useless.
#!/usr/bin/perl use warnings; use strict; use Time::Piece; use WWW::Mechanize; use HTML::TableExtract; 3 == @ARGV or die "Please specify start_date (yyyymmdd), user_id and user_nam +e\n"; my ($start_date, $user_id, $user) = @ARGV; my $url_prefix = '' . '/'; my @url_suffixes = ("_id=$user_id", "=$user"); my $t = 'Time::Piece'->strptime($start_date, '%Y%m%d'); my $today = localtime->ymd; my $w = 'WWW::Mechanize'->new; my %output; my %last; @last{ @url_suffixes } = (0) x @url_suffixes; while ($t->ymd le $today) { my $date = $t->ymd(q()); print STDERR "$date\r"; for my $suffix (@url_suffixes) { my $url = $url_prefix . $suffix; $url =~ s/~DATE~/$date/; $w->get($url); my ($real_date) = $w->uri =~ m%/web/([0-9]{8})%; # WBM redirec +ts to future. my $te = 'HTML::TableExtract'->new; $te->parse($w->content); TABLE: for my $table ($te->tables) { for my $row ($table->rows) { if (grep defined && /Experience:/, @$row) { my $xp = 0 + $row->[1]; last TABLE if $xp == $last{$suffix}; $output{$real_date} = $xp; $last{$suffix} = $xp; last TABLE } } } } $t = $t->add_months(1); } for my $date (sort keys %output) { print "$date\t$output{$date}\n"; }

Interestingly, the outputs of the XML and my script are almost the same. Here's how I extracted the information from the XML (specify its filename as a parameter to the following script):

#!/usr/bin/perl use warnings; use strict; use WWW::Mechanize; use HTML::TableExtract; use XML::XSH2; my $w = 'WWW::Mechanize'->new; $w->get('') +; my $te = 'HTML::TableExtract'->new( headers => [qw[ Level XP ]] ); $te->parse($w->content); my $table = ($te->tables)[0]->rows; package XML::XSH2::Map; our $string; package main; xsh << 'end.'; open {$ARGV[0]} ; $string = xsh:subst(normalize-space(//var[@name="levelchange"]), ';', +"\n", 'g') ; end. $string =~ s/^[0-9]+-//gm; $string =~ s/^([0-9]+)(.*)/$1$2 $table->[$1-1][1]/gm; print $string;

You have to insert dashes into the dates to the output of the Wayback Machine to make it work:

perl -pe 's/(....)(..)/$1-$2-/'

I then used gnuplot to compare them:

set term pngcairo size 1024, 800 set xdata time set timefmt "%Y-%m-%d" set format x '%Y/%m' plot 'pm-xp.txt' using 2:4 with lines title 'XP',\ '' using 2:($1*1000) with lines title 'Level',\ 'wayback.txt' using 1:2 with lines title 'Wayback Machine'

Update: The image.

لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

In reply to Re^2: Dates of Monk promotion (covered) by choroba
in thread Dates of Monk promotion by u65

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (5)
    As of 2020-11-27 20:32 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found