mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[dplayit] Fix extraction (closes #16901)
This commit is contained in:
parent
9a6628aaf9
commit
94fef94d9c
1 changed files with 7 additions and 2 deletions
|
@ -21,6 +21,7 @@
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
unified_timestamp,
|
unified_timestamp,
|
||||||
update_url_query,
|
update_url_query,
|
||||||
|
urljoin,
|
||||||
USER_AGENTS,
|
USER_AGENTS,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -310,9 +311,11 @@ def _real_extract(self, url):
|
||||||
|
|
||||||
if not info:
|
if not info:
|
||||||
info_url = self._search_regex(
|
info_url = self._search_regex(
|
||||||
r'url\s*[:=]\s*["\']((?:https?:)?//[^/]+/playback/videoPlaybackInfo/\d+)',
|
(r'playback_json_url\s*:\s*(["\'])(?P<url>(?:(?!\1).)+)\1',
|
||||||
webpage, 'info url')
|
r'url\s*[:=]\s*["\'](?P<url>(?:https?:)?//[^/]+/playback/videoPlaybackInfo/\d+)'),
|
||||||
|
webpage, 'info url', group='url')
|
||||||
|
|
||||||
|
info_url = urljoin(url, info_url)
|
||||||
video_id = info_url.rpartition('/')[-1]
|
video_id = info_url.rpartition('/')[-1]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -322,6 +325,8 @@ def _real_extract(self, url):
|
||||||
'dplayit_token').value,
|
'dplayit_token').value,
|
||||||
'Referer': url,
|
'Referer': url,
|
||||||
})
|
})
|
||||||
|
if isinstance(info, compat_str):
|
||||||
|
info = self._parse_json(info, display_id)
|
||||||
except ExtractorError as e:
|
except ExtractorError as e:
|
||||||
if isinstance(e.cause, compat_HTTPError) and e.cause.code in (400, 403):
|
if isinstance(e.cause, compat_HTTPError) and e.cause.code in (400, 403):
|
||||||
info = self._parse_json(e.cause.read().decode('utf-8'), display_id)
|
info = self._parse_json(e.cause.read().decode('utf-8'), display_id)
|
||||||
|
|
Loading…
Reference in a new issue