On Nov 12, Jeff Clemmer <jrcle...@yahoo.com> wrote:

> I was hoping I could speed up my script by just adding the cast
> information, not downloading everything.  Is this possible?

Not exactly: the cast is in the main page of a movie, and "information
sets" map - more or less - the _pages_ served by imdb.com (this is true
only fetching the data from the web, obviously) and not a single kind
of data.

You can do two things:
1. Avoid the fetching/parsing of the 'plot' page, doing this:
     import imdb
     i = imdb.IMDb('http')
     l = i.search_movie('U-571')
     i.update(l[0], 'main')
     print l[0]['cast']
   this does not fetch the plot page, like a simple i.update(l[0])
   would do, since - if not specified - the 'update' method fetches
   the information stored in the object.default_info tuple.
   In case of a Movie instance, Movie.default_info is set to ('main',
   'plot') and so both pages are fetched and parsed.
   There's no 'cast' information set, since this information comes
   along with a lot of other ones on the same page.

2. use 'mobile' instead of 'http'; in this case you can use the
   above trick, too.
   The 'mobile' parsers should be faster and the downloaded page
   smaller, but it comes at a cost: in the fetched page, only the
   first 15 cast members are listed.

You could also think about using 'sql': the cast lists are complete,
and there's no need to access the imdb.com servers for every movie
(moreover, if you need some serious performances you can always
use the database directly, with SQL statements).


HTH,
-- 
Davide Alberani <davide.alber...@gmail.com> [GPG KeyID: 0x465BFD47]
http://erlug.linux.it/~da/

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Imdbpy-help mailing list
Imdbpy-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-help

Reply via email to