yt-dlp / yt-dlp

A feature-rich command-line audio/video downloader
https://discord.gg/H5MNcFW63r
The Unlicense
73.35k stars 5.81k forks source link

[ThePlatform] [CWTV] - This format is DRM protected #9935

Open krandor opened 2 weeks ago

krandor commented 2 weeks ago

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

Checklist

Region

United States

Provide a description that is worded well enough to be understood

Started getting this for Walker on CW today. Is there anything to be done to get around it or is CW just the latest in the string of streaming sites that are adopting DRM?

Using --check-formats rolls through all the available formats and fails for the same reason.

Provide verbose output that clearly demonstrates the problem

Complete Verbose Output

[debug] Command-line config: ['-vU', '--format', 'best', 'https://www.cwtv.com/shows/walker/hold-me-now/?play=fffc5964-0ca4-496f-9fcc-447f21c4087c']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2024.04.09 from yt-dlp/yt-dlp [ff0779267] (zip)
[debug] Python 3.10.12 (CPython x86_64 64bit) - Linux-5.15.0-105-generic-x86_64-with-glibc2.35 (OpenSSL 3.0.2 15 Mar 2022, glibc 2.35)
[debug] exe versions: ffmpeg 4.4.2 (setts), ffprobe 4.4.2
[debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.07.22, mutagen-1.46.0, pyxattr-0.7.2, requests-2.25.1, secretstorage-3.3.1, sqlite3-3.37.2, urllib3-1.26.5, websockets-11.0.3
[debug] Proxy map: {}
[debug] Request Handlers: urllib
WARNING: "-f best" selects the best pre-merged format which is often not the best option.
         To let yt-dlp download and merge the best available formats, simply do not pass any format selection.
         If you know what you are doing and want only the best pre-merged format, use "-f b" instead to suppress this warning
[debug] Loaded 1803 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: stable@2024.04.09 from yt-dlp/yt-dlp
yt-dlp is up to date (stable@2024.04.09 from yt-dlp/yt-dlp)
[CWTV] Extracting URL: https://www.cwtv.com/shows/walker/hold-me-now/?play=fffc5964-0ca4-496f-9fcc-447f21c4087c
[CWTV] fffc5964-0ca4-496f-9fcc-447f21c4087c: Downloading JSON metadata
[ThePlatform] Extracting URL: http://link.theplatform.com/s/cwtv/media/guid/2703454149/fffc5964-0ca4-496f-9fcc-447f21c4087c?format=SMIL&formats=M3U&tracking=true&mbr=false#__youtubedl_smuggle=%7B%22force_smil_url%22%3A+true%7D
[ThePlatform] fffc5964-0ca4-496f-9fcc-447f21c4087c: Downloading SMIL data
[ThePlatform] fffc5964-0ca4-496f-9fcc-447f21c4087c: Downloading m3u8 information
[ThePlatform] fffc5964-0ca4-496f-9fcc-447f21c4087c: Downloading JSON metadata
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
[info] fffc5964-0ca4-496f-9fcc-447f21c4087c: Downloading 1 format(s): hls-8327
[debug] Invoking hlsnative downloader on "https://stream-hls.cwtv.com/nosec/The_CW/462/109/210936901640/Walker-407-HoldMeNow-P407-CW_210936389872_m3u8_video_1920x1080_8000000_primary_audio_eng_xb3d9c325944044f780ed92751a3a5331_8.m3u8"
[hlsnative] Downloading m3u8 manifest
ERROR: This format is DRM protected; Try selecting another format with --format or add --check-formats to automatically fallback to the next best format
bashonly commented 2 weeks ago

The only thing we can do is detect it earlier and raise before the download stage

diff --git a/yt_dlp/extractor/cwtv.py b/yt_dlp/extractor/cwtv.py
index 69d50daf6..ad0fa76a1 100644
--- a/yt_dlp/extractor/cwtv.py
+++ b/yt_dlp/extractor/cwtv.py
@@ -74,6 +74,8 @@ def _real_extract(self, url):
         if data.get('result') != 'ok':
             raise ExtractorError(data['msg'], expected=True)
         video_data = data['video']
+        if video_data.get('mpx_drm') == 1:
+            self.report_drm(video_id)
         title = video_data['title']
         mpx_url = video_data.get('mpx_url') or 'http://link.theplatform.com/s/cwtv/media/guid/2703454149/%s?formats=M3U' % video_id
krandor commented 2 weeks ago

that's a shame, thanks for the research!