Fix getting dailymotion thumbnails

It is now in "data-src" instead of "src", because they use JavaScript
lazy loading.
Also ask for the bigger thumbnail, and remove useless anti-caching.
This commit is contained in:
Laurent Bachelier 2012-03-15 23:48:54 +01:00
commit e1d3e43a4d

View file

@ -67,7 +67,11 @@ class IndexPage(BasePage):
else:
raise BrokenPageError('Unable to parse duration %r' % self.parser.select(div, 'div.duration', 1).text)
video.duration = datetime.timedelta(hours=int(hours), minutes=int(minutes), seconds=int(seconds))
url = self.parser.select(div, 'img.dmco_image', 1).attrib['src']
url = self.parser.select(div, 'img.dmco_image', 1).attrib['data-src']
# remove the useless anti-caching
url = re.sub('\?\d+', '', url)
# use the bigger thumbnail
url = url.replace('jpeg_preview_medium.jpg', 'jpeg_preview_large.jpg')
video.thumbnail = Thumbnail(url)
rating_div = self.parser.select(div, 'div.small_stars', 1)