On Apr 19, Jesper Nøhr <[EMAIL PROTECTED]> wrote:

> Wonderful library, first of all. Thanks so much!

Thanks! :-)

> I'm crawling through a bunch of movies, and for each one, I need to
> compare the runtime. So I do .update(), which is heavy..

Yup; if you're using the (default) 'http' data access system, if will
download both the main page ("combined details") and the plot page;
with the 'mobile' it will download the "main details" and the plot
pages.
So, the faster way is using the 'mobile' data access system specifying
to download only the main information (assuming you aren't interested
in the plot):
  from imdb import IMDb
  ia = IMDb('mobile')
  sm = i.search_movie('leprechaun')
  for movie in sm:
      ia.update(movie, 'main')
      print movie.get('runtime', 'runtime info not available')

Beware that - if available - the runtime info will always be a list
of (maybe a single) values, due to the fact that sometimes there are
different versions of a movie.

> Is there any way to only get the runtimes?

Parsing the web pages, no: it's in the main page, so you've to
download and parse it (to tell the truth: it's quite easy to
write a stand alone parser for just this information, but I'm not
sure you will gain much in term of performances).

Another thing you can do is to use the 'sql' data access system:
maybe you can download just the running-times.list.gz file (and maybe
the movies.list.gz if you need the full list of movies) and then
access the data from the SQL database.
Try reading the README.sqldb file; if you have other questions, feel
free to ask!


-- 
Davide Alberani <[EMAIL PROTECTED]> [PGP KeyID: 0x465BFD47]
http://erlug.linux.it/~da/

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Imdbpy-devel mailing list
Imdbpy-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-devel

Reply via email to