]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/genericembeds.py
[extractor/html5] Separate into own extractor (#4307)
[yt-dlp.git] / yt_dlp / extractor / genericembeds.py
1 from .common import InfoExtractor
2
3
4 class HTML5MediaEmbedIE(InfoExtractor):
5 _VALID_URL = False
6 IE_NAME = 'html5'
7 _WEBPAGE_TESTS = [
8 {
9 'url': 'https://html.com/media/',
10 'info_dict': {
11 'title': 'HTML5 Media',
12 'description': 'md5:933b2d02ceffe7a7a0f3c8326d91cc2a',
13 },
14 'playlist_count': 2
15 }
16 ]
17
18 def _extract_from_webpage(self, url, webpage):
19 video_id, title = self._generic_id(url), self._generic_title(url)
20 entries = self._parse_html5_media_entries(url, webpage, video_id, m3u8_id='hls') or []
21 for num, entry in enumerate(entries, start=1):
22 entry.update({
23 'id': f'{video_id}-{num}',
24 'title': f'{title} ({num})',
25 })
26 self._sort_formats(entry['formats'])
27 yield entry