mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-08-23 06:35:51 -07:00
[Callin] Add new extractor
This commit is contained in:
parent
c511f1bebb
commit
f01cb57630
1 changed files with 6 additions and 6 deletions
|
@ -5,8 +5,10 @@ from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
traverse_obj,
|
traverse_obj,
|
||||||
|
try_get,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
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>[^/#?-]+)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
|
@ -39,14 +41,13 @@ class CallinIE(InfoExtractor):
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
# webpage_json = self._download_json(url, video_id)
|
|
||||||
|
|
||||||
next_data = self._search_nextjs_data(webpage, video_id)
|
next_data = self._search_nextjs_data(webpage, video_id)
|
||||||
valid = traverse_obj(next_data, ('props', 'pageProps', 'episode'))
|
valid = traverse_obj(next_data, ('props', 'pageProps', 'episode'))
|
||||||
if not valid:
|
if not valid:
|
||||||
raise ExtractorError('Failed to find m3u8')
|
raise ExtractorError('Failed to find m3u8')
|
||||||
|
|
||||||
episode = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['episode']
|
episode = try_get(next_data, lambda x: x['props']['pageProps']['episode'], dict)
|
||||||
title = episode.get('title')
|
title = episode.get('title')
|
||||||
if not title:
|
if not title:
|
||||||
title = self._og_search_title(webpage)
|
title = self._og_search_title(webpage)
|
||||||
|
@ -59,7 +60,6 @@ class CallinIE(InfoExtractor):
|
||||||
if m3u8_url:
|
if m3u8_url:
|
||||||
formats.extend(self._extract_m3u8_formats(
|
formats.extend(self._extract_m3u8_formats(
|
||||||
m3u8_url, video_id, 'mp4', fatal=False))
|
m3u8_url, video_id, 'mp4', fatal=False))
|
||||||
# self._sort_formats(formats)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue