]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/dailywire.py
1 from .common
import InfoExtractor
11 class DailyWireBaseIE(InfoExtractor
):
13 'episode': ('props', 'pageProps', 'episodeData', 'episode'),
14 'videos': ('props', 'pageProps', 'videoData', 'video'),
15 'podcasts': ('props', 'pageProps', 'episode'),
18 def _get_json(self
, url
):
19 sites_type
, slug
= self
._match
_valid
_url
(url
).group('sites_type', 'id')
20 json_data
= self
._search
_nextjs
_data
(self
._download
_webpage
(url
, slug
), slug
)
21 return slug
, traverse_obj(json_data
, self
._JSON
_PATH
[sites_type
])
24 class DailyWireIE(DailyWireBaseIE
):
25 _VALID_URL
= r
'https?://(?:www\.)dailywire(?:\.com)/(?P<sites_type>episode|videos)/(?P<id>[\w-]+)'
27 'url': 'https://www.dailywire.com/episode/1-fauci',
29 'id': 'ckzsl50xnqpy30850in3v4bu7',
31 'display_id': '1-fauci',
33 'description': 'md5:9df630347ef85081b7e97dd30bc22853',
34 'thumbnail': 'https://daily-wire-production.imgix.net/episodes/ckzsl50xnqpy30850in3v4bu7/ckzsl50xnqpy30850in3v4bu7-1648237399554.jpg',
35 'creator': 'Caroline Roberts',
36 'series_id': 'ckzplm0a097fn0826r2vc3j7h',
37 'series': 'China: The Enemy Within',
40 'url': 'https://www.dailywire.com/episode/ep-124-bill-maher',
42 'id': 'cl0ngbaalplc80894sfdo9edf',
44 'display_id': 'ep-124-bill-maher',
45 'title': 'Ep. 124 - Bill Maher',
46 'thumbnail': 'https://daily-wire-production.imgix.net/episodes/cl0ngbaalplc80894sfdo9edf/cl0ngbaalplc80894sfdo9edf-1647065568518.jpg',
47 'creator': 'Caroline Roberts',
48 'description': 'md5:adb0de584bcfa9c41374999d9e324e98',
49 'series_id': 'cjzvep7270hp00786l9hwccob',
50 'series': 'The Sunday Special',
53 'url': 'https://www.dailywire.com/videos/the-hyperions',
54 'only_matching': True,
57 def _real_extract(self
, url
):
58 slug
, episode_info
= self
._get
_json
(url
)
60 episode_info
, (('segments', 'videoUrl'), ..., ('video', 'audio')), expected_type
=url_or_none
)
62 formats
, subtitles
= [], {}
64 if determine_ext(url
) != 'm3u8':
65 formats
.append({'url': url}
)
67 format_
, subs_
= self
._extract
_m
3u8_formats
_and
_subtitles
(url
, slug
)
68 formats
.extend(format_
)
69 self
._merge
_subtitles
(subs_
, target
=subtitles
)
70 self
._sort
_formats
(formats
)
72 'id': episode_info
['id'],
74 'title': traverse_obj(episode_info
, 'title', 'name'),
75 'description': episode_info
.get('description'),
76 'creator': join_nonempty(
77 traverse_obj(episode_info
, ('createdBy','firstName')), traverse_obj(episode_info
, ('createdBy','lastName')),
79 'duration': float_or_none(episode_info
.get('duration')),
80 'is_live': episode_info
.get('isLive'),
81 'thumbnail': traverse_obj(episode_info
, 'thumbnail', 'image', expected_type
=url_or_none
),
83 'subtitles': subtitles
,
84 'series_id': traverse_obj(episode_info
, ('show', 'id')),
85 'series': traverse_obj(episode_info
, ('show', 'name')),
89 class DailyWirePodcastIE(DailyWireBaseIE
):
90 _VALID_URL
= r
'https?://(?:www\.)dailywire(?:\.com)/(?P<sites_type>podcasts)/(?P<podcaster>[\w-]+/(?P<id>[\w-]+))'
92 'url': 'https://www.dailywire.com/podcasts/morning-wire/get-ready-for-recession-6-15-22',
94 'id': 'cl4f01d0w8pbe0a98ydd0cfn1',
96 'display_id': 'get-ready-for-recession-6-15-22',
97 'title': 'Get Ready for Recession | 6.15.22',
98 'description': 'md5:c4afbadda4e1c38a4496f6d62be55634',
99 'thumbnail': 'https://daily-wire-production.imgix.net/podcasts/ckx4otgd71jm508699tzb6hf4-1639506575562.jpg',
100 'duration': 900.117667,
104 def _real_extract(self
, url
):
105 slug
, episode_info
= self
._get
_json
(url
)
106 audio_id
= traverse_obj(episode_info
, 'audioMuxPlaybackId', 'VUsAipTrBVSgzw73SpC2DAJD401TYYwEp')
109 'id': episode_info
['id'],
110 'url': f
'https://stream.media.dailywire.com/{audio_id}/audio.m4a',
112 'title': episode_info
.get('title'),
113 'duration': float_or_none(episode_info
.get('duration')),
114 'thumbnail': episode_info
.get('thumbnail'),
115 'description': episode_info
.get('description'),