Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON contents not loading correctly. #1

Closed
wagerpascal opened this issue Apr 29, 2016 · 4 comments
Closed

JSON contents not loading correctly. #1

wagerpascal opened this issue Apr 29, 2016 · 4 comments

Comments

@wagerpascal
Copy link

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.

@atlas-comstock
Copy link
Owner

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.

@wagerpascal
Copy link
Author

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.

@NKUCodingCat
Copy link

NKUCodingCat commented Nov 25, 2016

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

@wagerpascal
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants