mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-17 00:22:34 +01:00
Apply suggestions from code review
Co-authored-by: dirkf <fieldhouse@gmx.net>
This commit is contained in:
parent
5ef0b73d23
commit
05bcab792f
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
class VidyardBaseInfoExtractor(InfoExtractor):
|
class VidyardBaseInfoExtractor(InfoExtractor):
|
||||||
|
|
||||||
def _get_formats_and_subtitle(self, video_source, video_id):
|
def _get_formats_and_subtitles(self, video_source, video_id):
|
||||||
video_source = video_source or {}
|
video_source = video_source or {}
|
||||||
formats, subtitles = [], {}
|
formats, subtitles = [], {}
|
||||||
for key, value in video_source.items():
|
for key, value in video_source.items():
|
||||||
@ -23,7 +23,7 @@ def _get_formats_and_subtitle(self, video_source, video_id):
|
|||||||
|
|
||||||
return formats, subtitles
|
return formats, subtitles
|
||||||
|
|
||||||
def _get_direct_subtitle(self, caption_json):
|
def _get_direct_subtitles(self, caption_json):
|
||||||
subs = {}
|
subs = {}
|
||||||
for caption in caption_json:
|
for caption in caption_json:
|
||||||
subs.setdefault(caption.get('language') or 'und', []).append({
|
subs.setdefault(caption.get('language') or 'und', []).append({
|
||||||
@ -43,12 +43,12 @@ def _real_extract(self, url):
|
|||||||
json_data = self._download_json(
|
json_data = self._download_json(
|
||||||
f'https://play.vidyard.com/player/{video_id}.json', video_id)['payload']['chapters'][0]
|
f'https://play.vidyard.com/player/{video_id}.json', video_id)['payload']['chapters'][0]
|
||||||
|
|
||||||
formats, subtitles = self._get_formats_and_subtitle(json_data['sources'], video_id)
|
formats, subtitles = self._get_formats_and_subtitles(json_data['sources'], video_id)
|
||||||
self._merge_subtitles(self._get_direct_subtitle(json_data.get('captions')), target=subtitles)
|
self._merge_subtitles(self._get_direct_subtitles(json_data.get('captions')), target=subtitles)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': str(json_data['videoId']),
|
'id': str(json_data['videoId']),
|
||||||
'title': json_data.get('name') or self._og_search_title(webpage, default=None) or self._html_extract_title(),
|
'title': json_data.get('name') or self._og_search_title(webpage, default=None) or self._html_extract_title(webpage),
|
||||||
'description': json_data.get('description') or self._og_search_description(webpage, default=None),
|
'description': json_data.get('description') or self._og_search_description(webpage, default=None),
|
||||||
'duration': int_or_none(json_data.get('seconds')),
|
'duration': int_or_none(json_data.get('seconds')),
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
Loading…
Reference in New Issue
Block a user