]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/callin.py
1 from .common
import InfoExtractor
9 class CallinIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www\.)?callin\.com/(episode)/(?P<id>[-a-zA-Z]+)'
12 'url': 'https://www.callin.com/episode/the-title-ix-regime-and-the-long-march-through-EBfXYSrsjc',
14 'id': '218b979630a35ead12c6fd096f2996c56c37e4d0dc1f6dc0feada32dcf7b31cd',
15 'title': 'The Title IX Regime and the Long March Through and Beyond the Institutions',
17 'display_id': 'the-title-ix-regime-and-the-long-march-through-EBfXYSrsjc',
18 'thumbnail': 're:https://.+\\.png',
19 'description': 'First episode',
20 'uploader': 'Wesley Yang',
21 'timestamp': 1639404128.65,
22 'upload_date': '20211213',
23 'uploader_id': 'wesyang',
24 'uploader_url': 'http://wesleyyang.substack.com',
25 'channel': 'Conversations in Year Zero',
26 'channel_id': '436d1f82ddeb30cd2306ea9156044d8d2cfdc3f1f1552d245117a42173e78553',
27 'channel_url': 'https://callin.com/show/conversations-in-year-zero-oJNllRFSfx',
30 'categories': ['News & Politics', 'History', 'Technology'],
31 'cast': ['Wesley Yang', 'KC Johnson', 'Gabi Abramovich'],
32 'series': 'Conversations in Year Zero',
33 'series_id': '436d1f82ddeb30cd2306ea9156044d8d2cfdc3f1f1552d245117a42173e78553',
34 'episode': 'The Title IX Regime and the Long March Through and Beyond the Institutions',
36 'episode_id': '218b979630a35ead12c6fd096f2996c56c37e4d0dc1f6dc0feada32dcf7b31cd'
40 def try_get_user_name(self
, d
):
41 names
= [d
.get(n
) for n
in ('first', 'last')]
43 return next((n
for n
in names
if n
), default
=None)
44 return ' '.join(names
)
46 def _real_extract(self
, url
):
47 display_id
= self
._match
_id
(url
)
48 webpage
= self
._download
_webpage
(url
, display_id
)
50 next_data
= self
._search
_nextjs
_data
(webpage
, display_id
)
51 episode
= next_data
['props']['pageProps']['episode']
54 title
= episode
.get('title') or self
._generic
_title
('', webpage
)
56 formats
= self
._extract
_m
3u8_formats
(url
, display_id
, ext
='ts')
58 show
= traverse_obj(episode
, ('show', 'title'))
59 show_id
= traverse_obj(episode
, ('show', 'id'))
62 app_slug
= (self
._html
_search
_regex
(
63 '<script\\s+src=["\']/_next/static/([-_a-zA-Z0-9]+)/_',
64 webpage
, 'app slug', fatal
=False) or next_data
.get('buildId'))
65 show_slug
= traverse_obj(episode
, ('show', 'linkObj', 'resourceUrl'))
66 if app_slug
and show_slug
and '/' in show_slug
:
67 show_slug
= show_slug
.rsplit('/', 1)[1]
68 show_json_url
= f
'https://www.callin.com/_next/data/{app_slug}/show/{show_slug}.json'
69 show_json
= self
._download
_json
(show_json_url
, display_id
, fatal
=False)
71 host
= (traverse_obj(show_json
, ('pageProps', 'show', 'hosts', 0))
72 or traverse_obj(episode
, ('speakers', 0)))
74 host_nick
= traverse_obj(host
, ('linkObj', 'resourceUrl'))
75 host_nick
= host_nick
.rsplit('/', 1)[1] if (host_nick
and '/' in host_nick
) else None
77 cast
= list(filter(None, [
78 self
.try_get_user_name(u
) for u
in
79 traverse_obj(episode
, (('speakers', 'callerTags'), ...)) or []
82 episode_list
= traverse_obj(show_json
, ('pageProps', 'show', 'episodes')) or []
83 episode_number
= next(
84 (len(episode_list
) - i
for (i
, e
) in enumerate(episode_list
) if e
.get('id') == id),
89 'display_id': display_id
,
92 'thumbnail': traverse_obj(episode
, ('show', 'photo')),
93 'description': episode
.get('description'),
94 'uploader': self
.try_get_user_name(host
) if host
else None,
95 'timestamp': episode
.get('publishedAt'),
96 'uploader_id': host_nick
,
97 'uploader_url': traverse_obj(show_json
, ('pageProps', 'show', 'url')),
99 'channel_id': show_id
,
100 'channel_url': traverse_obj(episode
, ('show', 'linkObj', 'resourceUrl')),
101 'duration': float_or_none(episode
.get('runtime')),
102 'view_count': int_or_none(episode
.get('plays')),
103 'categories': traverse_obj(episode
, ('show', 'categorizations', ..., 'name')),
104 'cast': cast
if cast
else None,
106 'series_id': show_id
,
108 'episode_number': episode_number
,