Compare commits

..

No commits in common. "1fdfb4d65d1c6b8589277a2c6b207e1693683c62" and "cfd7c8ca04c9a819425e8369371821fcd25f37c0" have entirely different histories.

View File

@ -6,7 +6,6 @@ from ..utils import (
int_or_none,
smuggle_url,
unsmuggle_url,
traverse_obj,
)
@ -39,26 +38,20 @@ 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, playlist_data, content_type):
def _extract_playlist(self, seasons_list, content_type):
episode_title = seasons_list['title']
content_id = seasons_list['contentId']
all_episodes = [
self.url_result(smuggle_url(
self._URL_TEMPLATE % (content_type, episode['contentId']),
{'force_noplaylist': True})) # To prevent infinite recursion
for episode in traverse_obj(playlist_data, ('seasons', ..., 'episode', lambda _, v: v['contentId']))]
for season in seasons_list['seasons']
for episode in season['episode']]
return self.playlist_result(all_episodes, playlist_data['contentId'], playlist_data['title'])
return self.playlist_result(all_episodes, content_id, episode_title)
def _real_extract(self, url):
url, smuggled_data = unsmuggle_url(url, {})
@ -67,9 +60,7 @@ class LiTVIE(InfoExtractor):
webpage = self._download_webpage(url, video_id)
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):
if '<meta http-equiv="refresh" content="1;url=https://www.litv.tv/"' in webpage:
raise ExtractorError('No such content', expected=True)
program_info = self._parse_json(self._search_regex(
@ -83,7 +74,8 @@ class LiTVIE(InfoExtractor):
program_info = self._download_json(
'https://www.litv.tv/vod/ajax/getProgramInfo', video_id,
query={'contentId': video_id},
headers={'Accept': 'application/json'})
headers={'Content-Type': 'application/json',
'Accept': 'application/json'})
series_id = program_info['seriesId']
if self._yes_playlist(series_id, video_id, smuggled_data):
@ -91,7 +83,8 @@ class LiTVIE(InfoExtractor):
'https://www.litv.tv/vod/ajax/getSeriesTree',
video_id,
query={'seriesId': series_id},
headers={'Accept': 'application/json'})
headers={'Content-Type': 'application/json',
'Accept': 'application/json'})
return self._extract_playlist(playlist_data, program_info['contentType'])
video_data = self._parse_json(self._search_regex(