I would read over their terms of service and make sure this is not an action that will get your accounts terminated. At a glance it seems ok, but best to be cautious. It might be prudent to ask them, but the answer will likely be "don't do that".
If not for the above mentioned issues my first inclination is to use WWW::Mechanize to automate the login and navigation, as it combines HTTP, html parsing, form population/submission, and link extraction.
The links on the safari bookshelf page seem to be a forward slash followed by a numeric ISBN. So "Perl and LWP", with ISBN 0-596-00178-9, is "/0596001789".
An example of how you could go about solving this problem, if not for the javascript and legality issues, would be something like the following:
Update - It might be worth looking at safari enterprise offerings.use strict; use warnings; use WWW::Mechanize; use Data::Dumper; my $user = 'foo'; my $pass = 'bar'; my $mech = WWW::Mechanize->new(); my $response = $mech->get('http://safari.oreilly.com/login'); die "Failed to load login page: " + $response->message unless $respon +se->is_success; $mech->form_number(1); $mech->set_visible($user,$pass); $response = $mech->submit(); die "Failed to login: " + $response->message unless $response->is_suc +cess; # TODO - Check the page content here for a failed login message # Find the link to the bookshelf, and follow it $mech->follow_link(url_regex => qr/mybookshelf/); # Get a list of all links, then limit the list to those that are /nume +ric my @links = $mech->links(); my @books = grep {$_->url =~ /^\/\d+$/} @links; for my $book (@books) { my $isbn = $book->url; $isbn =~ s//^\//; printf "ISBN: %s Title: %s\n", $isbn, $book->text; }
In reply to Re: Getting user stats from Safari
by imp
in thread Getting user stats from Safari
by carcassonne
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |