mirror of
https://github.com/blackjack4494/yt-dlc.git
synced 2024-12-22 07:43:08 +00:00
Added DRM logic
In the event when there are no available sources due to DRM controlled sources, return a DRM error and don't proceed with trying. #28 reports that an ExtractorError "No video formats found". Which is true, because the formats list is empty, however it's empty because they are all locked. This provides a more informative message to the end-user. # TESTING Tried the URL provided in #28 and confirmed a DRM messages is returned.
This commit is contained in:
parent
6410992da9
commit
87ab4fb11a
1 changed files with 11 additions and 2 deletions
|
@ -471,12 +471,17 @@ class BrightcoveNewIE(AdobePassIE):
|
||||||
title = json_data['name'].strip()
|
title = json_data['name'].strip()
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
|
sources_num = len(json_data.get('sources'))
|
||||||
|
key_systems_present = 0
|
||||||
for source in json_data.get('sources', []):
|
for source in json_data.get('sources', []):
|
||||||
container = source.get('container')
|
container = source.get('container')
|
||||||
ext = mimetype2ext(source.get('type'))
|
ext = mimetype2ext(source.get('type'))
|
||||||
src = source.get('src')
|
src = source.get('src')
|
||||||
# https://support.brightcove.com/playback-api-video-fields-reference#key_systems_object
|
# https://apis.support.brightcove.com/playback/references/playback-api-video-fields-reference.html
|
||||||
if ext == 'ism' or container == 'WVM' or source.get('key_systems'):
|
if source.get('key_systems'):
|
||||||
|
key_systems_present += 1
|
||||||
|
continue
|
||||||
|
elif ext == 'ism' or container == 'WVM':
|
||||||
continue
|
continue
|
||||||
elif ext == 'm3u8' or container == 'M2TS':
|
elif ext == 'm3u8' or container == 'M2TS':
|
||||||
if not src:
|
if not src:
|
||||||
|
@ -533,6 +538,10 @@ class BrightcoveNewIE(AdobePassIE):
|
||||||
'format_id': build_format_id('rtmp'),
|
'format_id': build_format_id('rtmp'),
|
||||||
})
|
})
|
||||||
formats.append(f)
|
formats.append(f)
|
||||||
|
|
||||||
|
if sources_num == key_systems_present:
|
||||||
|
raise ExtractorError('This video is DRM protected', expected=True)
|
||||||
|
|
||||||
if not formats:
|
if not formats:
|
||||||
# for sonyliv.com DRM protected videos
|
# for sonyliv.com DRM protected videos
|
||||||
s3_source_url = json_data.get('custom_fields', {}).get('s3sourceurl')
|
s3_source_url = json_data.get('custom_fields', {}).get('s3sourceurl')
|
||||||
|
|
Loading…
Reference in a new issue