]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/onefootball.py
[extractor] Deprecate `_sort_formats`
[yt-dlp.git] / yt_dlp / extractor / onefootball.py
CommitLineData
450bdf69
AG
1from .common import InfoExtractor
2
3
4class OneFootballIE(InfoExtractor):
73f035e1 5 _VALID_URL = r'https?://(?:www\.)?onefootball\.com/[a-z]{2}/video/[^/&?#]+-(?P<id>\d+)'
450bdf69
AG
6
7 _TESTS = [{
8 'url': 'https://onefootball.com/en/video/highlights-fc-zuerich-3-3-fc-basel-34012334',
9 'info_dict': {
10 'id': '34012334',
11 'ext': 'mp4',
12 'title': 'Highlights: FC Zürich 3-3 FC Basel',
13 'description': 'md5:33d9855cb790702c4fe42a513700aba8',
14 'thumbnail': 'https://photobooth-api.onefootball.com/api/screenshot/https:%2F%2Fperegrine-api.onefootball.com%2Fv2%2Fphotobooth%2Fcms%2Fen%2F34012334',
15 'timestamp': 1635874604,
16 'upload_date': '20211102'
17 },
18 'params': {'skip_download': True}
19 }, {
20 'url': 'https://onefootball.com/en/video/klopp-fumes-at-var-decisions-in-west-ham-defeat-34041020',
21 'info_dict': {
22 'id': '34041020',
23 'ext': 'mp4',
24 'title': 'Klopp fumes at VAR decisions in West Ham defeat',
25 'description': 'md5:9c50371095a01ad3f63311c73d8f51a5',
26 'thumbnail': 'https://photobooth-api.onefootball.com/api/screenshot/https:%2F%2Fperegrine-api.onefootball.com%2Fv2%2Fphotobooth%2Fcms%2Fen%2F34041020',
27 'timestamp': 1636314103,
28 'upload_date': '20211107'
29 },
30 'params': {'skip_download': True}
31 }]
32
33 def _real_extract(self, url):
34 id = self._match_id(url)
35 webpage = self._download_webpage(url, id)
36 data_json = self._search_json_ld(webpage, id)
37 m3u8_url = self._html_search_regex(r'(https://cdn\.jwplayer\.com/manifests/.+\.m3u8)', webpage, 'm3u8_url')
38 formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, id)
450bdf69
AG
39 return {
40 'id': id,
41 'title': data_json.get('title'),
42 'description': data_json.get('description'),
43 'thumbnail': data_json.get('thumbnail'),
44 'timestamp': data_json.get('timestamp'),
45 'formats': formats,
46 'subtitles': subtitles,
47 }