]>
Commit | Line | Data |
---|---|---|
450bdf69 | 1 | from .common import InfoExtractor |
644738dd | 2 | from .jwplatform import JWPlatformIE |
3 | from ..utils import make_archive_id | |
450bdf69 AG |
4 | |
5 | ||
6 | class OneFootballIE(InfoExtractor): | |
73f035e1 | 7 | _VALID_URL = r'https?://(?:www\.)?onefootball\.com/[a-z]{2}/video/[^/&?#]+-(?P<id>\d+)' |
450bdf69 AG |
8 | |
9 | _TESTS = [{ | |
10 | 'url': 'https://onefootball.com/en/video/highlights-fc-zuerich-3-3-fc-basel-34012334', | |
11 | 'info_dict': { | |
644738dd | 12 | 'id': 'Y2VtcWAT', |
450bdf69 AG |
13 | 'ext': 'mp4', |
14 | 'title': 'Highlights: FC Zürich 3-3 FC Basel', | |
15 | 'description': 'md5:33d9855cb790702c4fe42a513700aba8', | |
644738dd | 16 | 'thumbnail': 'https://cdn.jwplayer.com/v2/media/Y2VtcWAT/poster.jpg?width=720', |
17 | 'timestamp': 1635874895, | |
18 | 'upload_date': '20211102', | |
19 | 'duration': 375.0, | |
20 | 'tags': ['Football', 'Soccer', 'OneFootball'], | |
21 | '_old_archive_ids': ['onefootball 34012334'], | |
450bdf69 | 22 | }, |
644738dd | 23 | 'params': {'skip_download': True}, |
24 | 'expected_warnings': ['Failed to download m3u8 information'], | |
450bdf69 AG |
25 | }, { |
26 | 'url': 'https://onefootball.com/en/video/klopp-fumes-at-var-decisions-in-west-ham-defeat-34041020', | |
27 | 'info_dict': { | |
644738dd | 28 | 'id': 'leVJrMho', |
450bdf69 AG |
29 | 'ext': 'mp4', |
30 | 'title': 'Klopp fumes at VAR decisions in West Ham defeat', | |
31 | 'description': 'md5:9c50371095a01ad3f63311c73d8f51a5', | |
644738dd | 32 | 'thumbnail': 'https://cdn.jwplayer.com/v2/media/leVJrMho/poster.jpg?width=720', |
33 | 'timestamp': 1636315232, | |
34 | 'upload_date': '20211107', | |
35 | 'duration': 93.0, | |
36 | 'tags': ['Football', 'Soccer', 'OneFootball'], | |
37 | '_old_archive_ids': ['onefootball 34041020'], | |
450bdf69 AG |
38 | }, |
39 | 'params': {'skip_download': True} | |
40 | }] | |
41 | ||
42 | def _real_extract(self, url): | |
644738dd | 43 | video_id = self._match_id(url) |
44 | webpage = self._download_webpage(url, video_id) | |
45 | data_json = self._search_json_ld(webpage, video_id, fatal=False) | |
46 | data_json.pop('url', None) | |
47 | m3u8_url = self._html_search_regex(r'(https://cdn\.jwplayer\.com/manifests/\w+\.m3u8)', webpage, 'm3u8_url') | |
48 | ||
49 | return self.url_result( | |
50 | m3u8_url, JWPlatformIE, video_id, _old_archive_ids=[make_archive_id(self, video_id)], | |
51 | **data_json, url_transparent=True) |