]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/crtvg.py
[ie/youtube] Further bump client versions (#9395)
[yt-dlp.git] / yt_dlp / extractor / crtvg.py
CommitLineData
26c517b2
MAM
1from .common import InfoExtractor
2from ..utils import remove_end
3
4
5class CrtvgIE(InfoExtractor):
6 _VALID_URL = r'https?://(?:www\.)?crtvg\.es/tvg/a-carta/[^/#?]+-(?P<id>\d+)'
7 _TESTS = [{
8 'url': 'https://www.crtvg.es/tvg/a-carta/os-caimans-do-tea-5839623',
9 'md5': 'c0958d9ff90e4503a75544358758921d',
10 'info_dict': {
11 'id': '5839623',
12 'title': 'Os caimáns do Tea',
13 'ext': 'mp4',
14 'description': 'md5:f71cfba21ae564f0a6f415b31de1f842',
15 'thumbnail': r're:^https?://.*\.(?:jpg|png)',
16 },
17 'params': {'skip_download': 'm3u8'}
18 }]
19
20 def _real_extract(self, url):
21 video_id = self._match_id(url)
22 webpage = self._download_webpage(url, video_id)
23 video_url = self._search_regex(r'var\s+url\s*=\s*["\']([^"\']+)', webpage, 'video url')
24 formats = self._extract_m3u8_formats(video_url + '/playlist.m3u8', video_id, fatal=False)
25 formats.extend(self._extract_mpd_formats(video_url + '/manifest.mpd', video_id, fatal=False))
26
27 return {
28 'id': video_id,
29 'formats': formats,
30 'title': remove_end(self._html_search_meta(
31 ['og:title', 'twitter:title'], webpage, 'title', default=None), ' | CRTVG'),
32 'description': self._html_search_meta('description', webpage, 'description', default=None),
33 'thumbnail': self._html_search_meta(['og:image', 'twitter:image'], webpage, 'thumbnail', default=None),
34 }