mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-03 17:10:51 +01:00
[byutv] Add support for DVR videos (closes #20574)
Fix code style on brackets (flake8) Add more information to test info_dict
This commit is contained in:
parent
68b92aa1b4
commit
ab11674502
|
@ -3,6 +3,10 @@ from __future__ import unicode_literals
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
url_basename,
|
||||||
|
parse_duration,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class BYUtvIE(InfoExtractor):
|
class BYUtvIE(InfoExtractor):
|
||||||
|
@ -22,6 +26,18 @@ class BYUtvIE(InfoExtractor):
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
'add_ie': ['Ooyala'],
|
'add_ie': ['Ooyala'],
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.byutv.org/player/a5467e14-c7f2-46f9-b3c2-cb31a56749c6/byu-soccer-w-argentina-vs-byu-4419',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'a5467e14-c7f2-46f9-b3c2-cb31a56749c6',
|
||||||
|
'display_id': 'byu-soccer-w-argentina-vs-byu-4419',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Argentina vs. BYU (4/4/19)',
|
||||||
|
'duration': 7543.0,
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
'url': 'http://www.byutv.org/watch/6587b9a3-89d2-42a6-a7f7-fd2f81840a7d',
|
'url': 'http://www.byutv.org/watch/6587b9a3-89d2-42a6-a7f7-fd2f81840a7d',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
@ -33,9 +49,8 @@ class BYUtvIE(InfoExtractor):
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
display_id = mobj.group('display_id') or video_id
|
|
||||||
|
|
||||||
ep = self._download_json(
|
info = self._download_json(
|
||||||
'https://api.byutv.org/api3/catalog/getvideosforcontent', video_id,
|
'https://api.byutv.org/api3/catalog/getvideosforcontent', video_id,
|
||||||
query={
|
query={
|
||||||
'contentid': video_id,
|
'contentid': video_id,
|
||||||
|
@ -44,15 +59,32 @@ class BYUtvIE(InfoExtractor):
|
||||||
}, headers={
|
}, headers={
|
||||||
'x-byutv-context': 'web$US',
|
'x-byutv-context': 'web$US',
|
||||||
'x-byutv-platformkey': 'xsaaw9c7y5',
|
'x-byutv-platformkey': 'xsaaw9c7y5',
|
||||||
})['ooyalaVOD']
|
})
|
||||||
|
|
||||||
|
ep = info.get('ooyalaVOD')
|
||||||
|
if ep:
|
||||||
return {
|
return {
|
||||||
'_type': 'url_transparent',
|
'_type': 'url_transparent',
|
||||||
'ie_key': 'Ooyala',
|
'ie_key': 'Ooyala',
|
||||||
'url': 'ooyala:%s' % ep['providerId'],
|
'url': 'ooyala:%s' % ep['providerId'],
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'display_id': display_id,
|
'display_id': mobj.group('display_id') or video_id,
|
||||||
'title': ep.get('title'),
|
'title': ep.get('title'),
|
||||||
'description': ep.get('description'),
|
'description': ep.get('description'),
|
||||||
'thumbnail': ep.get('imageThumbnail'),
|
'thumbnail': ep.get('imageThumbnail'),
|
||||||
}
|
}
|
||||||
|
else:
|
||||||
|
ep = info['dvr']
|
||||||
|
formats = self._extract_m3u8_formats(
|
||||||
|
ep['videoUrl'], video_id, 'mp4', entry_protocol='m3u8_native'
|
||||||
|
)
|
||||||
|
self._sort_formats(formats)
|
||||||
|
return {
|
||||||
|
'formats': formats,
|
||||||
|
'id': video_id,
|
||||||
|
'display_id': url_basename(url),
|
||||||
|
'title': ep['title'],
|
||||||
|
'description': ep.get('description'),
|
||||||
|
'thumbnail': ep.get('imageThumbnail'),
|
||||||
|
'duration': parse_duration(ep.get('length')),
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user