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:
parent
ea0af7b6a1
commit
e1d3e43a4d
1 changed files with 5 additions and 1 deletions
|
|
@ -67,7 +67,11 @@ class IndexPage(BasePage):
|
||||||
else:
|
else:
|
||||||
raise BrokenPageError('Unable to parse duration %r' % self.parser.select(div, 'div.duration', 1).text)
|
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))
|
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)
|
video.thumbnail = Thumbnail(url)
|
||||||
|
|
||||||
rating_div = self.parser.select(div, 'div.small_stars', 1)
|
rating_div = self.parser.select(div, 'div.small_stars', 1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue