1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-06-28 01:18:30 +00:00
yt-dlp/yt_dlp/extractor/thehighwire.py
Nikolay Fedorov 4ffba17e1a
A simpler and more compact way to get embed_url and embed_page at yt_dlp/extractor/thehighwire.py
Co-authored-by: doe1080 <98906116+doe1080@users.noreply.github.com>
2025-06-20 23:02:43 +03:00

38 lines
1.4 KiB
Python

from .common import InfoExtractor
class TheHighWireIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?thehighwire\.com/ark-videos/(?P<id>[^/?#]+)'
_EMBED_URL = 'https://app.arkengine.com/embed/{id}'
_TESTS = [{
'url': 'https://thehighwire.com/ark-videos/the-deposition-of-stanley-plotkin/',
'info_dict': {
'id': 'clllgcra301z4ik01x8cwhfu2',
'title': 'THE DEPOSITION OF STANLEY PLOTKIN',
'ext': 'mp4',
},
'params': {'skip_download': True},
}]
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
embed_url = traverse_obj(webpage, (
{find_element(cls='ark-video-embed', html=True)},
{extract_attributes}, 'src', {url_or_none}, {require('embed URL')}))
embed_page = self._download_webpage(embed_url, display_id)
m3u8_url = self._search_regex(
r'<source[^>]+src=["\']([^"\']+\.m3u8)',
player_page, 'm3u8 URL')
title = self._og_search_title(webpage, default=None) or self._html_search_meta(
'og:title', webpage, 'title', default=video_id)
return {
'id': video_id,
'display_id': display_id,
'title': title,
'formats': self._extract_m3u8_formats(m3u8_url, video_id, 'mp4'),
}