From 7c9cc4618f566cbe1e2b6d5315753c52259b03d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjist=C3=B3f?= Date: Fri, 27 Oct 2017 02:10:59 +0200 Subject: [PATCH] implemented even hotter fix, after second breaking change in a day --- coub-dl.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/coub-dl.py b/coub-dl.py index 5a45511..2f9f31c 100755 --- a/coub-dl.py +++ b/coub-dl.py @@ -50,6 +50,7 @@ class coub_dl: self.download_audio_stream() self.download_video_stream() self.read_extensions() + self.fix_video_stream() # get stream lengths via ffprobe audioLen = coub_dl.get_length(self._files_dict[Stream.AUDIO]) @@ -89,14 +90,9 @@ class coub_dl: @call_verbose(before_message='Downloading video stream... ') def download_video_stream(self): - url = get_output(('youtube-dl', - '--get-url', self._url)) - - url = url.replace('muted_', '') - call(('youtube-dl', '--ignore-config', '--output', '{}.%(ext)s'.format(self._files_dict[Stream.VIDEO]), - url), + self._url), stdout=DEVNULL, stderr=DEVNULL) @@ -108,6 +104,13 @@ class coub_dl: self._files_dict[filename] = fullname + def fix_video_stream(self): + """ magic fix for videos served by coub. see https://github.com/rg3/youtube-dl/issues/13754 """ + with open(self._files_dict[Stream.VIDEO], 'r+b') as f: + f.seek(0) + f.write(bytes(2)) + + @call_verbose(before_message='Looping shorter stream... ') def loop_shorter_stream(self, shorter, shorter_file, loop_fraction): # prepare last fractional loop