Whew!
Here it is. If you want to use it as a CGI file, just put it in your cgi-bin directory of choice. If you don't have CGI access, use it like so:
./mp3admin-display.cgi > out.html
and load out.html in your browser. This has been fun. ;)

UPDATE - mp3.com regularly changes their submit variable names, so, good chance that this code is broken but easily fixed. Not to mention that i wrote this over a year ago without any HTML parsers ...

#!/usr/bin/perl -w # mp3admin-display.cgi use strict; use LWP::UserAgent; use HTTP::Request::Common; use HTTP::Cookies; # form variables my $email = ''; # SET THIS TO YOUR EMAIL my $password = ''; # SET THIS TO YOUR PASSWORD my $band_id = ''; # SET THIS TO YOUR BAND ID # bot variables my $agent = LWP::UserAgent->new; my $cookie_jar = HTTP::Cookies->new; my $res; # URL's of importance my $login_url = 'https://login.mp3.com/login'; my $admin_url = 'http://stats.mp3.com/cgi-bin/artist-stats.cgi'; # list of songs and their id's my %songs = (); print "Content-type: text/html\n\n"; &login($agent, $res, $cookie_jar, $email, $password, $login_url); &printImageAndFindSongs($agent, $res, $cookie_jar, $band_id, \%songs, $admin_url); foreach my $song_id (keys %songs) { &dumpAttribs($agent, $res, $cookie_jar, $band_id, $song_id, $songs{$song_id}, $admin_url); } exit; # login is necessary to set cookies sub login($$$) { my( $agent, $res, $cookie_jar, $email, $password, $login_url) = @_; # build request for login web page (so we get the set of cookies) my $req = POST ($login_url, [ cmd => 'login', dest => 'http://studio.mp3.com/cgi-bin/artist-admin/login.cgi?ste +p=Intro', tmpl => 'login_artist.html', email => $email, password => $password, ]); # issue the request $res = $agent->request($req); # extract the cookies $cookie_jar->extract_cookies($res); } # prints out Total Stat Image and builds list of songs sub printImageAndFindSongs ($$$$) { my( $agent, $res, $cookie_jar, $band_id, $songs, $admin_url) = @_; my @lines; my $start; my $last; # build the request for the stats page my $req = GET ("$admin_url?band_id=$band_id"); # add the cookies we got from the previous request $cookie_jar->add_cookie_header($req); # issue the request $res = $agent->request($req); if ($res->is_success) { # print stat image first @lines = split(/\n/, $res->content); for (my $i=0; $i <= $#lines; $i++) { if ($lines[$i] =~ /^\s*<form.+?name="stats">$/i) { $start = $i; } elsif ($lines[$i] =~ /Estimated payments/i) { $last = $i; } } print join("\n", @lines[$start..$last]); print "</td></tr></table>\n"; # now get the songs @lines = grep { /^<OPTION/ } @lines; map { /^\s*<OPTION\s+\w*\s*\w+="(\d+)">(.+)\s*$/i; $songs{$1} = $2; } @lines; } else { print "Error trying to load first admin page\n"; } } # loads song page and prints stats sub dumpAttribs ($$$$) { my( $agent, $res, $cookie_jar, $band_id, $song_id, $song, $admin_url) = @_; my @lines; my $start; my $last; # build the request for the stats page my $req = GET ("$admin_url?band_id=$band_id&song_id=$song_id"); # add the cookies we got from the previous request $cookie_jar->add_cookie_header($req); # issue the request $res = $agent->request($req); if ($res->is_success) { @lines = split(/\n/, $res->content); for (my $i=0; $i <= $#lines; $i++) { if ($lines[$i] =~ /^\s*<input type=hidden name="report_month +".*$/i) { $start = $i; } elsif ($lines[$i] =~ /^\s*<!-- Outer Table -->.*$/i) { $last = $i - 3; } } print "<form>\n"; print join("\n", @lines[$start..$last]); } else { print "Error trying to load song page $song_id\n"; } }
Please inform me of any problems. Now all you monks out there with mp3 Artist accounts rush to use this. Hmm, do I hear crickets chirpin'?

In reply to (jeffa) Re: mp3.com stats by jeffa
in thread mp3.com stats by Anonymous Monk

Title:
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, details, 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, summary, 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.