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

(xiami.py) some songs do not work #137

Open
Harry1993 opened this issue Aug 1, 2018 · 5 comments
Open

(xiami.py) some songs do not work #137

Harry1993 opened this issue Aug 1, 2018 · 5 comments

Comments

@Harry1993
Copy link

Hello Peter,

Good job in switching to the new Xiami API; we don't need cookies anymore!

I've found some (but not all) songs that can't be pulled. For example:

> xm p 'http://www.xiami.com/song/1769092341'
Traceback (most recent call last):
  File "/home/yman/Dropbox/toolkit/iScript/xiami.py", line 1496, in <module>
    main(argv)
  File "/home/yman/Dropbox/toolkit/iScript/xiami.py", line 1483, in main
    x.url_parser(urls)
  File "/home/yman/Dropbox/toolkit/iScript/xiami.py", line 809, in url_parser
    self.download_song()
  File "/home/yman/Dropbox/toolkit/iScript/xiami.py", line 918, in download_song
    songs = self.get_song(self.song_id)
  File "/home/yman/Dropbox/toolkit/iScript/xiami.py", line 913, in get_song
    song = self._api.song(song_id)
  File "/home/yman/Dropbox/toolkit/iScript/xiami.py", line 396, in song
    info = resp.json()['data']['trackList'][0]
TypeError: 'NoneType' object has no attribute '__getitem__'

Other examples include:

http://www.xiami.com/song/2212862 and http://www.xiami.com/song/1769677735, etc.

Best,

Yanmao

@PeterDing
Copy link
Owner

@Harry1993

I can't repeat the error you met.
In my environment, these 3 songs (1769092341, 2212862, 1769677735) can be played correctly.

screen shot 2018-08-01 at 17 07 52


The new api doesn't need cookies, but the bit rates of songs obtained from it are lower (128kbps).
Only one method that can get higher (320kbps or 192kbps) bit rates mp3 is providing a vip user's cookies.

@Harry1993
Copy link
Author

That's odd... I am still having the issue. My Python version is 2.7.15rc1. Are you using macOS? What's your Python version?

@PeterDing
Copy link
Owner

@Harry1993
I am using macos. python version is 2.7.15.
And MD5 (xiami.py) = c0919c1313311740ebce5b2d77e9ee53

@Harry1993
Copy link
Author

@PeterDing

Thanks. Both Python version and MD5 value match.

I've tested it on Ubuntu, Arch Linux, Raspbian and Debian. The same issue occurs on all of them. Would you please test it on a Linux PC?

@Harry1993
Copy link
Author

I just test it on my MacBook. The issue still occurs:

➜  iScript git:(master) python2 xiami.py p http://www.xiami.com/song/1769092341
Traceback (most recent call last):
  File "xiami.py", line 1496, in <module>
    main(argv)
  File "xiami.py", line 1483, in main
    x.url_parser(urls)
  File "xiami.py", line 809, in url_parser
    self.download_song()
  File "xiami.py", line 918, in download_song
    songs = self.get_song(self.song_id)
  File "xiami.py", line 913, in get_song
    song = self._api.song(song_id)
  File "xiami.py", line 396, in song
    info = resp.json()['data']['trackList'][0]
TypeError: 'NoneType' object has no attribute '__getitem__'
➜  iScript git:(master) md5 xiami.py
MD5 (xiami.py) = c0919c1313311740ebce5b2d77e9ee53
➜  iScript git:(master) python2 --version
Python 2.7.15

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

2 participants