Created
May 9, 2024 17:46
-
-
Save danj2k/33bdb265e609f74ffb79ab625375d42e to your computer and use it in GitHub Desktop.
Patch for Streamlink 6.7.3 stable release to add decryption support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -u -r '--exclude=*.txt' streamlink-6.7.3/src/streamlink/session/options.py streamlink-6.7.3-patched/src/streamlink/session/options.py | |
--- streamlink-6.7.3/src/streamlink/session/options.py 2024-04-14 16:40:22.000000000 +0100 | |
+++ streamlink-6.7.3-patched/src/streamlink/session/options.py 2024-05-09 14:17:43.019823245 +0100 | |
@@ -254,6 +254,10 @@ | |
- ``str | None`` | |
- ``None`` | |
- Set the output format of muxed streams, e.g. ``"matroska"`` | |
+ * - ffmpeg-dkey | |
+ - ``str | None`` | |
+ - ``None`` | |
+ - Specify the decryption key for DRM-protected content | |
* - ffmpeg-video-transcode | |
- ``str | None`` | |
- ``None`` | |
@@ -330,6 +334,7 @@ | |
"ffmpeg-verbose": False, | |
"ffmpeg-verbose-path": None, | |
"ffmpeg-fout": None, | |
+ "ffmpeg-dkey": None, | |
"ffmpeg-video-transcode": None, | |
"ffmpeg-audio-transcode": None, | |
"ffmpeg-copyts": False, | |
diff -u -r '--exclude=*.txt' streamlink-6.7.3/src/streamlink/stream/dash/dash.py streamlink-6.7.3-patched/src/streamlink/stream/dash/dash.py | |
--- streamlink-6.7.3/src/streamlink/stream/dash/dash.py 2024-04-14 16:40:22.000000000 +0100 | |
+++ streamlink-6.7.3-patched/src/streamlink/stream/dash/dash.py 2024-05-09 14:18:14.487501406 +0100 | |
@@ -293,11 +293,7 @@ | |
# Search for suitable video and audio representations | |
for aset in mpd.periods[period].adaptationSets: | |
- if aset.contentProtections: | |
- raise PluginError(f"{source} is protected by DRM") | |
for rep in aset.representations: | |
- if rep.contentProtections: | |
- raise PluginError(f"{source} is protected by DRM") | |
if rep.mimeType.startswith("video"): | |
video.append(rep) | |
elif rep.mimeType.startswith("audio"): # pragma: no branch | |
diff -u -r '--exclude=*.txt' streamlink-6.7.3/src/streamlink/stream/ffmpegmux.py streamlink-6.7.3-patched/src/streamlink/stream/ffmpegmux.py | |
--- streamlink-6.7.3/src/streamlink/stream/ffmpegmux.py 2024-04-14 16:40:22.000000000 +0100 | |
+++ streamlink-6.7.3-patched/src/streamlink/stream/ffmpegmux.py 2024-05-09 14:20:08.238360935 +0100 | |
@@ -180,9 +180,14 @@ | |
maps = options.pop("maps", []) | |
copyts = session.options.get("ffmpeg-copyts") or options.pop("copyts", False) | |
start_at_zero = session.options.get("ffmpeg-start-at-zero") or options.pop("start_at_zero", False) | |
+ dkey = session.options.get("ffmpeg-dkey") or options.pop("dkey", False) | |
self._cmd = [self.command(session), "-nostats", "-y"] | |
+ if dkey: | |
+ self._cmd.extend(['-decryption_key', dkey]) | |
+ | |
for np in self.pipes: | |
+ self._cmd.extend(['-thread_queue_size', '32768']) | |
self._cmd.extend(["-i", str(np.path)]) | |
self._cmd.extend(["-c:v", videocodec]) | |
diff -u -r '--exclude=*.txt' streamlink-6.7.3/src/streamlink_cli/argparser.py streamlink-6.7.3-patched/src/streamlink_cli/argparser.py | |
--- streamlink-6.7.3/src/streamlink_cli/argparser.py 2024-04-14 16:40:22.000000000 +0100 | |
+++ streamlink-6.7.3-patched/src/streamlink_cli/argparser.py 2024-05-09 14:27:16.086298706 +0100 | |
@@ -1141,6 +1141,16 @@ | |
""", | |
) | |
transport_ffmpeg.add_argument( | |
+ "--ffmpeg-dkey", | |
+ type=str, | |
+ metavar="DKEY", | |
+ help=""" | |
+ When attempting to play DRM-protected streams, specify the | |
+ decryption key to be passed to ffmpeg. | |
+ | |
+ """ | |
+ ) | |
+ transport_ffmpeg.add_argument( | |
"--ffmpeg-video-transcode", | |
metavar="CODEC", | |
help=""" | |
@@ -1421,6 +1431,7 @@ | |
("ffmpeg_verbose", "ffmpeg-verbose", None), | |
("ffmpeg_verbose_path", "ffmpeg-verbose-path", None), | |
("ffmpeg_fout", "ffmpeg-fout", None), | |
+ ("ffmpeg_dkey", "ffmpeg-dkey", None), | |
("ffmpeg_video_transcode", "ffmpeg-video-transcode", None), | |
("ffmpeg_audio_transcode", "ffmpeg-audio-transcode", None), | |
("ffmpeg_copyts", "ffmpeg-copyts", None), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment