mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-08 22:17:07 +01:00
[dplayit] Fix extraction (closes #13851)
This commit is contained in:
parent
ee6a611665
commit
15d1e8a23d
@ -7,16 +7,18 @@
|
|||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
compat_urlparse,
|
|
||||||
compat_HTTPError,
|
compat_HTTPError,
|
||||||
|
compat_str,
|
||||||
|
compat_urlparse,
|
||||||
)
|
)
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
USER_AGENTS,
|
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
unified_strdate,
|
|
||||||
remove_end,
|
remove_end,
|
||||||
|
try_get,
|
||||||
|
unified_strdate,
|
||||||
update_url_query,
|
update_url_query,
|
||||||
|
USER_AGENTS,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -183,11 +185,27 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
webpage = self._download_webpage(url, display_id)
|
webpage = self._download_webpage(url, display_id)
|
||||||
|
|
||||||
|
title = remove_end(self._og_search_title(webpage), ' | Dplay')
|
||||||
|
|
||||||
|
video_id = None
|
||||||
|
|
||||||
|
info = self._search_regex(
|
||||||
|
r'playback_json\s*:\s*JSON\.parse\s*\(\s*("(?:\\.|[^"\\])+?")',
|
||||||
|
webpage, 'playback JSON', default=None)
|
||||||
|
if info:
|
||||||
|
for _ in range(2):
|
||||||
|
info = self._parse_json(info, display_id, fatal=False)
|
||||||
|
if not info:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
video_id = try_get(info, lambda x: x['data']['id'])
|
||||||
|
|
||||||
|
if not info:
|
||||||
info_url = self._search_regex(
|
info_url = self._search_regex(
|
||||||
r'url\s*[:=]\s*["\']((?:https?:)?//[^/]+/playback/videoPlaybackInfo/\d+)',
|
r'url\s*[:=]\s*["\']((?:https?:)?//[^/]+/playback/videoPlaybackInfo/\d+)',
|
||||||
webpage, 'video id')
|
webpage, 'info url')
|
||||||
|
|
||||||
title = remove_end(self._og_search_title(webpage), ' | Dplay')
|
video_id = info_url.rpartition('/')[-1]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
info = self._download_json(
|
info = self._download_json(
|
||||||
@ -230,7 +248,7 @@ def _real_extract(self, url):
|
|||||||
season_number = episode_number = upload_date = None
|
season_number = episode_number = upload_date = None
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': info_url.rpartition('/')[-1],
|
'id': compat_str(video_id or display_id),
|
||||||
'display_id': display_id,
|
'display_id': display_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
'description': self._og_search_description(webpage),
|
'description': self._og_search_description(webpage),
|
||||||
|
Loading…
Reference in New Issue
Block a user