mirror of
https://github.com/l1ving/youtube-dl
synced 2024-11-20 17:52:51 +08:00
[litv] Support 'promo' URLs (closes #10385)
This commit is contained in:
parent
19f35402c5
commit
39e1c4f08c
@ -7,6 +7,7 @@ Core
|
|||||||
* Fix js_to_json(): correct octal or hexadecimal number detection
|
* Fix js_to_json(): correct octal or hexadecimal number detection
|
||||||
|
|
||||||
Extractors
|
Extractors
|
||||||
|
+ [litv] Support 'promo' URLs (#10385)
|
||||||
* [snotr] Fix extraction (#10338)
|
* [snotr] Fix extraction (#10338)
|
||||||
* [n-tv.de] Fix extraction (#10331)
|
* [n-tv.de] Fix extraction (#10331)
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class LiTVIE(InfoExtractor):
|
class LiTVIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://www\.litv\.tv/vod/[^/]+/content\.do\?.*?\bid=(?P<id>[^&]+)'
|
_VALID_URL = r'https?://www\.litv\.tv/(?:vod|promo)/[^/]+/(?:content\.do)?\?.*?\b(?:content_)?id=(?P<id>[^&]+)'
|
||||||
|
|
||||||
_URL_TEMPLATE = 'https://www.litv.tv/vod/%s/content.do?id=%s'
|
_URL_TEMPLATE = 'https://www.litv.tv/vod/%s/content.do?id=%s'
|
||||||
|
|
||||||
@ -27,6 +27,7 @@ class LiTVIE(InfoExtractor):
|
|||||||
'playlist_count': 50,
|
'playlist_count': 50,
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.litv.tv/vod/drama/content.do?brc_id=root&id=VOD00041610&isUHEnabled=true&autoPlay=1',
|
'url': 'https://www.litv.tv/vod/drama/content.do?brc_id=root&id=VOD00041610&isUHEnabled=true&autoPlay=1',
|
||||||
|
'md5': '969e343d9244778cb29acec608e53640',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'VOD00041610',
|
'id': 'VOD00041610',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
@ -37,7 +38,16 @@ class LiTVIE(InfoExtractor):
|
|||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
'noplaylist': True,
|
'noplaylist': True,
|
||||||
'skip_download': True, # m3u8 download
|
},
|
||||||
|
'skip': 'Georestricted to Taiwan',
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.litv.tv/promo/miyuezhuan/?content_id=VOD00044841&',
|
||||||
|
'md5': '88322ea132f848d6e3e18b32a832b918',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'VOD00044841',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': '芈月傳第1集 霸星芈月降世楚國',
|
||||||
|
'description': '楚威王二年,太史令唐昧夜觀星象,發現霸星即將現世。王后得知霸星的預言後,想盡辦法不讓孩子順利出生,幸得莒姬相護化解危機。沒想到眾人期待下出生的霸星卻是位公主,楚威王對此失望至極。楚王后命人將女嬰丟棄河中,居然奇蹟似的被少司命像攔下,楚威王認為此女非同凡響,為她取名芈月。',
|
||||||
},
|
},
|
||||||
'skip': 'Georestricted to Taiwan',
|
'skip': 'Georestricted to Taiwan',
|
||||||
}]
|
}]
|
||||||
@ -92,13 +102,18 @@ class LiTVIE(InfoExtractor):
|
|||||||
# endpoint gives the same result as the data embedded in the webpage.
|
# endpoint gives the same result as the data embedded in the webpage.
|
||||||
# If georestricted, there are no embedded data, so an extra request is
|
# If georestricted, there are no embedded data, so an extra request is
|
||||||
# necessary to get the error code
|
# necessary to get the error code
|
||||||
|
if 'assetId' not in view_data:
|
||||||
|
view_data = self._download_json(
|
||||||
|
'https://www.litv.tv/vod/ajax/getProgramInfo', video_id,
|
||||||
|
query={'contentId': video_id},
|
||||||
|
headers={'Accept': 'application/json'})
|
||||||
video_data = self._parse_json(self._search_regex(
|
video_data = self._parse_json(self._search_regex(
|
||||||
r'uiHlsUrl\s*=\s*testBackendData\(([^;]+)\);',
|
r'uiHlsUrl\s*=\s*testBackendData\(([^;]+)\);',
|
||||||
webpage, 'video data', default='{}'), video_id)
|
webpage, 'video data', default='{}'), video_id)
|
||||||
if not video_data:
|
if not video_data:
|
||||||
payload = {
|
payload = {
|
||||||
'assetId': view_data['assetId'],
|
'assetId': view_data['assetId'],
|
||||||
'watchDevices': vod_data['watchDevices'],
|
'watchDevices': view_data['watchDevices'],
|
||||||
'contentType': view_data['contentType'],
|
'contentType': view_data['contentType'],
|
||||||
}
|
}
|
||||||
video_data = self._download_json(
|
video_data = self._download_json(
|
||||||
@ -115,7 +130,8 @@ class LiTVIE(InfoExtractor):
|
|||||||
raise ExtractorError('Unexpected result from %s' % self.IE_NAME)
|
raise ExtractorError('Unexpected result from %s' % self.IE_NAME)
|
||||||
|
|
||||||
formats = self._extract_m3u8_formats(
|
formats = self._extract_m3u8_formats(
|
||||||
video_data['fullpath'], video_id, ext='mp4', m3u8_id='hls')
|
video_data['fullpath'], video_id, ext='mp4',
|
||||||
|
entry_protocol='m3u8_native', m3u8_id='hls')
|
||||||
for a_format in formats:
|
for a_format in formats:
|
||||||
# LiTV HLS segments doesn't like compressions
|
# LiTV HLS segments doesn't like compressions
|
||||||
a_format.setdefault('http_headers', {})['Youtubedl-no-compression'] = True
|
a_format.setdefault('http_headers', {})['Youtubedl-no-compression'] = True
|
||||||
|
Loading…
Reference in New Issue
Block a user