mirror of
https://github.com/soimort/you-get.git
synced 2025-02-03 00:33:58 +03:00
fix #1: use redirected URLs for resuming of Youku downloads
This commit is contained in:
parent
a4bf334acf
commit
e71972d4a1
@ -109,6 +109,13 @@ def url_info(url):
|
|||||||
|
|
||||||
return type, ext, size
|
return type, ext, size
|
||||||
|
|
||||||
|
def url_locations(urls):
|
||||||
|
locations = []
|
||||||
|
for url in urls:
|
||||||
|
response = request.urlopen(request.Request(url))
|
||||||
|
locations.append(response.url)
|
||||||
|
return locations
|
||||||
|
|
||||||
def url_save(url, filepath, bar, refer = None, is_part = False):
|
def url_save(url, filepath, bar, refer = None, is_part = False):
|
||||||
file_size = url_size(url)
|
file_size = url_size(url)
|
||||||
|
|
||||||
|
@ -123,11 +123,14 @@ def file_type_of_url(url):
|
|||||||
def youku_download_by_id(id2, title, output_dir = '.', stream_type = None, merge = True, info_only = False):
|
def youku_download_by_id(id2, title, output_dir = '.', stream_type = None, merge = True, info_only = False):
|
||||||
info = get_info(id2)
|
info = get_info(id2)
|
||||||
urls, sizes = zip(*find_video(info, stream_type))
|
urls, sizes = zip(*find_video(info, stream_type))
|
||||||
|
ext = file_type_of_url(urls[0])
|
||||||
total_size = sum(sizes)
|
total_size = sum(sizes)
|
||||||
|
|
||||||
print_info(site_info, title, file_type_of_url(urls[0]), total_size)
|
urls = url_locations(urls) # Use real (redirected) URLs for resuming of downloads
|
||||||
|
|
||||||
|
print_info(site_info, title, ext, total_size)
|
||||||
if not info_only:
|
if not info_only:
|
||||||
download_urls(urls, title, file_type_of_url(urls[0]), total_size, output_dir, merge = merge)
|
download_urls(urls, title, ext, total_size, output_dir, merge = merge)
|
||||||
|
|
||||||
def youku_download(url, output_dir = '.', stream_type = None, merge = True, info_only = False):
|
def youku_download(url, output_dir = '.', stream_type = None, merge = True, info_only = False):
|
||||||
id2, title = parse_page(url)
|
id2, title = parse_page(url)
|
||||||
|
Loading…
Reference in New Issue
Block a user