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),