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