atlas-comstock / NeteaseCloudMusicFlac

根据网易云音乐的歌单, 下载flac无损音乐到本地. Download the FLAC music from Internet according to your NeteaseCloudMusic playlist.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSON contents not loading correctly.

wagerpascal opened this issue · comments

I loaded the code into the Cloud 9 IDE and tried to run:

python main.py http://music.163.com/playlist?id=145258012

I got the following error:

Traceback (most recent call last):
  File "main.py", line 44, in <module>
    songlink = d["data"]["songList"][0]["songLink"]
IndexError: string index out of range

I printed 'd' from " d = json.loads(contents, encoding="utf-8") " and received the following error:

{u'errorCode': 22232, u'data': {u'xcode': u'', u'songList': u''}}

Couldn't figure out what exactly is wrong here, but I'd like to note it. I think it's either JSON or UTF related.

Hi, @wagerpascal . Thank you for your use and issue.
This problem was caused by can not fetch the URL of the music.

Did you live abroad? You know, you can not download things in abroad.
Some music player like NeteaseCloudMusicFlac and Baidu music will block you.

Some people met this issue because they live abroad. They solve the problem when they use the vpn in China.

Oh I see. It's been around 10 years since the last time I've downloaded a mp3 from Baidu... didn't know their policy changed. Sorry about the confusion.

you can change your host and it may solve this problem......

158.69.209.100 music.163.com
14.215.100.225 m1.music.126.net
14.215.100.225 m2.music.126.net
14.215.100.225 m3.music.126.net
14.215.100.225 m4.music.126.net
14.215.100.225 m5.music.126.net
14.215.100.225 m6.music.126.net
14.215.100.225 m7.music.126.net
14.215.100.225 m8.music.126.net
14.215.100.225 m9.music.126.net
14.215.100.225 m10.music.126.net

not tested but this host works pretty good in website

Btw, I am writting a script to find netease music CDN..... right there : https://gist.github.com/NKUCodingCat/9021caca8e4e9c76dadcf597f839bc89 which will find the IP of m*.music.126.net

Oh dang, that might actually work. You've got a pretty cool script, I'll definitely peek at it when finals are over. Thanks!