mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-21 12:34:08 +00:00
[pbs] fix embed data extraction(fixes #16474)
This commit is contained in:
parent
6843ac5b13
commit
eea2fafcf5
@ -505,7 +505,7 @@ class PBSIE(InfoExtractor):
|
|||||||
if player:
|
if player:
|
||||||
video_info = self._parse_json(
|
video_info = self._parse_json(
|
||||||
self._search_regex(
|
self._search_regex(
|
||||||
r'(?s)PBS\.videoData\s*=\s*({.+?});\n',
|
[r'(?s)PBS\.videoData\s*=\s*({.+?});\n', r'window\.videoBridge\s*=\s*({.+?});'],
|
||||||
player, '%s video data' % page, default='{}'),
|
player, '%s video data' % page, default='{}'),
|
||||||
display_id, transform_source=js_to_json, fatal=False)
|
display_id, transform_source=js_to_json, fatal=False)
|
||||||
if video_info:
|
if video_info:
|
||||||
@ -513,10 +513,14 @@ class PBSIE(InfoExtractor):
|
|||||||
if not info:
|
if not info:
|
||||||
info = video_info
|
info = video_info
|
||||||
if not chapters:
|
if not chapters:
|
||||||
for chapter_data in re.findall(r'(?s)chapters\.push\(({.*?})\)', player):
|
raw_chapters = video_info.get('chapters') or []
|
||||||
chapter = self._parse_json(chapter_data, video_id, js_to_json, fatal=False)
|
if not raw_chapters:
|
||||||
if not chapter:
|
for chapter_data in re.findall(r'(?s)chapters\.push\(({.*?})\)', player):
|
||||||
continue
|
chapter = self._parse_json(chapter_data, video_id, js_to_json, fatal=False)
|
||||||
|
if not chapter:
|
||||||
|
continue
|
||||||
|
raw_chapters.append(chapter)
|
||||||
|
for chapter in raw_chapters:
|
||||||
start_time = float_or_none(chapter.get('start_time'), 1000)
|
start_time = float_or_none(chapter.get('start_time'), 1000)
|
||||||
duration = float_or_none(chapter.get('duration'), 1000)
|
duration = float_or_none(chapter.get('duration'), 1000)
|
||||||
if start_time is None or duration is None:
|
if start_time is None or duration is None:
|
||||||
|
Loading…
Reference in New Issue
Block a user