epoch.py 2.5 KB

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