This commit is contained in:
MMM 2024-04-28 10:17:38 +05:30 committed by GitHub
commit cfe369e700
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 56 additions and 5 deletions

View File

@ -1,5 +1,14 @@
import re
from .common import InfoExtractor
from ..utils import extract_attributes, get_element_html_by_id
from ..utils import (
ExtractorError,
clean_html,
extract_attributes,
get_element_by_class,
get_element_html_by_class,
try_get,
)
class EpochIE(InfoExtractor):
@ -11,6 +20,8 @@ class EpochIE(InfoExtractor):
'id': 'a3dd732c-4750-4bc8-8156-69180668bda1',
'ext': 'mp4',
'title': 'They Can Do Audio, Video, Physical Surveillance on You 24H/365D a Year: Rex Lee on Intrusive Apps',
'description': 'md5:00f32d1e821481a88698e6f450a04e1b',
'thumbnail': r're:https://.*\.jpg',
}
},
{
@ -19,6 +30,8 @@ class EpochIE(InfoExtractor):
'id': '276c7f46-3bbf-475d-9934-b9bbe827cf0a',
'ext': 'mp4',
'title': 'The Communist Partys Cyberattacks on America Explained; Rex Lee Talks Tech Hybrid Warfare',
'description': 'md5:c993752ccec901a6b84e12117c5cc8f8',
'thumbnail': r're:https://.*\.jpg',
}
},
{
@ -27,6 +40,8 @@ class EpochIE(InfoExtractor):
'id': 'aa9ceecd-a127-453d-a2de-7153d6fd69b6',
'ext': 'mp4',
'title': 'Kash Patel: A 6-Year-Saga of Government Corruption, From Russiagate to Mar-a-Lago',
'description': 'md5:1aa6aa4b99934f985785837a34707753',
'thumbnail': r're:https://.*\.jpg',
}
},
{
@ -35,21 +50,57 @@ class EpochIE(InfoExtractor):
'id': '9489f994-2a20-4812-b233-ac0e5c345632',
'ext': 'mp4',
'title': 'Dick Morris Discusses His Book The Return: Trumps Big 2024 Comeback',
'description': 'md5:ef6f45dd925b5d23e2a862487b42030e',
'thumbnail': r're:https://.*\.jpg',
}
},
{
'note': 'Georestricted to US',
'url': 'https://www.theepochtimes.com/silence-patton-documentary_4849547.html',
'info_dict': {
'id': '4849547',
'ext': 'mp4',
'title': 'Silence Patton | Documentary',
'description': 'Why was General Patton silenced during his service in World War II?',
'thumbnail': r're:https://.*\.jpg',
},
'params': {'skip_download': True},
'expected_warnings': [
'This film is only available in the United States because of territorial licensing.'
],
},
]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
raw_description = clean_html(get_element_by_class('article_content', webpage))
description_lines_iter = iter(raw_description.splitlines())
description = next(description_lines_iter, None)
if re.match(r'This film is [a-z ]*available ', description or ''):
self.report_warning(description, video_id)
description = next(description_lines_iter, None)
player = extract_attributes(get_element_html_by_class('player-container', webpage) or '<>')
youmaker_video_id = try_get(
player, lambda x: re.fullmatch(r'player-([0-9a-f-]+)', x['data-id']).group(1))
if youmaker_video_id:
video_id = youmaker_video_id
manifest_url = f'http://vs1.youmaker.com/assets/{youmaker_video_id}/playlist.m3u8'
elif player.get('data-source', '').endswith('.m3u8'):
manifest_url = player['data-source']
else:
raise ExtractorError('No video found.')
youmaker_video_id = extract_attributes(get_element_html_by_id('videobox', webpage))['data-id']
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
f'http://vs1.youmaker.com/assets/{youmaker_video_id}/playlist.m3u8', video_id, 'mp4', m3u8_id='hls')
manifest_url, video_id, 'mp4', m3u8_id='hls')
return {
'id': youmaker_video_id,
'id': video_id,
'formats': formats,
'subtitles': subtitles,
'title': self._html_extract_title(webpage)
'title': self._html_extract_title(webpage),
'description': description,
'thumbnail': self._og_search_thumbnail(webpage),
}