implemented Coub breaking change detection. fixes #8
This commit is contained in:
parent
e7c7b06088
commit
71ec1f778f
@ -49,6 +49,8 @@ class coub_dl:
|
||||
self.download_audio_stream()
|
||||
self.download_video_stream()
|
||||
self.read_extensions()
|
||||
try: self.check_downloads()
|
||||
except RuntimeError: exit('Failed to download streams! This usually happens when Coub changes something.')
|
||||
self.fix_video_stream()
|
||||
|
||||
# get stream lengths via ffprobe
|
||||
@ -103,6 +105,12 @@ class coub_dl:
|
||||
self._files_dict[filename] = fullname
|
||||
|
||||
|
||||
def check_downloads(self):
|
||||
check = {Stream.VIDEO, Stream.AUDIO}
|
||||
if not all({exists(self._files_dict[item]) for item in check}):
|
||||
raise RuntimeError('Download failed!')
|
||||
|
||||
|
||||
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:
|
||||
|
Loading…
Reference in New Issue
Block a user