implemented even hotter fix, after second breaking change in a day

This commit is contained in:
Kjistóf 2017-10-27 02:10:59 +02:00
parent d19597b0f9
commit 7c9cc4618f
1 changed files with 9 additions and 6 deletions

View File

@ -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