theholetv.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. from .common import InfoExtractor
  2. from ..utils import extract_attributes, remove_end
  3. class TheHoleTvIE(InfoExtractor):
  4. _VALID_URL = r'https?://(?:www\.)?the-hole\.tv/episodes/(?P<id>[\w-]+)'
  5. _TESTS = [{
  6. 'url': 'https://the-hole.tv/episodes/gromkii-vopros-sergey-orlov',
  7. 'md5': 'fea6682f47786f3ae5a6cbd635ec4bf9',
  8. 'info_dict': {
  9. 'id': 'gromkii-vopros-sergey-orlov',
  10. 'ext': 'mp4',
  11. 'title': 'Сергей Орлов — Громкий вопрос',
  12. 'thumbnail': 'https://assets-cdn.the-hole.tv/images/t8gan4n6zn627e7wni11b2uemqts',
  13. 'description': 'md5:45741a9202331f995d9fb76996759379',
  14. },
  15. }]
  16. def _real_extract(self, url):
  17. video_id = self._match_id(url)
  18. webpage = self._download_webpage(url, video_id)
  19. player_attrs = extract_attributes(self._search_regex(
  20. r'(<div[^>]*\bdata-controller="player"[^>]*>)', webpage, 'video player'))
  21. formats, subtitles = self._extract_m3u8_formats_and_subtitles(
  22. player_attrs['data-player-source-value'], video_id, 'mp4')
  23. return {
  24. 'id': video_id,
  25. 'title': remove_end(self._html_extract_title(webpage), ' — The Hole'),
  26. 'description': self._og_search_description(webpage),
  27. 'thumbnail': player_attrs.get('data-player-poster-value'),
  28. 'formats': formats,
  29. 'subtitles': subtitles,
  30. }