0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-12-29 01:51:06 +00:00

Fix exception with n_views<1000

This commit is contained in:
peugeot 2014-08-30 23:03:37 +02:00
parent 1d57b2520c
commit 8a6c59865d

View file

@ -34,7 +34,11 @@ def _real_extract(self, url):
duration = int(mobj.group('minutes')) * 60 + int(mobj.group('seconds')) if mobj else None duration = int(mobj.group('minutes')) * 60 + int(mobj.group('seconds')) if mobj else None
mobj = re.search(r'id="cinemaviews">((?P<thousands>\d+),)?(?P<units>\d+)<small>views', webpage) mobj = re.search(r'id="cinemaviews">((?P<thousands>\d+),)?(?P<units>\d+)<small>views', webpage)
view_count = int(mobj.group('thousands')) * 1000 + int(mobj.group('units')) if mobj else None try:
view_count = int(mobj.group('units'))
view_count += int(mobj.group('thousands')) * 1000
except:
pass
return { return {
'id': video_id, 'id': video_id,