imdb in progress...
This commit is contained in:
parent
3492dbb9d6
commit
a82483727b
4 changed files with 62 additions and 21 deletions
|
|
@ -33,7 +33,8 @@ class MoviePage(BasePage):
|
|||
def get_movie(self,id):
|
||||
title = NotAvailable
|
||||
duration = NotAvailable
|
||||
description = NotAvailable.__unicode__()
|
||||
release_date = NotAvailable
|
||||
description = NotAvailable
|
||||
td_overview = self.parser.select(self.document.getroot(),'td#overview-top',1)
|
||||
for span in self.parser.select(td_overview,'h1.header span[itemprop=name]'):
|
||||
if span.attrib.get('class','') == 'itemprop':
|
||||
|
|
@ -42,10 +43,12 @@ class MoviePage(BasePage):
|
|||
title = other_titles
|
||||
elif span.attrib.get('class','') == 'title-extra':
|
||||
title = span.text
|
||||
meta = self.parser.select(td_overview,'meta[itemprop=datePublished]',1)
|
||||
datestrings = meta.attrib.get('content','').split('-')
|
||||
if len(datestrings) == 2:
|
||||
datestrings.append('1')
|
||||
metas = self.parser.select(td_overview,'meta[itemprop=datePublished]')
|
||||
if len(metas) > 0:
|
||||
datestrings = metas[0].attrib.get('content','').split('-')
|
||||
if len(datestrings) == 2:
|
||||
datestrings.append('1')
|
||||
release_date = datetime(int(datestrings[0]),int(datestrings[1]),int(datestrings[2]))
|
||||
time = self.parser.select(td_overview,'time[itemprop=duration]')
|
||||
if len(time) > 0:
|
||||
duration = int(time[0].attrib.get('datetime','').strip(string.letters))
|
||||
|
|
@ -54,7 +57,7 @@ class MoviePage(BasePage):
|
|||
description = desc[0].text
|
||||
movie = Movie(id,title.strip())
|
||||
movie.other_titles = other_titles.strip()
|
||||
movie.release_date = datetime(int(datestrings[0]),int(datestrings[1]),int(datestrings[2]))
|
||||
movie.release_date = release_date
|
||||
movie.duration = duration
|
||||
movie.description = description
|
||||
movie.note = "10/10"
|
||||
|
|
@ -81,22 +84,55 @@ class MovieCrewPage(BasePage):
|
|||
person.real_name = NotAvailable
|
||||
person.birth_date = NotAvailable
|
||||
person.nationality = NotAvailable
|
||||
person.biography = NotAvailable
|
||||
person.gender = NotAvailable
|
||||
yield person
|
||||
|
||||
|
||||
class PersonPage(BasePage):
|
||||
def get_person(self,id):
|
||||
person = Person(id,'nameplop')
|
||||
person.real_name = 'rn'
|
||||
person.birth_date = datetime.now()
|
||||
person.birth_place = "place"
|
||||
person.gender = "M"
|
||||
person.nationality = "nn"
|
||||
person.biography = 'bio'
|
||||
name = NotAvailable
|
||||
biography = NotAvailable
|
||||
birth_place = NotAvailable
|
||||
birth_date = NotAvailable
|
||||
real_name = NotAvailable
|
||||
gender = NotAvailable
|
||||
nationality = NotAvailable
|
||||
td_overview = self.parser.select(self.document.getroot(),'td#overview-top',1)
|
||||
descs = self.parser.select(td_overview,'span[itemprop=description]')
|
||||
if len(descs) > 0:
|
||||
biography = descs[0].text
|
||||
names = self.parser.select(td_overview,'h1[itemprop=name]')
|
||||
if len(names) > 0:
|
||||
name = names[0].text
|
||||
times = self.parser.select(td_overview,'time[itemprop=birthDate]')
|
||||
if len(times) > 0:
|
||||
time = times[0].attrib.get('datetime','').split('-')
|
||||
birth_date = datetime(int(time[0]),int(time[1]),int(time[2]))
|
||||
|
||||
person = Person(id,name)
|
||||
person.real_name = real_name
|
||||
person.birth_date = birth_date
|
||||
person.birth_place = birth_place
|
||||
person.gender = gender
|
||||
person.nationality = nationality
|
||||
person.biography = biography
|
||||
person.awards = ["aw1","aw2"]
|
||||
person.roles = {}
|
||||
return person
|
||||
|
||||
def iter_movies(self,person_id):
|
||||
pass
|
||||
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 self.browser.get_movie(id)
|
||||
#title = a.text
|
||||
#movie = Movie(id,title)
|
||||
#movie.other_titles = NotAvailable
|
||||
#movie.release_date = NotAvailable
|
||||
#movie.duration = NotAvailable
|
||||
#movie.description = NotAvailable
|
||||
#movie.note = NotAvailable
|
||||
#movie.awards = NotAvailable
|
||||
#movie.roles = NotAvailable
|
||||
#yield movie
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue