1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-11-02 07:35:13 +00:00

[hls] Better FairPlay DRM detection (#1661)

Authored by: nyuszika7h
This commit is contained in:
nyuszika7h
2021-11-19 02:49:51 +01:00
committed by GitHub
parent dd2a987d3f
commit 6b993ca765
2 changed files with 13 additions and 4 deletions

View File

@@ -77,6 +77,15 @@ class HlsFD(FragmentFD):
message = ('The stream has AES-128 encryption and neither ffmpeg nor pycryptodomex are available; '
'Decryption will be performed natively, but will be extremely slow')
if not can_download:
has_drm = re.search('|'.join([
r'#EXT-X-FAXS-CM:', # Adobe Flash Access
r'#EXT-X-(?:SESSION-)?KEY:.*?URI="skd://', # Apple FairPlay
]), s)
if has_drm and not self.params.get('allow_unplayable_formats'):
self.report_error(
'This video is DRM protected; Try selecting another format with --format or '
'add --check-formats to automatically fallback to the next best format')
return False
message = message or 'Unsupported features have been detected'
fd = FFmpegFD(self.ydl, self.params)
self.report_warning(f'{message}; extraction will be delegated to {fd.get_basename()}')