modify callin

This commit is contained in:
Ruowang Sun 2022-12-11 12:34:32 -05:00
commit 290e6961dc

View file

@ -2,7 +2,10 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import traverse_obj from ..utils import (
ExtractorError,
traverse_obj,
)
class CallinIE(InfoExtractor): class CallinIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?callin\.com/episode/(?:[^/#?-]+-)*(?P<id>[^/#?-]+)' _VALID_URL = r'https?://(?:www\.)?callin\.com/episode/(?:[^/#?-]+-)*(?P<id>[^/#?-]+)'
@ -38,15 +41,20 @@ class CallinIE(InfoExtractor):
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
# webpage_json = self._download_json(url, video_id) # webpage_json = self._download_json(url, video_id)
next_data = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['episode'] next_data = self._search_nextjs_data(webpage, video_id)
title = next_data.get('title') valid = traverse_obj(next_data, ('props', 'pageProps', 'episode'))
if not valid:
raise ExtractorError('Failed to find m3u8')
episode = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['episode']
title = episode.get('title')
if not title: if not title:
title = self._og_search_title(webpage) title = self._og_search_title(webpage)
description = next_data.get('description') description = episode.get('description')
if not description: if not description:
description = self._og_search_description(webpage) description = self._og_search_description(webpage)
video_url = next_data.get('m3u8') video_url = episode.get('m3u8')
formats = self._extract_m3u8_formats( formats = self._extract_m3u8_formats(
video_url, video_id, 'mp4') video_url, video_id, 'mp4')
self._sort_formats(formats) self._sort_formats(formats)