On Mar 23, Michael Charclo <charclo.mich...@gmail.com> wrote:

> I'm trying to get the title and plot of certain episodes of a serie.

Hi!

> import imdb
> IMDb = imdb.IMDb()

This name ("IMDb") could be a little confusing...

> search_result = IMDb.search_movie('heroes')
> 
> serie = search_result[0]

Here you've to put, to retrieve information about episodes, this line:
  IMDb.update(serie, 'episodes')

> title = serie['episodes'][1][4]['title']
> plot = serie['episodes'][1][4]['plot']

With the 'update' call, the above lines works, with IMDbPY 4.0.

> What's the best way to get title and plot for an episode now?

Some considerations:
- update to 4.0; 3.6 is way too old.
- instead of 'episodes', in the update call, you can use 'episodes cast',
  if you need also the complete cast of the episodes.
- beware that accessing ['plot'] you take for grant that it exists,
  but it may be not.  Using .get('plot') would be safer.
  More or less the same is true with season and episode numbers (1 and
  4, in your example).
  In the imdb.helpers module there are the sortedSeasons and sortedEpisodes
  functions, useful to manage safely series seasons/episodes.


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

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Imdbpy-devel mailing list
Imdbpy-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-devel

Reply via email to