mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-06-28 01:18:30 +00:00
Refactor
This commit is contained in:
parent
5483d4c8ea
commit
caf6b40762
@ -53,7 +53,7 @@ class CloudyCDNIE(InfoExtractor):
|
|||||||
'params': {'format': 'bv'},
|
'params': {'format': 'bv'},
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://embed.backscreen.com/ltv/media/32j_z25-0600-127?',
|
'url': 'https://embed.backscreen.com/ltv/media/32j_z25-0600-127?',
|
||||||
'md5': '0e14ed052ae6aeba925fbd35dc48b3c1',
|
'md5': '9b6fa09ac1a4de53d4f42b94affc3b42',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '32j_z25-0600-127',
|
'id': '32j_z25-0600-127',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
|
@ -210,7 +210,7 @@ def _real_extract(self, url):
|
|||||||
r'window\.ltvEmbedPayload\s*=', webpage, 'embed json', video_id)
|
r'window\.ltvEmbedPayload\s*=', webpage, 'embed json', video_id)
|
||||||
embed_type = traverse_obj(data, ('source', 'name', {str}))
|
embed_type = traverse_obj(data, ('source', 'name', {str}))
|
||||||
|
|
||||||
if embed_type == 'backscreen':
|
if embed_type in ('backscreen', 'telia'): # 'telia' only for backwards compat
|
||||||
ie_key = 'CloudyCDN'
|
ie_key = 'CloudyCDN'
|
||||||
embed_url = traverse_obj(data, ('source', 'embed_url', {url_or_none}))
|
embed_url = traverse_obj(data, ('source', 'embed_url', {url_or_none}))
|
||||||
elif embed_type == 'youtube':
|
elif embed_type == 'youtube':
|
||||||
@ -228,7 +228,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
|
|
||||||
class LSMReplayIE(InfoExtractor):
|
class LSMReplayIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://replay\.lsm\.lv/[^/?#]+/(?:skaties|klausies)/(?:ieraksts|statja)/[^/?#]+/(?P<id>\d+)'
|
_VALID_URL = r'https?://replay\.lsm\.lv/[^/?#]+/(?:skaties/|klausies/)?(?:ieraksts|statja)/[^/?#]+/(?P<id>\d+)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://replay.lsm.lv/lv/skaties/ieraksts/ltv/311130/4-studija-zolitudes-tragedija-un-incupes-stacija',
|
'url': 'https://replay.lsm.lv/lv/skaties/ieraksts/ltv/311130/4-studija-zolitudes-tragedija-un-incupes-stacija',
|
||||||
'md5': '64f72a360ca530d5ed89c77646c9eee5',
|
'md5': '64f72a360ca530d5ed89c77646c9eee5',
|
||||||
@ -258,6 +258,9 @@ class LSMReplayIE(InfoExtractor):
|
|||||||
}, {
|
}, {
|
||||||
'url': 'https://replay.lsm.lv/ru/skaties/statja/ltv/355067/v-kengaragse-nacalas-ukladka-relsov',
|
'url': 'https://replay.lsm.lv/ru/skaties/statja/ltv/355067/v-kengaragse-nacalas-ukladka-relsov',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'https://replay.lsm.lv/lv/ieraksts/ltv/311130/4-studija-zolitudes-tragedija-un-incupes-stacija',
|
||||||
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _fix_nuxt_data(self, webpage):
|
def _fix_nuxt_data(self, webpage):
|
||||||
@ -269,19 +272,16 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
data = self._search_nuxt_data(
|
data = self._search_nuxt_data(
|
||||||
self._fix_nuxt_data(webpage), video_id, context_name='__REPLAY__')
|
self._fix_nuxt_data(webpage), video_id, context_name='__REPLAY__')
|
||||||
playback_type = traverse_obj(data, ('playback', 'type'))
|
playback_type = data['playback']['type']
|
||||||
|
|
||||||
if playback_type == 'playable_audio_lr':
|
if playback_type == 'playable_audio_lr':
|
||||||
playback_data = {
|
playback_data = {
|
||||||
'formats': self._extract_m3u8_formats(
|
'formats': self._extract_m3u8_formats(data['playback']['service']['hls_url'], video_id),
|
||||||
traverse_obj(data, ('playback', 'service', 'hls_url', {url_or_none})), video_id),
|
|
||||||
}
|
}
|
||||||
elif playback_type == 'embed':
|
elif playback_type == 'embed':
|
||||||
playback_data = {
|
playback_data = {
|
||||||
'_type': 'url_transparent',
|
'_type': 'url_transparent',
|
||||||
**traverse_obj(data, {
|
'url': data['playback']['service']['url'],
|
||||||
'url': ('playback', 'service', 'url', {url_or_none}),
|
|
||||||
}),
|
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
raise ExtractorError(f'Unsupported playback type {playback_type!r}')
|
raise ExtractorError(f'Unsupported playback type {playback_type!r}')
|
||||||
|
Loading…
Reference in New Issue
Block a user