From f5983cb6e9efefb27a08229f112a808070dade85 Mon Sep 17 00:00:00 2001 From: Thomas Riccardi Date: Tue, 25 Jun 2024 22:54:25 +0200 Subject: [PATCH] [ie/graspop] Add extractor --- yt_dlp/extractor/_extractors.py | 1 + yt_dlp/extractor/graspop.py | 42 +++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 yt_dlp/extractor/graspop.py diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py index c411efb5aa..15b7cff0aa 100644 --- a/yt_dlp/extractor/_extractors.py +++ b/yt_dlp/extractor/_extractors.py @@ -779,6 +779,7 @@ from .goshgay import GoshgayIE from .gotostage import GoToStageIE from .gputechconf import GPUTechConfIE +from .graspop import GraspopIE from .gronkh import ( GronkhFeedIE, GronkhIE, diff --git a/yt_dlp/extractor/graspop.py b/yt_dlp/extractor/graspop.py new file mode 100644 index 0000000000..b6c1b7ff82 --- /dev/null +++ b/yt_dlp/extractor/graspop.py @@ -0,0 +1,42 @@ +from .common import InfoExtractor +from ..utils import ( + traverse_obj, +) + + +class GraspopIE(InfoExtractor): + _VALID_URL = r'https?://vod\.graspop\.be/(?Pfr|nl)/(?P[0-9]+)/(?P.*)/' + _TESTS = [{ + 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/', + 'info_dict': { + 'id': '101556', + 'ext': 'mp4', + 'title': 'Thy Art Is Murder', + 'description': 'Thy Art Is Murder @ Graspop', + 'thumbnail': r're:https://cdn-mds\.pickx\.be/festivals/v3/global/original/.*\.jpg', + 'formats': 'count:4', + }, + 'params': { + 'nocheckcertificate': True, + }, + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + + # e.g. https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/ + # e.g. https://tv.proximus.be/MWC/videocenter/festivals/101556/stream + metadata = self._download_json(f'https://tv.proximus.be/MWC/videocenter/festivals/{video_id}/stream', video_id) + band_name = metadata.get('name') + asset_uri = traverse_obj(metadata, ('source', 'assetUri')) + poster = traverse_obj(metadata, ('source', 'poster')) + + formats = self._extract_m3u8_formats(asset_uri, video_id=video_id, ext='mp4') + + return { + 'id': video_id, + 'title': band_name, + 'description': f'{band_name} @ Graspop', + 'thumbnail': poster, + 'formats': formats, + }