mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-18 05:19:59 +00:00
[cleanup] Make more playlist entries lazy (#11763)
Authored by: seproDev
This commit is contained in:
parent
dc3c4fddcc
commit
5421669626
4 changed files with 6 additions and 5 deletions
|
@ -31,6 +31,7 @@
|
||||||
update_url_query,
|
update_url_query,
|
||||||
url_or_none,
|
url_or_none,
|
||||||
)
|
)
|
||||||
|
from ..utils.traversal import traverse_obj
|
||||||
|
|
||||||
|
|
||||||
class BrightcoveLegacyIE(InfoExtractor):
|
class BrightcoveLegacyIE(InfoExtractor):
|
||||||
|
@ -935,8 +936,8 @@ def extract_policy_key():
|
||||||
|
|
||||||
if content_type == 'playlist':
|
if content_type == 'playlist':
|
||||||
return self.playlist_result(
|
return self.playlist_result(
|
||||||
[self._parse_brightcove_metadata(vid, vid.get('id'), headers)
|
(self._parse_brightcove_metadata(vid, vid['id'], headers)
|
||||||
for vid in json_data.get('videos', []) if vid.get('id')],
|
for vid in traverse_obj(json_data, ('videos', lambda _, v: v['id']))),
|
||||||
json_data.get('id'), json_data.get('name'),
|
json_data.get('id'), json_data.get('name'),
|
||||||
json_data.get('description'))
|
json_data.get('description'))
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ def _real_extract(self, url):
|
||||||
items = re.findall(r'(?s)playlist\.push\(({.+?})\);', webpage)
|
items = re.findall(r'(?s)playlist\.push\(({.+?})\);', webpage)
|
||||||
if items:
|
if items:
|
||||||
return self.playlist_result(
|
return self.playlist_result(
|
||||||
[self._parse_video_metadata(i, video_id, timestamp) for i in items],
|
(self._parse_video_metadata(i, video_id, timestamp) for i in items),
|
||||||
video_id, self._html_search_meta('twitter:title', webpage))
|
video_id, self._html_search_meta('twitter:title', webpage))
|
||||||
|
|
||||||
item = self._search_regex(
|
item = self._search_regex(
|
||||||
|
|
|
@ -343,7 +343,7 @@ def _real_extract(self, url):
|
||||||
if media_ids:
|
if media_ids:
|
||||||
media_ids.append(lead_video_id)
|
media_ids.append(lead_video_id)
|
||||||
return self.playlist_result(
|
return self.playlist_result(
|
||||||
[self._extract_video(media_id) for media_id in media_ids], page_id, title, description)
|
map(self._extract_video, media_ids), page_id, title, description)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
**self._extract_video(lead_video_id),
|
**self._extract_video(lead_video_id),
|
||||||
|
|
|
@ -421,5 +421,5 @@ def _real_extract(self, url):
|
||||||
return self._process_video_json(video_json['chapters'][0], video_id)
|
return self._process_video_json(video_json['chapters'][0], video_id)
|
||||||
|
|
||||||
return self.playlist_result(
|
return self.playlist_result(
|
||||||
[self._process_video_json(chapter, video_id) for chapter in video_json['chapters']],
|
(self._process_video_json(chapter, video_id) for chapter in video_json['chapters']),
|
||||||
str(video_json['playerUuid']), video_json.get('name'))
|
str(video_json['playerUuid']), video_json.get('name'))
|
||||||
|
|
Loading…
Reference in a new issue