in reply to mp3.com stats

mp3.com does work with cookies - and it is very tricky. I have tried my darndest to grab an admin page and I just can't get it to work. What I can offer that works is script that displays the current Netscape cookies that are set. It requires Term::ANSIColor. This is helpfull to quickly find the key-values for a cookie.
#cookies.pl #usage cookies.pl [site] - specify site or leave null for all use strict; use Term::ANSIColor; my $site = $ARGV[0]; my %values; open(COOKIE, "$ENV{HOME}/.netscape/cookies") or die "Yack!: $!\n"; while (<COOKIE>) { next if ($_ =~ /^[#\n]/); chomp; my ($domain, $x, $path, $x, $x, $key, $value) = split(/\t/, $_ +); $values{$domain}{$key} = $value; } foreach my $d (sort keys %values) { next unless !($site) or $d =~ /$site/; print color("underline"), "$d", color("reset"), "\n"; foreach my $k (sort keys %{$values{$d}}) { print "\t", color("green"), "$k"; print color("reset"), " => "; print color("yellow"), $values{$d}{$k}; print color("reset"), "\n"; } }
Now, back to the issue at hand - mp3's artist log-in URL is https://login.mp3.com/login?origin=artist. I wrote the following piece of test code to see if I could simply dump the contents:
#grabme.pl use strict; use LWP::UserAgent; use HTTP::Request::Common; use HTTP::Cookies; # instant a new agent my $agent = new LWP::UserAgent; $agent->agent("Mozilla/4.7 [en] (X11; I; Linux 2.2.13-mosix i686; Nav) +"); # issue a request for the web page my $req = GET("https://login.mp3.com/login?orgin=artist"); my $res = $agent->request($req); if ($res->is_success) { print $res->content; } else { print $res->error_as_HTML; }
And I get this as a result (abbreviated): 501 Protocol scheme 'https' is not supported. Wow. If you replace https with plain old http a 302 error is returned. If anyone can give a suggestion/alternate route, I would greatly appreciate it.

In the meantime I will continue to work on this admin page display thingy. I take it that you are wanting to get a list of songs from the Artist Admin Page, feed each one via a GET or POST request to their CGI engine, and print the stats. Great idea, because it is a timely process to do so via a web browser.

<SHAMELESS PLUG>
my music
</SHAMELESS PLUG>

Replies are listed 'Best First'.
RE: Re: mp3.com stats
by mdillon (Priest) on Jul 02, 2000 at 20:29 UTC
    i believe you can get LWP to work with HTTPS URLs by installing Crypt::SSLeay. it requires SSLeay (which is provided as part of the OpenSSL package).

    i just installed that module and verified that i can GET the URL you are interested in.

    also, there is a HTTP::Cookies::Netscape package as part of HTTP::Cookies that allows you to manipulate the Navigator cookie file without reinventing the wheel. you can use it like so:

    use HTTP::Cookies; $cookiejar = new HTTP::Cookies::Netscape(File => "$ENV{HOME}/.netscape +/cookies");