1 from .common
import InfoExtractor
2 from .uplynk
import UplynkPreplayIE
3 from ..utils
import HEADRequest
, float_or_none
, make_archive_id
, smuggle_url
6 class FoxSportsIE(InfoExtractor
):
7 _VALID_URL
= r
'https?://(?:www\.)?foxsports\.com/watch/(?P<id>[\w-]+)'
9 'url': 'https://www.foxsports.com/watch/play-612168c6700004b',
11 'id': 'b72f5bd8658140baa5791bb676433733',
13 'display_id': 'play-612168c6700004b',
14 'title': 'md5:e0c4ecac3a1f25295b4fae22fb5c126a',
15 'description': 'md5:371bc43609708ae2b9e1a939229762af',
16 'uploader_id': '06b4a36349624051a9ba52ac3a91d268',
17 'upload_date': '20221205',
18 'timestamp': 1670262586,
20 'thumbnail': r
're:^https?://.*\.jpg$',
21 'extra_param_to_segment_url': str,
24 'skip_download': 'm3u8',
28 def _real_extract(self
, url
):
29 video_id
= self
._match
_id
(url
)
30 webpage
= self
._download
_webpage
(url
, video_id
)
31 json_ld
= self
._search
_json
_ld
(webpage
, video_id
, expected_type
='VideoObject', default
={})
32 data
= self
._download
_json
(
33 f
'https://api3.fox.com/v2.0/vodplayer/sportsclip/{video_id}',
34 video_id
, note
='Downloading API JSON', headers
={
35 'x-api-key': 'cf289e299efdfa39fb6316f259d1de93',
37 preplay_url
= self
._request
_webpage
(
38 HEADRequest(data
['url']), video_id
, 'Fetching preplay URL').geturl()
41 '_type': 'url_transparent',
42 'ie_key': UplynkPreplayIE
.ie_key(),
43 'url': smuggle_url(preplay_url
, {'Origin': 'https://www.foxsports.com'}
),
44 'display_id': video_id
,
45 'title': data
.get('name') or json_ld
.get('title'),
46 'description': data
.get('description') or json_ld
.get('description'),
47 'duration': float_or_none(data
.get('durationInSeconds')),
48 'timestamp': json_ld
.get('timestamp'),
49 'thumbnails': json_ld
.get('thumbnails'),
50 '_old_archive_ids': [make_archive_id(self
, video_id
)],