]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/projectveritas.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
12 class ProjectVeritasIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?projectveritas\.com/(?P<type>news|video)/(?P<id>[^/?#]+)'
15 'url': 'https://www.projectveritas.com/news/exclusive-inside-the-new-york-and-new-jersey-hospitals-battling-coronavirus/',
17 'id': '51910aab-365a-5cf1-88f2-8eb1ca5fd3c6',
19 'title': 'Exclusive: Inside The New York and New Jersey Hospitals Battling Coronavirus',
20 'upload_date': '20200327',
21 'thumbnail': 'md5:6076477fe50b03eb8708be9415e18e1c',
24 'url': 'https://www.projectveritas.com/video/ilhan-omar-connected-ballot-harvester-in-cash-for-ballots-scheme-car-is-full/',
26 'id': 'c5aab304-a56b-54b1-9f0b-03b77bc5f2f6',
28 'title': 'Ilhan Omar connected Ballot Harvester in cash-for-ballots scheme: "Car is full" of absentee ballots',
29 'upload_date': '20200927',
30 'thumbnail': 'md5:194b8edf0e2ba64f25500ff4378369a4',
34 def _real_extract(self
, url
):
35 id, type = self
._match
_valid
_url
(url
).group('id', 'type')
36 api_url
= f
'https://www.projectveritas.com/page-data/{type}/{id}/page-data.json'
37 data_json
= self
._download
_json
(api_url
, id)['result']['data']
38 main_data
= traverse_obj(data_json
, 'video', 'post')
39 video_id
= main_data
['id']
40 thumbnail
= traverse_obj(main_data
, ('image', 'ogImage', 'src'))
41 mux_asset
= traverse_obj(main_data
,
42 'muxAsset', ('body', 'json', 'content', ..., 'data', 'target', 'fields', 'muxAsset'),
43 get_all
=False, expected_type
=dict)
45 raise ExtractorError('No video on the provided url.', expected
=True)
46 playback_id
= traverse_obj(mux_asset
, 'playbackId', ('en-US', 'playbackId'))
47 formats
= self
._extract
_m
3u8_formats
(f
'https://stream.mux.com/{playback_id}.m3u8', video_id
)
48 self
._sort
_formats
(formats
)
51 'title': main_data
['title'],
52 'upload_date': unified_strdate(main_data
.get('date')),
53 'thumbnail': thumbnail
.replace('//', ''),