[universal] better extraction of title and ext

This commit is contained in:
Mort Yao 2018-04-15 16:34:15 +02:00
parent ead0979ca1
commit 25aa2ac2e5
No known key found for this signature in database
GPG Key ID: 07DA00CB78203251

View File

@ -112,10 +112,9 @@ def universal_download(url, output_dir='.', merge=True, info_only=False, **kwarg
else:
# direct download
filename = parse.unquote(url.split('/')[-1])
title = '.'.join(filename.split('.')[:-1])
ext = filename.split('.')[-1]
_, _, size = url_info(url, faker=True)
filename = parse.unquote(url.split('/')[-1]) or parse.unquote(url.split('/')[-2])
title = '.'.join(filename.split('.')[:-1]) or filename
_, ext, size = url_info(url, faker=True)
print_info(site_info, title, ext, size)
if not info_only:
download_urls([url], title, ext, size,