mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-10 09:21:27 +01:00
Compare commits
6 Commits
cfd7c8ca04
...
1fdfb4d65d
Author | SHA1 | Date | |
---|---|---|---|
|
1fdfb4d65d | ||
|
66c246f124 | ||
|
70093357ba | ||
|
087c2a919a | ||
|
7668f71a3b | ||
|
2f2cd22571 |
|
@ -6,6 +6,7 @@ from ..utils import (
|
|||
int_or_none,
|
||||
smuggle_url,
|
||||
unsmuggle_url,
|
||||
traverse_obj,
|
||||
)
|
||||
|
||||
|
||||
|
@ -38,20 +39,26 @@ class LiTVIE(InfoExtractor):
|
|||
'noplaylist': True,
|
||||
},
|
||||
'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': 'No longer exists',
|
||||
}]
|
||||
|
||||
def _extract_playlist(self, seasons_list, content_type):
|
||||
episode_title = seasons_list['title']
|
||||
content_id = seasons_list['contentId']
|
||||
|
||||
def _extract_playlist(self, playlist_data, content_type):
|
||||
all_episodes = [
|
||||
self.url_result(smuggle_url(
|
||||
self._URL_TEMPLATE % (content_type, episode['contentId']),
|
||||
{'force_noplaylist': True})) # To prevent infinite recursion
|
||||
for season in seasons_list['seasons']
|
||||
for episode in season['episode']]
|
||||
for episode in traverse_obj(playlist_data, ('seasons', ..., 'episode', lambda _, v: v['contentId']))]
|
||||
|
||||
return self.playlist_result(all_episodes, content_id, episode_title)
|
||||
return self.playlist_result(all_episodes, playlist_data['contentId'], playlist_data['title'])
|
||||
|
||||
def _real_extract(self, url):
|
||||
url, smuggled_data = unsmuggle_url(url, {})
|
||||
|
@ -60,7 +67,9 @@ class LiTVIE(InfoExtractor):
|
|||
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
|
||||
if '<meta http-equiv="refresh" content="1;url=https://www.litv.tv/"' in webpage:
|
||||
if self._search_regex(
|
||||
r'(?i)<meta\s[^>]*http-equiv="refresh"\s[^>]*content="[0-9]+;\s*url=https://www\.litv\.tv/"',
|
||||
webpage, 'meta refresh redirect', default=False, group=0):
|
||||
raise ExtractorError('No such content', expected=True)
|
||||
|
||||
program_info = self._parse_json(self._search_regex(
|
||||
|
@ -74,8 +83,7 @@ class LiTVIE(InfoExtractor):
|
|||
program_info = self._download_json(
|
||||
'https://www.litv.tv/vod/ajax/getProgramInfo', video_id,
|
||||
query={'contentId': video_id},
|
||||
headers={'Content-Type': 'application/json',
|
||||
'Accept': 'application/json'})
|
||||
headers={'Accept': 'application/json'})
|
||||
|
||||
series_id = program_info['seriesId']
|
||||
if self._yes_playlist(series_id, video_id, smuggled_data):
|
||||
|
@ -83,8 +91,7 @@ class LiTVIE(InfoExtractor):
|
|||
'https://www.litv.tv/vod/ajax/getSeriesTree',
|
||||
video_id,
|
||||
query={'seriesId': series_id},
|
||||
headers={'Content-Type': 'application/json',
|
||||
'Accept': 'application/json'})
|
||||
headers={'Accept': 'application/json'})
|
||||
return self._extract_playlist(playlist_data, program_info['contentType'])
|
||||
|
||||
video_data = self._parse_json(self._search_regex(
|
||||
|
|
Loading…
Reference in New Issue
Block a user