mirror of
https://github.com/soimort/you-get.git
synced 2025-02-03 08:43:58 +03:00
[netease] fix #1341, also do not create new directory when info_only
This commit is contained in:
parent
9a4b255dc1
commit
e765f32805
@ -4,6 +4,7 @@
|
|||||||
__all__ = ['netease_download']
|
__all__ = ['netease_download']
|
||||||
|
|
||||||
from ..common import *
|
from ..common import *
|
||||||
|
from ..util import fs
|
||||||
from json import loads
|
from json import loads
|
||||||
import hashlib
|
import hashlib
|
||||||
import base64
|
import base64
|
||||||
@ -28,10 +29,10 @@ def netease_cloud_music_download(url, output_dir='.', merge=True, info_only=Fals
|
|||||||
|
|
||||||
artist_name = j['album']['artists'][0]['name']
|
artist_name = j['album']['artists'][0]['name']
|
||||||
album_name = j['album']['name']
|
album_name = j['album']['name']
|
||||||
new_dir = output_dir + '/' + "%s - %s" % (artist_name, album_name)
|
new_dir = output_dir + '/' + fs.legitimize("%s - %s" % (artist_name, album_name))
|
||||||
if not os.path.exists(new_dir):
|
|
||||||
os.mkdir(new_dir)
|
|
||||||
if not info_only:
|
if not info_only:
|
||||||
|
if not os.path.exists(new_dir):
|
||||||
|
os.mkdir(new_dir)
|
||||||
cover_url = j['album']['picUrl']
|
cover_url = j['album']['picUrl']
|
||||||
download_urls([cover_url], "cover", "jpg", 0, new_dir)
|
download_urls([cover_url], "cover", "jpg", 0, new_dir)
|
||||||
|
|
||||||
@ -46,10 +47,10 @@ def netease_cloud_music_download(url, output_dir='.', merge=True, info_only=Fals
|
|||||||
elif "playlist" in url:
|
elif "playlist" in url:
|
||||||
j = loads(get_content("http://music.163.com/api/playlist/detail?id=%s&csrf_token=" % rid, headers={"Referer": "http://music.163.com/"}))
|
j = loads(get_content("http://music.163.com/api/playlist/detail?id=%s&csrf_token=" % rid, headers={"Referer": "http://music.163.com/"}))
|
||||||
|
|
||||||
new_dir = output_dir + '/' + j['result']['name']
|
new_dir = output_dir + '/' + fs.legitimize(j['result']['name'])
|
||||||
if not os.path.exists(new_dir):
|
|
||||||
os.mkdir(new_dir)
|
|
||||||
if not info_only:
|
if not info_only:
|
||||||
|
if not os.path.exists(new_dir):
|
||||||
|
os.mkdir(new_dir)
|
||||||
cover_url = j['result']['coverImgUrl']
|
cover_url = j['result']['coverImgUrl']
|
||||||
download_urls([cover_url], "cover", "jpg", 0, new_dir)
|
download_urls([cover_url], "cover", "jpg", 0, new_dir)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user