diff options
author | Mohamed Al Mehairbi <62325490+ItzMaxTV@users.noreply.github.com> | 2023-05-30 17:40:56 +0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-30 13:40:56 +0000 |
commit | 26c517b29c8727e47948d6fff749d5297f0efb60 (patch) | |
tree | 2cc018f63d7a7e84ee0827cd65d1383ec41451c9 | |
parent | 6f10cdcf7eeaeae5b75e0a4428cd649c156a2d83 (diff) | |
download | hypervideo-pre-26c517b29c8727e47948d6fff749d5297f0efb60.tar.lz hypervideo-pre-26c517b29c8727e47948d6fff749d5297f0efb60.tar.xz hypervideo-pre-26c517b29c8727e47948d6fff749d5297f0efb60.zip |
[extractor/crtvg] Add extractor (#7168)
Closes #6609
Authored by: ItzMaxTV
-rw-r--r-- | yt_dlp/extractor/_extractors.py | 1 | ||||
-rw-r--r-- | yt_dlp/extractor/crtvg.py | 34 |
2 files changed, 35 insertions, 0 deletions
diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py index 5b4ed44ef..85c584f5e 100644 --- a/yt_dlp/extractor/_extractors.py +++ b/yt_dlp/extractor/_extractors.py @@ -411,6 +411,7 @@ from .crowdbunker import ( CrowdBunkerIE, CrowdBunkerChannelIE, ) +from .crtvg import CrtvgIE from .crunchyroll import ( CrunchyrollBetaIE, CrunchyrollBetaShowIE, diff --git a/yt_dlp/extractor/crtvg.py b/yt_dlp/extractor/crtvg.py new file mode 100644 index 000000000..1aa8d7705 --- /dev/null +++ b/yt_dlp/extractor/crtvg.py @@ -0,0 +1,34 @@ +from .common import InfoExtractor +from ..utils import remove_end + + +class CrtvgIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?crtvg\.es/tvg/a-carta/[^/#?]+-(?P<id>\d+)' + _TESTS = [{ + 'url': 'https://www.crtvg.es/tvg/a-carta/os-caimans-do-tea-5839623', + 'md5': 'c0958d9ff90e4503a75544358758921d', + 'info_dict': { + 'id': '5839623', + 'title': 'Os caimáns do Tea', + 'ext': 'mp4', + 'description': 'md5:f71cfba21ae564f0a6f415b31de1f842', + 'thumbnail': r're:^https?://.*\.(?:jpg|png)', + }, + 'params': {'skip_download': 'm3u8'} + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + video_url = self._search_regex(r'var\s+url\s*=\s*["\']([^"\']+)', webpage, 'video url') + formats = self._extract_m3u8_formats(video_url + '/playlist.m3u8', video_id, fatal=False) + formats.extend(self._extract_mpd_formats(video_url + '/manifest.mpd', video_id, fatal=False)) + + return { + 'id': video_id, + 'formats': formats, + 'title': remove_end(self._html_search_meta( + ['og:title', 'twitter:title'], webpage, 'title', default=None), ' | CRTVG'), + 'description': self._html_search_meta('description', webpage, 'description', default=None), + 'thumbnail': self._html_search_meta(['og:image', 'twitter:image'], webpage, 'thumbnail', default=None), + } |