Advertisement
Aha2Y

WhatPulse.pl (By zenx)

Jul 28th, 2011
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.67 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. if ( $#ARGV > 0 ) {
  4.         foreach $usr (@ARGV) {
  5.                         print "-[   $usr    ]-----------------------------------------------\n";
  6.                         system("$0 $usr");
  7.         }
  8.     exit;
  9. }
  10.  
  11. if ( $#ARGV < 0 ) { print "usage: $0 <nick(s)> \n"; exit; }
  12.  
  13. $user = $ARGV[0];
  14. $index = `curl -s "http://whatpulse.org/api/user.php?UserID=$user"`;
  15. @indexsplit = split("\n", $index);
  16.  
  17. foreach $n (@indexsplit) {
  18.  
  19.     $n =~ s/^ //;
  20.  
  21.     if ( $n =~ /UserID/ ) { $n =~ s/<[^>]*>//g; $id = $n; }
  22.     if ( $n =~ /AccountName/ ) { $n =~ s/<[^>]*>//g; $account = $n; }
  23.         if ( $n =~ /DateJoined/ ) { $n =~ s/<[^>]*>//g; $datejoined = $n; }
  24.         if ( $n =~ /Country/ ) { $n =~ s/<[^>]*>//g; $country = $n; }
  25.         if ( $n =~ /Pulses/ ) { $n =~ s/<[^>]*>//g; $pulses = $n; }
  26.         if ( $n =~ /TotalKeyCount/ ) { $n =~ s/<[^>]*>//g; $totalkeycount = $n; }
  27.         if ( $n =~ /TotalMouseClicks/ ) { $n =~ s/<[^>]*>//g; $totalclicks = $n; }
  28.         if ( $n =~ /TotalMiles/ ) { $n =~ s/<[^>]*>//g; $totalmiles = $n; }
  29.         if ( $n =~ /AvKeysPerPulse/ ) { $n =~ s/<[^>]*>//g; $avgkeysperpulse = $n; }
  30.         if ( $n =~ /AvClicksPerPulse/ ) { $n =~ s/<[^>]*>//g; $avgclicksperpulse = $n; }
  31.         if ( $n =~ /^<Rank>/ ) { $n =~ s/<[^>]*>//g; $rank = $n; }
  32.  
  33. }
  34.  
  35. if ( $pulses > 0 ) {
  36.  
  37.     print "Account: $account ( $country ) Joined: $datejoined - http://whatpulse.org/stats/users/$id/\n";
  38.     print "Keys: $totalkeycount - Clicks: $totalclicks - Miles: $totalmiles\n";
  39.     print "AVG/Pulse | Keys: $avgkeysperpulse - Clicks: $avgclicksperpulse\n";
  40.     print "Pulses: $pulses - Rank: $rank\n";
  41.  
  42. } else {
  43.  
  44.     print "No such user found or no pulses.\n";
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement