From 1e7a5a2cf26ea0cef6f96f699a8afb725274464e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjist=C3=B3f?= Date: Tue, 22 Aug 2017 00:50:18 +0200 Subject: [PATCH] added hotfix to youtube-dl's coub video bug: https://github.com/rg3/youtube-dl/issues/13754 --- coub-dl.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/coub-dl.py b/coub-dl.py index 2126941..953bd0a 100644 --- a/coub-dl.py +++ b/coub-dl.py @@ -91,6 +91,21 @@ def download_audio_stream(url, file_dict): @call_verbose(before_message='Downloading video stream... ') def download_video_stream(url, file_dict): + url = check_output(('youtube-dl', + '--get-url', url)).decode('utf-8').strip() + + curl = Popen(('curl', '--silent', + '--write-out', + '--location', + url), + stdout=PIPE) + + grep = Popen(('grep', '--only-matching', '"http.*"'), + stdin=curl.stdout, stdout=PIPE) + + url = check_output(('sed', 's/muted_//g'), + stdin=grep.stdout).decode('utf-8').strip().strip('"') + call(('youtube-dl', '--ignore-config', '--output', '{}.%(ext)s'.format(file_dict[Stream.VIDEO]), url),