]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/epoch.py
[ie/orf:on] Improve extraction (#9677)
[yt-dlp.git] / yt_dlp / extractor / epoch.py
CommitLineData
f8c7ba99 1from .common import InfoExtractor
7053aa3a 2from ..utils import extract_attributes, get_element_html_by_id
f8c7ba99
TA
3
4
5class EpochIE(InfoExtractor):
6 _VALID_URL = r'https?://www.theepochtimes\.com/[\w-]+_(?P<id>\d+).html'
7 _TESTS = [
8 {
9 'url': 'https://www.theepochtimes.com/they-can-do-audio-video-physical-surveillance-on-you-24h-365d-a-year-rex-lee-on-intrusive-apps_4661688.html',
10 'info_dict': {
11 'id': 'a3dd732c-4750-4bc8-8156-69180668bda1',
12 'ext': 'mp4',
13 'title': '‘They Can Do Audio, Video, Physical Surveillance on You 24H/365D a Year’: Rex Lee on Intrusive Apps',
14 }
15 },
16 {
17 'url': 'https://www.theepochtimes.com/the-communist-partys-cyberattacks-on-america-explained-rex-lee-talks-tech-hybrid-warfare_4342413.html',
18 'info_dict': {
19 'id': '276c7f46-3bbf-475d-9934-b9bbe827cf0a',
20 'ext': 'mp4',
21 'title': 'The Communist Party’s Cyberattacks on America Explained; Rex Lee Talks Tech Hybrid Warfare',
22 }
23 },
24 {
25 'url': 'https://www.theepochtimes.com/kash-patel-a-6-year-saga-of-government-corruption-from-russiagate-to-mar-a-lago_4690250.html',
26 'info_dict': {
27 'id': 'aa9ceecd-a127-453d-a2de-7153d6fd69b6',
28 'ext': 'mp4',
29 'title': 'Kash Patel: A ‘6-Year-Saga’ of Government Corruption, From Russiagate to Mar-a-Lago',
30 }
31 },
7053aa3a
RG
32 {
33 'url': 'https://www.theepochtimes.com/dick-morris-discusses-his-book-the-return-trumps-big-2024-comeback_4819205.html',
34 'info_dict': {
35 'id': '9489f994-2a20-4812-b233-ac0e5c345632',
36 'ext': 'mp4',
37 'title': 'Dick Morris Discusses His Book ‘The Return: Trump’s Big 2024 Comeback’',
38 }
39 },
f8c7ba99
TA
40 ]
41
42 def _real_extract(self, url):
43 video_id = self._match_id(url)
44 webpage = self._download_webpage(url, video_id)
45
7053aa3a 46 youmaker_video_id = extract_attributes(get_element_html_by_id('videobox', webpage))['data-id']
f8c7ba99
TA
47 formats, subtitles = self._extract_m3u8_formats_and_subtitles(
48 f'http://vs1.youmaker.com/assets/{youmaker_video_id}/playlist.m3u8', video_id, 'mp4', m3u8_id='hls')
49
50 return {
51 'id': youmaker_video_id,
52 'formats': formats,
53 'subtitles': subtitles,
54 'title': self._html_extract_title(webpage)
55 }