timothyqiu / xiami-downloader

A simple tool for downloading music previews from Xiami.
http://timothyqiu.com/archives/xiami-music-preview-downloader/
MIT License
74 stars 25 forks source link

Download Failed: "No JSON Object Could Be Decoded" #23

Open SILVERMERIDIAN opened 5 years ago

SILVERMERIDIAN commented 5 years ago

Hello,

The following error has occurred (for reference, the tool was working correctly on Monday April 1st). I have updated to the latest version. I suspect this may be to do with how Xiami presents the album number, as alphanumeric, not in numerals (it appears one has to login all time now, if I enter "https://xiami.com/album/361022" in a browser, that may be one cause). An example album 361022 (it exists), returns the below error:

python -m xiami_downloader.cli -a 361022 -t urllib2 --directory <insert directory here>

29 file(s) to download
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Library/Python/2.7/site-packages/xiami_downloader/cli.py", line 456, in <module>
    main()
  File "/Library/Python/2.7/site-packages/xiami_downloader/cli.py", line 452, in main
    xiami.download_songs(songs, tagging_enabled)
  File "/Library/Python/2.7/site-packages/xiami_downloader/cli.py", line 247, in download_songs
    song.track, song.album_tracks = self.get_song_track(song)
  File "/Library/Python/2.7/site-packages/xiami_downloader/cli.py", line 194, in get_song_track
    tracks = self.get_album(song.album_id)['data']['trackList']
  File "/Library/Python/2.7/site-packages/xiami_downloader/cli.py", line 241, in get_album
    encoding='utf-8',
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 310, in loads
    return _default_decoder.decode(s)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 346, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 364, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Your help is much appreciated.

timothyqiu commented 5 years ago

Xiami changed their web player as well as the API. It seems that they decided to trap IPs accessing the old API.

A complete update of the tool may be required.