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