mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-08 09:10:09 +01:00
[youtube] Add view_count (Fixes #1781)
This commit is contained in:
parent
ddf49c6344
commit
1d699755e0
@ -1301,6 +1301,11 @@ def _real_extract(self, url):
|
|||||||
else:
|
else:
|
||||||
raise ExtractorError(u'"token" parameter not in video info for unknown reason')
|
raise ExtractorError(u'"token" parameter not in video info for unknown reason')
|
||||||
|
|
||||||
|
if 'view_count' in video_info:
|
||||||
|
view_count = int(video_info['view_count'][0])
|
||||||
|
else:
|
||||||
|
view_count = None
|
||||||
|
|
||||||
# Check for "rental" videos
|
# Check for "rental" videos
|
||||||
if 'ypc_video_rental_bar_text' in video_info and 'author' not in video_info:
|
if 'ypc_video_rental_bar_text' in video_info and 'author' not in video_info:
|
||||||
raise ExtractorError(u'"rental" videos not supported')
|
raise ExtractorError(u'"rental" videos not supported')
|
||||||
@ -1489,6 +1494,7 @@ def _real_extract(self, url):
|
|||||||
'age_limit': 18 if age_gate else 0,
|
'age_limit': 18 if age_gate else 0,
|
||||||
'annotations': video_annotations,
|
'annotations': video_annotations,
|
||||||
'webpage_url': 'https://www.youtube.com/watch?v=%s' % video_id,
|
'webpage_url': 'https://www.youtube.com/watch?v=%s' % video_id,
|
||||||
|
'view_count': view_count,
|
||||||
})
|
})
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user