]> jfr.im git - yt-dlp.git/commitdiff
[sponskrub] Print "unrecognized args" message correctly
authorpukkandan <redacted>
Sat, 23 Jan 2021 11:47:47 +0000 (17:17 +0530)
committerpukkandan <redacted>
Sat, 23 Jan 2021 11:47:47 +0000 (17:17 +0530)
youtube_dlc/postprocessor/sponskrub.py

index c8c83d0a9ae64f13995a38b8308d142c78b31ad8..4e9bec2571d4e77ca7f7aa5732581f12cdf1eb21 100644 (file)
@@ -84,6 +84,7 @@ def run(self, information):
         else:
             msg = stderr.decode('utf-8', 'replace').strip() or stdout.decode('utf-8', 'replace').strip()
             self.write_debug(msg, prefix=False)
-            msg = msg.split('\n')[-1]
+            line = 0 if msg[:12].lower() == 'unrecognised' else -1
+            msg = msg.split('\n')[line]
             raise PostProcessingError(msg if msg else 'sponskrub failed with error code %s' % p.returncode)
         return [], information