From 3cf5429a215cfc7f7413eb987c33cc66454cfa6a Mon Sep 17 00:00:00 2001 From: Ashish Gupta <39122144+Ashish0804@users.noreply.github.com> Date: Sat, 8 Jan 2022 14:09:46 +0530 Subject: [PATCH] Add EuropeanTourIE (#2247) Closes #2208 Authored by: Ashish0804 --- yt_dlp/extractor/europeantour.py | 37 ++++++++++++++++++++++++++++++++ yt_dlp/extractor/extractors.py | 1 + 2 files changed, 38 insertions(+) create mode 100644 yt_dlp/extractor/europeantour.py diff --git a/yt_dlp/extractor/europeantour.py b/yt_dlp/extractor/europeantour.py new file mode 100644 index 000000000..e28f067be --- /dev/null +++ b/yt_dlp/extractor/europeantour.py @@ -0,0 +1,37 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor + + +class EuropeanTourIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?europeantour\.com/dpworld-tour/news/video/(?P[^/&?#$]+)' + + _TESTS = [{ + 'url': 'https://www.europeantour.com/dpworld-tour/news/video/the-best-shots-of-the-2021-seasons/', + 'info_dict': { + 'id': '6287788195001', + 'ext': 'mp4', + 'title': 'The best shots of the 2021 seasons', + 'duration': 2416.512, + 'timestamp': 1640010141, + 'uploader_id': '5136026580001', + 'tags': ['prod-imported'], + 'thumbnail': 'md5:fdac52bc826548860edf8145ee74e71a', + 'upload_date': '20211220' + }, + 'params': {'skip_download': True} + }] + + BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/%s/default_default/index.html?videoId=%s' + + def _real_extract(self, url): + id = self._match_id(url) + webpage = self._download_webpage(url, id) + vid, aid = re.search(r'(?s)brightcove-player\s?video-id="([^"]+)".*"ACCOUNT_ID":"([^"]+)"', webpage).groups() + if not aid: + aid = '5136026580001' + return self.url_result( + self.BRIGHTCOVE_URL_TEMPLATE % (aid, vid), 'BrightcoveNew') diff --git a/yt_dlp/extractor/extractors.py b/yt_dlp/extractor/extractors.py index 0353a8c74..e63d4b6f5 100644 --- a/yt_dlp/extractor/extractors.py +++ b/yt_dlp/extractor/extractors.py @@ -436,6 +436,7 @@ from .espn import ( ) from .esri import EsriVideoIE from .europa import EuropaIE +from .europeantour import EuropeanTourIE from .euscreen import EUScreenIE from .expotv import ExpoTVIE from .expressen import ExpressenIE