mirror of
https://github.com/soimort/you-get.git
synced 2025-02-11 20:52:31 +03:00
fix netease.py crash when downloading free songs mixed with non-free ones
This commit is contained in:
parent
96398d8f6c
commit
0d807b8326
@ -120,12 +120,23 @@ def netease_song_download(song, output_dir='.', info_only=False, playlist_prefix
|
|||||||
output_dir=output_dir, info_only=info_only)
|
output_dir=output_dir, info_only=info_only)
|
||||||
|
|
||||||
def netease_download_common(title, url_best, output_dir, info_only):
|
def netease_download_common(title, url_best, output_dir, info_only):
|
||||||
|
import urllib
|
||||||
|
is_non_free = False
|
||||||
|
try:
|
||||||
songtype, ext, size = url_info(url_best)
|
songtype, ext, size = url_info(url_best)
|
||||||
|
except urllib.error.HTTPError:
|
||||||
|
songtype = 'UNKNOWN'
|
||||||
|
size = 0
|
||||||
|
ext = 'UNKNOWN'
|
||||||
|
is_non_free = True
|
||||||
|
|
||||||
print_info(site_info, title, songtype, size)
|
print_info(site_info, title, songtype, size)
|
||||||
if not info_only:
|
if not info_only:
|
||||||
|
if is_non_free:
|
||||||
|
print('netease.py: %s is non-free' % title)
|
||||||
|
else:
|
||||||
download_urls([url_best], title, ext, size, output_dir)
|
download_urls([url_best], title, ext, size, output_dir)
|
||||||
|
|
||||||
|
|
||||||
def netease_download(url, output_dir = '.', merge = True, info_only = False, **kwargs):
|
def netease_download(url, output_dir = '.', merge = True, info_only = False, **kwargs):
|
||||||
if "163.fm" in url:
|
if "163.fm" in url:
|
||||||
url = get_location(url)
|
url = get_location(url)
|
||||||
|
Loading…
Reference in New Issue
Block a user