(xiami.py) some songs do not work
Harry1993 opened this issue · comments
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
I can't repeat the error you met.
In my environment, these 3 songs (1769092341, 2212862, 1769677735) can be played correctly.
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.
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?
@Harry1993
I am using macos. python version is 2.7.15.
And MD5 (xiami.py) = c0919c1313311740ebce5b2d77e9ee53
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?
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