diff options
author | Sergey M․ <dstftw@gmail.com> | 2015-11-22 17:27:13 +0600 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2015-11-22 17:27:13 +0600 |
commit | 9cb9a5df7794579c38efff1c4b1451a7d13da3c1 (patch) | |
tree | cec79d46a5e0e19f91c6a8f3a46c805bab787b79 /youtube_dl | |
parent | 5035536e3f32d4c47b2d3067c12e074cb9a4a199 (diff) |
[utils] Check ext with trailing slash against the list of known extensions
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/utils.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 7dab60bb8..c0325f054 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -922,9 +922,24 @@ def unified_strdate(date_str, day_first=True): def determine_ext(url, default_ext='unknown_video'): if url is None: return default_ext - guess = url.partition('?')[0].rpartition('.')[2].rstrip('/') + guess = url.partition('?')[0].rpartition('.')[2] if re.match(r'^[A-Za-z0-9]+$', guess): return guess + elif guess.rstrip('/') in ( + 'mp4', 'm4a', 'm4p', 'm4b', 'm4r', 'm4v', 'aac', + 'flv', 'f4v', 'f4a', 'f4b', + 'webm', 'ogg', 'ogv', 'oga', 'ogx', 'spx', 'opus', + 'mkv', 'mka', 'mk3d', + 'avi', 'divx', + 'mov', + 'asf', 'wmv', 'wma', + '3gp', '3g2', + 'mp3', + 'flac', + 'ape', + 'wav', + 'f4f', 'f4m', 'm3u8', 'smil'): + return guess.rstrip('/') else: return default_ext |