WhatPulse stats

By zenx on Jul 27, 2011

Usage: ./whatpulse.pl nick nick2 nick3

#!/usr/bin/perl

if ( $#ARGV > 0 ) {
        foreach $usr (@ARGV) {
                        print "-[   $usr    ]-----------------------------------------------\n";
                        system("$0 $usr");
        }
    exit;
}

if ( $#ARGV < 0 ) { print "usage: $0 <nick(s)> \n"; exit; }

$user = $ARGV[0];
$index = `curl -s "http://whatpulse.org/api/user.php?UserID=$user"`;
@indexsplit = split("\n", $index);

foreach $n (@indexsplit) {

    $n =~ s/^ //;

    if ( $n =~ /UserID/ ) { $n =~ s/<[^>]*>//g; $id = $n; }
    if ( $n =~ /AccountName/ ) { $n =~ s/<[^>]*>//g; $account = $n; }
        if ( $n =~ /DateJoined/ ) { $n =~ s/<[^>]*>//g; $datejoined = $n; }
        if ( $n =~ /Country/ ) { $n =~ s/<[^>]*>//g; $country = $n; }
        if ( $n =~ /Pulses/ ) { $n =~ s/<[^>]*>//g; $pulses = $n; }
        if ( $n =~ /TotalKeyCount/ ) { $n =~ s/<[^>]*>//g; $totalkeycount = $n; }
        if ( $n =~ /TotalMouseClicks/ ) { $n =~ s/<[^>]*>//g; $totalclicks = $n; }
        if ( $n =~ /TotalMiles/ ) { $n =~ s/<[^>]*>//g; $totalmiles = $n; }
        if ( $n =~ /AvKeysPerPulse/ ) { $n =~ s/<[^>]*>//g; $avgkeysperpulse = $n; }
        if ( $n =~ /AvClicksPerPulse/ ) { $n =~ s/<[^>]*>//g; $avgclicksperpulse = $n; }
        if ( $n =~ /^<Rank>/ ) { $n =~ s/<[^>]*>//g; $rank = $n; }

}

if ( $pulses > 0 ) {

    print "Account: $account ( $country ) Joined: $datejoined - http://whatpulse.org/stats/users/$id/\n";
    print "Keys: $totalkeycount - Clicks: $totalclicks - Miles: $totalmiles\n";
    print "AVG/Pulse | Keys: $avgkeysperpulse - Clicks: $avgclicksperpulse\n";
    print "Pulses: $pulses - Rank: $rank\n";

} else {

    print "No such user found or no pulses.\n";

}

Comments

Sign in to comment.
chachin   -  Oct 03, 2011

so wtf is it missing and how can I fix it?

 Respond  
Jordyk19   -  Jul 28, 2011

You forgot to add to the description that they need to chmod it and that they need to have curl installed.

Ontopic
Its very nice. good job.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.