Monday 5 November 2007

Films list is back

Rather than pollute and bore people with films list in my blog (I'd rather do that with useless trivia, and self-deprecation), I thought I'd use IMDb's My Movies feature.

The hardest part was getting all the films from a variety of sources into the database, without having to click through all of them. Here comes the Mechanizer (in US English in the text). Given a list of @imdb_ids:

my $mech = new WWW::Mechanize;
$mech->get( "http://www.imdb.com/register/login" );
$mech->success or die "Can't get the login page";

$mech->submit_form(
form_number => 2,
fields => {
login => 'email@test.com',
password => "mypassword",
},
);

my $id;
foreach $id (@imdb_ids) {
print "Adding $id\n";
$mech->get ("http://www.imdb.com/rg/title-lhs/mymovies/mymovies/list?pending&add=$id");
}

I used my old code from film-gallery.pl code to grab the IDs from blogs, and various types of files. HTH.

4 comments:

Johan Dahlin said...

Yay!

Is it possible to sort by the date you add/vote though?

You're still short 100 movies or so to my list:

http://www.imdb.com/mymovies/list?l=26555216

Bastien Nocera said...

And I cheated, I also have TV series on there.

Vicky said...

Is 'Secret Diary of a Call Girl' good? I really wanted to watch that!

Bastien Nocera said...

Vix, yeah, bit kinky. You can see more flesh on French TV at 8 though.