]>
Commit | Line | Data |
---|---|---|
450bdf69 AG |
1 | from .common import InfoExtractor |
2 | ||
3 | ||
4 | class 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) | |
39 | self._sort_formats(formats) | |
40 | return { | |
41 | 'id': id, | |
42 | 'title': data_json.get('title'), | |
43 | 'description': data_json.get('description'), | |
44 | 'thumbnail': data_json.get('thumbnail'), | |
45 | 'timestamp': data_json.get('timestamp'), | |
46 | 'formats': formats, | |
47 | 'subtitles': subtitles, | |
48 | } |