]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/europeantour.py
[cleanup] Add more ruff rules (#10149)
[yt-dlp.git] / yt_dlp / extractor / europeantour.py
1 import re
2
3 from .common import InfoExtractor
4
5
6 class EuropeanTourIE(InfoExtractor):
7 _VALID_URL = r'https?://(?:www\.)?europeantour\.com/dpworld-tour/news/video/(?P<id>[^/&?#$]+)'
8
9 _TESTS = [{
10 'url': 'https://www.europeantour.com/dpworld-tour/news/video/the-best-shots-of-the-2021-seasons/',
11 'info_dict': {
12 'id': '6287788195001',
13 'ext': 'mp4',
14 'title': 'The best shots of the 2021 seasons',
15 'duration': 2416.512,
16 'timestamp': 1640010141,
17 'uploader_id': '5136026580001',
18 'tags': ['prod-imported'],
19 'thumbnail': 'md5:fdac52bc826548860edf8145ee74e71a',
20 'upload_date': '20211220',
21 },
22 'params': {'skip_download': True},
23 }]
24
25 BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/%s/default_default/index.html?videoId=%s'
26
27 def _real_extract(self, url):
28 video_id = self._match_id(url)
29 webpage = self._download_webpage(url, video_id)
30 vid, aid = re.search(r'(?s)brightcove-player\s?video-id="([^"]+)".*"ACCOUNT_ID":"([^"]+)"', webpage).groups()
31 if not aid:
32 aid = '5136026580001'
33 return self.url_result(
34 self.BRIGHTCOVE_URL_TEMPLATE % (aid, vid), 'BrightcoveNew')