1 from .common
import InfoExtractor
10 class BYUtvIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?byutv\.org/(?:watch|player)/(?!event/)(?P<id>[0-9a-f-]+)(?:/(?P<display_id>[^/?#&]+))?'
14 'url': 'http://www.byutv.org/watch/6587b9a3-89d2-42a6-a7f7-fd2f81840a7d/studio-c-season-5-episode-5',
16 'id': 'ZvanRocTpW-G5_yZFeltTAMv6jxOU9KH',
17 'display_id': 'studio-c-season-5-episode-5',
19 'title': 'Season 5 Episode 5',
20 'description': 'md5:1d31dc18ef4f075b28f6a65937d22c65',
21 'thumbnail': r
're:^https?://.*',
25 'skip_download': True,
29 'url': 'https://www.byutv.org/player/8f1dab9b-b243-47c8-b525-3e2d021a3451/byu-softball-pacific-vs-byu-41219---game-2',
31 'id': '8f1dab9b-b243-47c8-b525-3e2d021a3451',
32 'display_id': 'byu-softball-pacific-vs-byu-41219---game-2',
34 'title': 'Pacific vs. BYU (4/12/19)',
35 'description': 'md5:1ac7b57cb9a78015910a4834790ce1f3',
42 'url': 'http://www.byutv.org/watch/6587b9a3-89d2-42a6-a7f7-fd2f81840a7d',
43 'only_matching': True,
45 'url': 'https://www.byutv.org/player/27741493-dc83-40b0-8420-e7ae38a2ae98/byu-football-toledo-vs-byu-93016?listid=4fe0fee5-0d3c-4a29-b725-e4948627f472&listindex=0&q=toledo',
46 'only_matching': True,
49 def _real_extract(self
, url
):
50 mobj
= self
._match
_valid
_url
(url
)
51 video_id
= mobj
.group('id')
52 display_id
= mobj
.group('display_id') or video_id
54 video
= self
._download
_json
(
55 'https://api.byutv.org/api3/catalog/getvideosforcontent',
57 'contentid': video_id
,
59 'x-byutv-context': 'web$US',
61 'x-byutv-context': 'web$US',
62 'x-byutv-platformkey': 'xsaaw9c7y5',
68 for format_id
, ep
in video
.items():
69 if not isinstance(ep
, dict):
71 video_url
= url_or_none(ep
.get('videoUrl'))
74 ext
= determine_ext(video_url
)
76 m3u8_fmts
, m3u8_subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(
77 video_url
, video_id
, 'mp4', entry_protocol
='m3u8_native',
78 m3u8_id
='hls', fatal
=False)
79 formats
.extend(m3u8_fmts
)
80 subtitles
= self
._merge
_subtitles
(subtitles
, m3u8_subs
)
82 mpd_fmts
, mpd_subs
= self
._extract
_mpd
_formats
_and
_subtitles
(
83 video_url
, video_id
, mpd_id
='dash', fatal
=False)
84 formats
.extend(mpd_fmts
)
85 subtitles
= self
._merge
_subtitles
(subtitles
, mpd_subs
)
89 'format_id': format_id
,
92 'title': ep
.get('title'),
93 'description': ep
.get('description'),
94 'thumbnail': ep
.get('imageThumbnail'),
95 'duration': parse_duration(ep
.get('length')),
98 return merge_dicts(info
, {
100 'display_id': display_id
,
103 'subtitles': subtitles
,