[cineoob] new command movies_in_common
This commit is contained in:
parent
efaee3a661
commit
a6430c96b3
5 changed files with 67 additions and 3 deletions
|
|
@ -56,3 +56,6 @@ class ImdbBackend(BaseBackend, ICapCinema):
|
|||
|
||||
def iter_person_movies(self, id):
|
||||
return self.browser.iter_person_movies(id)
|
||||
|
||||
def iter_person_movies_ids(self, id):
|
||||
return self.browser.iter_person_movies_ids(id)
|
||||
|
|
|
|||
|
|
@ -72,7 +72,11 @@ class ImdbBrowser(BaseBrowser):
|
|||
|
||||
title = jres['title']
|
||||
if jres.has_key('runtime'):
|
||||
duration = int(jres['runtime'][0].split(':')[-1].split()[0])
|
||||
dur_str = jres['runtime'][0].split(':')
|
||||
if len(dur_str) == 1:
|
||||
duration = int(dur_str[0].split()[0])
|
||||
else:
|
||||
duration = int(dur_str[1].split()[0])
|
||||
if jres.has_key('also_known_as'):
|
||||
for other_t in jres['also_known_as']:
|
||||
if other_t.has_key('country') and other_t.has_key('title'):
|
||||
|
|
@ -126,3 +130,8 @@ class ImdbBrowser(BaseBrowser):
|
|||
self.location('http://www.imdb.com/name/%s' % person_id)
|
||||
assert self.is_on_page(PersonPage)
|
||||
return self.page.iter_movies(person_id)
|
||||
|
||||
def iter_person_movies_ids(self, person_id):
|
||||
self.location('http://www.imdb.com/name/%s' % person_id)
|
||||
assert self.is_on_page(PersonPage)
|
||||
return self.page.iter_movies_ids(person_id)
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class PersonPage(BasePage):
|
|||
biography = descs[0].text
|
||||
names = self.parser.select(td_overview,'h1[itemprop=name]')
|
||||
if len(names) > 0:
|
||||
name = names[0].text
|
||||
name = names[0].text.strip()
|
||||
times = self.parser.select(td_overview,'time[itemprop=birthDate]')
|
||||
if len(times) > 0:
|
||||
time = times[0].attrib.get('datetime','').split('-')
|
||||
|
|
@ -96,3 +96,9 @@ class PersonPage(BasePage):
|
|||
a = self.parser.select(movie_div,'b a',1)
|
||||
id = a.attrib.get('href','').strip('/').split('/')[-1]
|
||||
yield self.browser.get_movie(id)
|
||||
|
||||
def iter_movies_ids(self,person_id):
|
||||
for movie_div in self.parser.select(self.document.getroot(),'div[class~=filmo-row]'):
|
||||
a = self.parser.select(movie_div,'b a',1)
|
||||
id = a.attrib.get('href','').strip('/').split('/')[-1]
|
||||
yield id
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue