Updated to pass new Ruff rules

This commit is contained in:
Sean Ellingham 2024-06-21 17:25:08 +01:00
parent f02abfde27
commit 3ae4eba8c4

View file

@ -11,14 +11,14 @@ def _get_formats_and_subtitles(self, video_source, video_id):
if key == 'hls': if key == 'hls':
for video_hls in value: for video_hls in value:
fmts, subs = self._extract_m3u8_formats_and_subtitles(video_hls.get('url'), video_id, headers={ fmts, subs = self._extract_m3u8_formats_and_subtitles(video_hls.get('url'), video_id, headers={
'referer': 'https://play.vidyard.com/' 'referer': 'https://play.vidyard.com/',
}) })
formats.extend(fmts) formats.extend(fmts)
self._merge_subtitles(subs, target=subtitles) self._merge_subtitles(subs, target=subtitles)
else: else:
formats.extend({ formats.extend({
'url': video_mp4.get('url'), 'url': video_mp4.get('url'),
'ext': 'mp4' 'ext': 'mp4',
} for video_mp4 in value) } for video_mp4 in value)
return formats, subtitles return formats, subtitles
@ -28,7 +28,7 @@ def _get_direct_subtitles(self, caption_json):
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({
'url': caption.get('vttUrl'), 'url': caption.get('vttUrl'),
'name': caption.get('name') 'name': caption.get('name'),
}) })
return subs return subs
@ -56,8 +56,8 @@ def _real_extract(self, url):
'thumbnails': [{'url': thumbnail_url} 'thumbnails': [{'url': thumbnail_url}
for thumbnail_url in traverse_obj(json_data, ('thumbnailUrls', ...))], for thumbnail_url in traverse_obj(json_data, ('thumbnailUrls', ...))],
'http_headers': { 'http_headers': {
'referer': 'https://play.vidyard.com/' 'referer': 'https://play.vidyard.com/',
} },
} }
@ -73,7 +73,7 @@ class VidyardWatchIE(VidyardBaseInfoExtractor):
'description': 'Look I changed the description.', 'description': 'Look I changed the description.',
'thumbnail': 'https://cdn.vidyard.com/thumbnails/50347/OUPa5LTKV46849sLYngMqQ_small.jpg', 'thumbnail': 'https://cdn.vidyard.com/thumbnails/50347/OUPa5LTKV46849sLYngMqQ_small.jpg',
'duration': 99, 'duration': 99,
} },
}, },
{ {
'url': 'https://share.vidyard.com/watch/PaQzDAT1h8JqB8ivEu2j6Y?', 'url': 'https://share.vidyard.com/watch/PaQzDAT1h8JqB8ivEu2j6Y?',
@ -84,7 +84,7 @@ class VidyardWatchIE(VidyardBaseInfoExtractor):
'description': 'Vidyard video', 'description': 'Vidyard video',
'thumbnail': 'https://cdn.vidyard.com/thumbnails/spacer.gif', 'thumbnail': 'https://cdn.vidyard.com/thumbnails/spacer.gif',
'duration': 41, 'duration': 41,
} },
}, },
] ]
@ -101,8 +101,8 @@ class VidyardEmbedIE(VidyardBaseInfoExtractor):
'description': 'Look I changed the description.', 'description': 'Look I changed the description.',
'thumbnail': 'https://cdn.vidyard.com/thumbnails/50347/OUPa5LTKV46849sLYngMqQ_small.jpg', 'thumbnail': 'https://cdn.vidyard.com/thumbnails/50347/OUPa5LTKV46849sLYngMqQ_small.jpg',
'duration': 99, 'duration': 99,
} },
} },
] ]
@ -118,7 +118,7 @@ class VidyardPlayIE(VidyardBaseInfoExtractor):
'title': 'Lightbox Embed', 'title': 'Lightbox Embed',
'thumbnail': 'https://cdn.vidyard.com/thumbnails/spacer.gif', 'thumbnail': 'https://cdn.vidyard.com/thumbnails/spacer.gif',
'duration': 39, 'duration': 39,
} },
}, },
{ {
# URL of inline/lightbox embed src # URL of inline/lightbox embed src
@ -129,7 +129,7 @@ class VidyardPlayIE(VidyardBaseInfoExtractor):
'title': 'Lightbox Embed', 'title': 'Lightbox Embed',
'thumbnail': 'https://cdn.vidyard.com/thumbnails/spacer.gif', 'thumbnail': 'https://cdn.vidyard.com/thumbnails/spacer.gif',
'duration': 39, 'duration': 39,
} },
}, },
] ]
_EMBED_REGEX = [ _EMBED_REGEX = [
@ -148,7 +148,7 @@ class VidyardPlayIE(VidyardBaseInfoExtractor):
'title': 'The Extreme Importance of PC Board Stack Up', 'title': 'The Extreme Importance of PC Board Stack Up',
'thumbnail': 'https://cdn.vidyard.com/thumbnails/73_Q3_hBexWX7Og1sae6cg/9998fa4faec921439e2c04_small.jpg', 'thumbnail': 'https://cdn.vidyard.com/thumbnails/73_Q3_hBexWX7Og1sae6cg/9998fa4faec921439e2c04_small.jpg',
'duration': 3422, 'duration': 3422,
} },
}, },
] ]