1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-06-27 17:08:32 +00:00

Use _parse_html5_media_entries for a more convenient and compact way of parsing html page at yt_dlp/extractor/thehighwire.py

Co-authored-by: doe1080 <98906116+doe1080@users.noreply.github.com>
This commit is contained in:
Nikolay Fedorov 2025-06-20 23:04:22 +03:00 committed by GitHub
parent 4ffba17e1a
commit 41a8d75c0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,16 +22,12 @@ def _real_extract(self, url):
{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'),
'id': display_id,
**traverse_obj(webpage, {
'title': ({find_element(cls='section-header')}, {clean_html}),
'description': ({find_element(cls='episode-description__copy')}, {clean_html}),
}),
**self._parse_html5_media_entries(embed_url, embed_page, display_id, m3u8_id='hls')[0],
}