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

Doesn't work for this album. #20

Open arnauldb opened 5 years ago

arnauldb commented 5 years ago

Hello,

I can't get it working for this album: https://www.xiami.com/album/yhPxum9b6ce I have this error:

 ~/…/xiami-downloader-develop  $  python -m xiami_downloader.cli -a yhPxum9b6ce
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/arnauld/Desktop/xiami-downloader-develop/xiami_downloader/cli.py", line 493, in <module>
    main()
  File "/home/arnauld/Desktop/xiami-downloader-develop/xiami_downloader/cli.py", line 467, in main
    urls.extend(build_url_list('album', args.album))
  File "/home/arnauld/Desktop/xiami-downloader-develop/xiami_downloader/cli.py", line 320, in build_url_list
    for item in group
  File "/home/arnauld/Desktop/xiami-downloader-develop/xiami_downloader/cli.py", line 451, in get_entity_id
    raise ValueError('ID not found for {}: {}'.format(category, id_or_code))
ValueError: ID not found for album: yhPxum9b6ce

It is working fine though for your example album: python -m xiami_downloader.cli -a 511682

Thank you.

timothyqiu commented 5 years ago

I downloaded the album successfully, but got the same error when I run the command again. The web browser also gave me a captcha screen when I visit the main site. It seems that Xiami somehow restricted our access.

Currently, a temporary solution is to manually open the source code of https://www.xiami.com/album/yhPxum9b6ce using your browser, and search for canonical to get the correct numeric ID 2102866712.

timothyqiu commented 5 years ago

Another less painful way to get the ID is to click the "立即播放" button. The correct numeric ID (2102866712) will be in the url of the new player window:

https://www.xiami.com/play?ids=/song/playlist/id/2102866712/type/1#loaded

The works for albums, songs, and playlists.

arnauldb commented 5 years ago

It still doesn't work for me. I searched as you said for the ID number, found the same as you, 2102866712, but then:

python -m xiami_downloader.cli -a 2102866712 0 file(s) to download

timothyqiu commented 5 years ago

That's strange... I can download successfully using the same command 🤔

arnauldb commented 5 years ago

Could it be because of my location? I am in France.