On May 29, David Kaufman <[email protected]> wrote:
> To illustrate my example look at and you'll see the error right away:
Well, it's not an error: it's the expected behaviour. :-)
Let's follow the code:
> ia = IMDb('http')
In the above line, you can set the optional parameter "loggingLevel"
to "debug" to get a lot of information about what's going on.
> sp = ia.get_movie('0121955')
Here we get and parse the default info sets for a movie (i.e.: 'main'
and 'plot'):
http://akas.imdb.com/title/tt0121955/combined
http://akas.imdb.com/title/tt0121955/plotsummary
> ia.update(sp, "episodes")
Here we're asking IMDbPY to fetch another info set ('episodes'):
http://akas.imdb.com/title/tt0121955/episodes
By the way: for a list of available info sets, you can
call the ia.get_movie_infoset() method (there are corresponding
methods for companies, persons and characters, too).
> randomepisode = seasons[1][2]
randomepisode is a Movie instance created by the parser
of the "episodes" page, and it can contain only the information
available at that time. I.e.: the ones in:
http://akas.imdb.com/title/tt0121955/episodes
As you can see there's a plot, but not a rating, there.
At any time, you can see the list of information stored in
a Movie/Person/Character/Company object with: randomepisode.keys()
> print randomepisode.get("plot") #works
> print randomepisode.get("rating") #prints None
So, this is normal.
> Note that I actually could call ia.update(randomepisode) and the
> rating would appear but it's extremly slow.
Unfortunately, until you fetch/parse the main page about that
movie, your Movie instance can't contain the rating.
You can do two things to speed up at least a little your code:
1. use the 'mobile' data access system ( e.g.: ia = IMDb('mobile') )
It uses a different set of parsers and fetches web pages which
contain less information (but normally everything you need).
2. instead of a ia.update(randomepisode) call, you can do this:
ia.update(randomepisode, 'main') to exclude at least the plot page.
HTH,
--
Davide Alberani <[email protected]> [GPG KeyID: 0x465BFD47]
http://www.mimante.net/
------------------------------------------------------------------------------
_______________________________________________
Imdbpy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/imdbpy-devel