in reply to PerlMonks XP XML Ticker

Because information like my level and XP are public, shouldn't there be a way to retrieve the information through the ticker without signing in?

Is there any reason why you need to use the XML ticker? Sure it's convenient, but if you don't want to go through the hassle of automating logins there's no reason you can't use HTML::Parser and friends to rip the info out of non-ticker nodes, and this way you can add other monks to your ticker, too. ;^)

#!/usr/bin/perl use strict; use warnings; use HTML::TableExtract; use LWP::Simple qw/ get /; my $monk = shift or die "$0 [monkname]\n"; my $url = "${monk}"; my $html = HTML::TableExtract->new; $html->parse( get $url ); foreach my $table ( $html->table_states ) { foreach my $row ( $table->rows($table) ) { if ( $row->[0] eq 'Experience:' ) { print "$monk has $row->[1] XP. \n", "Give 'em \$1 and they might be able \n", "to buy a cup of coffee, too. \n"; exit; } } } print "No XP found ... perhaps ${monk} doesn't exist?\n";


Replies are listed 'Best First'.
Re: Re: PerlMonks XP XML Ticker
by newrisedesigns (Curate) on Jun 03, 2002 at 15:41 UTC

    I had thought about the HTML::Parser route, but it was ruled out by my webserver's lack of modules. I really should check into getting them installed (they don't support SSH or telnet).

    What I had planned on doing was have a small Perl program run on my webserver and return stats (my level, etc) from PerlMonks to my website. Just a simple side project.

    I'm going to stick with the XML XP Ticker mainly because it's short (easier to edit with a few regexps).

    Thanks for the HTML::Parser code. I was planning on reading up on HTML modules, and I think something along the lines of what you wrote would be a good starting point to learn and write some code that uses HTML::Parser and friends :)

    John J Reiser