[byutv] Fix extraction (refs #22070)

Downloading of new videos does not work due to DRM
This commit is contained in:
Sergey M․ 2019-09-25 02:16:25 +07:00
parent d06daf23da
commit df63cafe49
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D
1 changed files with 39 additions and 14 deletions

View File

@ -3,7 +3,12 @@ from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import parse_duration from ..utils import (
determine_ext,
merge_dicts,
parse_duration,
url_or_none,
)
class BYUtvIE(InfoExtractor): class BYUtvIE(InfoExtractor):
@ -51,7 +56,7 @@ class BYUtvIE(InfoExtractor):
video_id = mobj.group('id') video_id = mobj.group('id')
display_id = mobj.group('display_id') or video_id display_id = mobj.group('display_id') or video_id
info = self._download_json( video = self._download_json(
'https://api.byutv.org/api3/catalog/getvideosforcontent', 'https://api.byutv.org/api3/catalog/getvideosforcontent',
display_id, query={ display_id, query={
'contentid': video_id, 'contentid': video_id,
@ -62,7 +67,7 @@ class BYUtvIE(InfoExtractor):
'x-byutv-platformkey': 'xsaaw9c7y5', 'x-byutv-platformkey': 'xsaaw9c7y5',
}) })
ep = info.get('ooyalaVOD') ep = video.get('ooyalaVOD')
if ep: if ep:
return { return {
'_type': 'url_transparent', '_type': 'url_transparent',
@ -75,18 +80,38 @@ class BYUtvIE(InfoExtractor):
'thumbnail': ep.get('imageThumbnail'), 'thumbnail': ep.get('imageThumbnail'),
} }
ep = info['dvr'] info = {}
title = ep['title'] formats = []
formats = self._extract_m3u8_formats( for format_id, ep in video.items():
ep['videoUrl'], video_id, 'mp4', entry_protocol='m3u8_native', if not isinstance(ep, dict):
m3u8_id='hls') continue
self._sort_formats(formats) video_url = url_or_none(ep.get('videoUrl'))
return { if not video_url:
'id': video_id, continue
'display_id': display_id, ext = determine_ext(video_url)
'title': title, if ext == 'm3u8':
formats.extend(self._extract_m3u8_formats(
video_url, video_id, 'mp4', entry_protocol='m3u8_native',
m3u8_id='hls', fatal=False))
elif ext == 'mpd':
formats.extend(self._extract_mpd_formats(
video_url, video_id, mpd_id='dash', fatal=False))
else:
formats.append({
'url': video_url,
'format_id': format_id,
})
merge_dicts(info, {
'title': ep.get('title'),
'description': ep.get('description'), 'description': ep.get('description'),
'thumbnail': ep.get('imageThumbnail'), 'thumbnail': ep.get('imageThumbnail'),
'duration': parse_duration(ep.get('length')), 'duration': parse_duration(ep.get('length')),
})
self._sort_formats(formats)
return merge_dicts(info, {
'id': video_id,
'display_id': display_id,
'title': display_id,
'formats': formats, 'formats': formats,
} })