search works again
This commit is contained in:
parent
9294f3e964
commit
fbdf44e27a
4 changed files with 23 additions and 18 deletions
|
|
@ -33,26 +33,22 @@ __all__ = ['IndexPage']
|
|||
|
||||
class IndexPage(BasePage):
|
||||
def iter_videos(self):
|
||||
div_list = self.parser.select(self.document.getroot(), 'div.ligne_video')
|
||||
for div in div_list:
|
||||
m = re.match('index.php\?id=(\d+)', div.find('a').attrib['href'])
|
||||
for div in self.parser.select(self.document.getroot(), 'div.data_emissions ul li'):
|
||||
m = re.match('id-(\d+)', div.attrib.get('class', ''))
|
||||
if not m:
|
||||
continue
|
||||
|
||||
img = self.parser.select(div, 'a img', 1)
|
||||
|
||||
video = NolifeTVVideo(m.group(1))
|
||||
video.title = self.parser.select(div, 'span.span_title', 1).text
|
||||
video.description = self.parser.select(div, 'span.span_description', 1).text
|
||||
video.thumbnail = Thumbnail(self.parser.select(div, 'div.screen_video', 1).find('img').attrib['src'])
|
||||
video.title = unicode(img.attrib['alt'])
|
||||
video.description = unicode(self.parser.select(div, 'div.tooltip div.border-bottom p')[-1].text)
|
||||
video.thumbnail = Thumbnail(unicode(img.attrib['src']))
|
||||
try:
|
||||
video.date = parse_dt(self.parser.select(div, 'div.infos_video span.span_title', 1).text.strip())
|
||||
except Exception:
|
||||
video.date = NotAvailable
|
||||
|
||||
rating_url = self.parser.select(div, 'span.description img')[0].attrib['src']
|
||||
m = re.match('.*view_level(\d+)\.gif', rating_url)
|
||||
if m:
|
||||
video.rating = int(m.group(1))
|
||||
video.rating_max = 21
|
||||
else:
|
||||
video.rating = video.rating_max = NotAvailable
|
||||
video.set_empty_fields(NotAvailable, ('url',))
|
||||
|
||||
yield video
|
||||
|
|
|
|||
|
|
@ -83,4 +83,6 @@ class VideoPage(BasePage):
|
|||
raise ForbiddenVideo(values.get('message', 'Not available').decode('iso-8859-15'))
|
||||
video.url = values['url']
|
||||
|
||||
video.set_empty_fields(NotAvailable)
|
||||
|
||||
return video
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue