mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 12:01:28 +00:00
parent
c168d8791d
commit
644738ddaa
|
@ -1,4 +1,6 @@
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from .jwplatform import JWPlatformIE
|
||||||
|
from ..utils import make_archive_id
|
||||||
|
|
||||||
|
|
||||||
class OneFootballIE(InfoExtractor):
|
class OneFootballIE(InfoExtractor):
|
||||||
|
@ -7,41 +9,43 @@ class OneFootballIE(InfoExtractor):
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://onefootball.com/en/video/highlights-fc-zuerich-3-3-fc-basel-34012334',
|
'url': 'https://onefootball.com/en/video/highlights-fc-zuerich-3-3-fc-basel-34012334',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '34012334',
|
'id': 'Y2VtcWAT',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Highlights: FC Zürich 3-3 FC Basel',
|
'title': 'Highlights: FC Zürich 3-3 FC Basel',
|
||||||
'description': 'md5:33d9855cb790702c4fe42a513700aba8',
|
'description': 'md5:33d9855cb790702c4fe42a513700aba8',
|
||||||
'thumbnail': 'https://photobooth-api.onefootball.com/api/screenshot/https:%2F%2Fperegrine-api.onefootball.com%2Fv2%2Fphotobooth%2Fcms%2Fen%2F34012334',
|
'thumbnail': 'https://cdn.jwplayer.com/v2/media/Y2VtcWAT/poster.jpg?width=720',
|
||||||
'timestamp': 1635874604,
|
'timestamp': 1635874895,
|
||||||
'upload_date': '20211102'
|
'upload_date': '20211102',
|
||||||
|
'duration': 375.0,
|
||||||
|
'tags': ['Football', 'Soccer', 'OneFootball'],
|
||||||
|
'_old_archive_ids': ['onefootball 34012334'],
|
||||||
},
|
},
|
||||||
'params': {'skip_download': True}
|
'params': {'skip_download': True},
|
||||||
|
'expected_warnings': ['Failed to download m3u8 information'],
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://onefootball.com/en/video/klopp-fumes-at-var-decisions-in-west-ham-defeat-34041020',
|
'url': 'https://onefootball.com/en/video/klopp-fumes-at-var-decisions-in-west-ham-defeat-34041020',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '34041020',
|
'id': 'leVJrMho',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Klopp fumes at VAR decisions in West Ham defeat',
|
'title': 'Klopp fumes at VAR decisions in West Ham defeat',
|
||||||
'description': 'md5:9c50371095a01ad3f63311c73d8f51a5',
|
'description': 'md5:9c50371095a01ad3f63311c73d8f51a5',
|
||||||
'thumbnail': 'https://photobooth-api.onefootball.com/api/screenshot/https:%2F%2Fperegrine-api.onefootball.com%2Fv2%2Fphotobooth%2Fcms%2Fen%2F34041020',
|
'thumbnail': 'https://cdn.jwplayer.com/v2/media/leVJrMho/poster.jpg?width=720',
|
||||||
'timestamp': 1636314103,
|
'timestamp': 1636315232,
|
||||||
'upload_date': '20211107'
|
'upload_date': '20211107',
|
||||||
|
'duration': 93.0,
|
||||||
|
'tags': ['Football', 'Soccer', 'OneFootball'],
|
||||||
|
'_old_archive_ids': ['onefootball 34041020'],
|
||||||
},
|
},
|
||||||
'params': {'skip_download': True}
|
'params': {'skip_download': True}
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
data_json = self._search_json_ld(webpage, id)
|
data_json = self._search_json_ld(webpage, video_id, fatal=False)
|
||||||
m3u8_url = self._html_search_regex(r'(https://cdn\.jwplayer\.com/manifests/.+\.m3u8)', webpage, 'm3u8_url')
|
data_json.pop('url', None)
|
||||||
formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, id)
|
m3u8_url = self._html_search_regex(r'(https://cdn\.jwplayer\.com/manifests/\w+\.m3u8)', webpage, 'm3u8_url')
|
||||||
return {
|
|
||||||
'id': id,
|
return self.url_result(
|
||||||
'title': data_json.get('title'),
|
m3u8_url, JWPlatformIE, video_id, _old_archive_ids=[make_archive_id(self, video_id)],
|
||||||
'description': data_json.get('description'),
|
**data_json, url_transparent=True)
|
||||||
'thumbnail': data_json.get('thumbnail'),
|
|
||||||
'timestamp': data_json.get('timestamp'),
|
|
||||||
'formats': formats,
|
|
||||||
'subtitles': subtitles,
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue