A feature-rich command-line audio/video downloader
Use determine_ext when saving the thumbnail
Jaime Marquínez Ferrándizcbdbb7666540
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.pyindex e247061151..cc5f761577 100644--- a/youtube_dl/YoutubeDL.py+++ b/youtube_dl/YoutubeDL.py@@ -530,9 +530,7 @@ class YoutubeDL(object):if self.params.get('writethumbnail', False):if 'thumbnail' in info_dict:- thumb_format = info_dict['thumbnail'].rpartition(u'/')[2].rpartition(u'.')[2]- if not thumb_format:- thumb_format = 'jpg'+ thumb_format = determine_ext(info_dict['thumbnail'], u'jpg')thumb_filename = filename.rpartition('.')[0] + u'.' + thumb_formatself.to_screen(u'[%s] %s: Downloading thumbnail ...' %(info_dict['extractor'], info_dict['id']))diff --git a/youtube_dl/utils.py b/youtube_dl/utils.pyindex 532ca585d2..cf2ea654e8 100644--- a/youtube_dl/utils.py+++ b/youtube_dl/utils.py@@ -650,12 +650,12 @@ def unified_strdate(date_str):passreturn upload_date-def determine_ext(url):+def determine_ext(url, default_ext=u'unknown_video'):guess = url.partition(u'?')[0].rpartition(u'.')[2]if re.match(r'^[A-Za-z0-9]+$', guess):return guesselse:- return u'unknown_video'+ return default_extdef date_from_str(date_str):"""