mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-07-17 18:58:35 +00:00
Merge 1565a11e9a
into c1ac543c81
This commit is contained in:
commit
2470daafe0
@ -20,6 +20,7 @@
|
||||
remove_quotes,
|
||||
remove_start,
|
||||
str_to_int,
|
||||
traverse_obj,
|
||||
update_url_query,
|
||||
url_or_none,
|
||||
urlencode_postdata,
|
||||
@ -325,6 +326,12 @@ def dl_webpage(platform):
|
||||
})
|
||||
thumbnail = flashvars.get('image_url')
|
||||
duration = int_or_none(flashvars.get('video_duration'))
|
||||
chapters = traverse_obj(flashvars, (
|
||||
'actionTags', {lambda x: x.split(',')}, ..., {lambda x: x.split(':', 1)},
|
||||
all, lambda _, v: int_or_none(v[1]) is not None, {
|
||||
'title': (0, {str.strip}),
|
||||
'start_time': (1, {int_or_none}),
|
||||
})) or None
|
||||
media_definitions = flashvars.get('mediaDefinitions')
|
||||
if isinstance(media_definitions, list):
|
||||
for definition in media_definitions:
|
||||
@ -339,7 +346,7 @@ def dl_webpage(platform):
|
||||
video_urls.append(
|
||||
(video_url, int_or_none(definition.get('quality'))))
|
||||
else:
|
||||
thumbnail, duration = [None] * 2
|
||||
thumbnail, duration, chapters = [None] * 3
|
||||
|
||||
def extract_js_vars(webpage, pattern, default=NO_DEFAULT):
|
||||
assignments = self._search_regex(
|
||||
@ -499,6 +506,7 @@ def extract_list(meta_key):
|
||||
'title': title,
|
||||
'thumbnail': thumbnail,
|
||||
'duration': duration,
|
||||
'chapters': chapters,
|
||||
'view_count': view_count,
|
||||
'like_count': like_count,
|
||||
'dislike_count': dislike_count,
|
||||
|
Loading…
Reference in New Issue
Block a user