Google+: use Content-Disposition filename

This commit is contained in:
Mort Yao 2013-04-16 21:29:00 +02:00
parent 226c7adaaf
commit 04670164d5

View File

@ -47,12 +47,17 @@ def googleplus_download(url, output_dir = '.', merge = True, info_only = False):
if real_url: if real_url:
break break
real_url = unicodize(real_url) real_url = unicodize(real_url)
type, ext, size = url_info(real_url) type, ext, size = url_info(real_url)
if not ext: if not ext:
ext = 'mp4' ext = 'mp4'
response = request.urlopen(request.Request(real_url))
if response.headers['content-disposition']:
filename = parse.unquote(r1(r'filename="?(.+)"?', response.headers['content-disposition'])).split('.')
title = ''.join(filename[:-1])
print_info(site_info, title, ext, size) print_info(site_info, title, ext, size)
if not info_only: if not info_only:
download_urls([real_url], title, ext, size, output_dir, merge = merge) download_urls([real_url], title, ext, size, output_dir, merge = merge)