From f48ab881f6a75fbc61f7d9c132180f7696db95f8 Mon Sep 17 00:00:00 2001 From: Fabi019 Date: Mon, 3 Oct 2022 15:40:09 +0200 Subject: [PATCH] [extractor/bundesliga] Add extractor (#5094) Closes #2339 Authored by: Fabi019 --- yt_dlp/extractor/_extractors.py | 1 + yt_dlp/extractor/bundesliga.py | 34 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 yt_dlp/extractor/bundesliga.py diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py index f104b3e35..f4d7c3ab5 100644 --- a/yt_dlp/extractor/_extractors.py +++ b/yt_dlp/extractor/_extractors.py @@ -233,6 +233,7 @@ BrightcoveNewIE, ) from .businessinsider import BusinessInsiderIE +from .bundesliga import BundesligaIE from .buzzfeed import BuzzFeedIE from .byutv import BYUtvIE from .c56 import C56IE diff --git a/yt_dlp/extractor/bundesliga.py b/yt_dlp/extractor/bundesliga.py new file mode 100644 index 000000000..e76dd58dd --- /dev/null +++ b/yt_dlp/extractor/bundesliga.py @@ -0,0 +1,34 @@ +from .common import InfoExtractor +from .jwplatform import JWPlatformIE + + +class BundesligaIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?bundesliga\.com/[a-z]{2}/bundesliga/videos(?:/[^?]+)?\?vid=(?P[a-zA-Z0-9]{8})' + _TESTS = [ + { + 'url': 'https://www.bundesliga.com/en/bundesliga/videos?vid=bhhHkKyN', + 'md5': '8fc3b25cd12440e3a8cdc51f1493849c', + 'info_dict': { + 'id': 'bhhHkKyN', + 'ext': 'mp4', + 'title': 'Watch: Alphonso Davies and Jeremie Frimpong head-to-head', + 'thumbnail': 'https://cdn.jwplayer.com/v2/media/bhhHkKyN/poster.jpg?width=720', + 'upload_date': '20220928', + 'duration': 146, + 'timestamp': 1664366511, + 'description': 'md5:803d4411bd134140c774021dd4b7598b' + } + }, + { + 'url': 'https://www.bundesliga.com/en/bundesliga/videos/latest-features/T8IKc8TX?vid=ROHjs06G', + 'only_matching': True + }, + { + 'url': 'https://www.bundesliga.com/en/bundesliga/videos/goals?vid=mOG56vWA', + 'only_matching': True + } + ] + + def _real_extract(self, url): + video_id = self._match_id(url) + return self.url_result(f'jwplatform:{video_id}', JWPlatformIE, video_id)