#!/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?step=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*