codezjx / netease-cloud-music-dl

Netease cloud music song downloader, with full ID3 metadata, eg: front cover image, artist name, album name, song title and so on.
MIT License
510 stars 84 forks source link

`ncm -a <url>` 下载专辑时报错 #63

Closed Ahacad closed 2 years ago

Ahacad commented 2 years ago
Return {'code': -462, 'data': {'actionCode': '1043403', 'verifyType': 50, 'verifyId': 1008601, 'verifyUrl': '', 'blockText': '绑定手机后,可进行下一步操作哦~', 'verifyToken': None, 'btnText': '', 'orpheusUrl': '', 'params': {'event_id': '00181406822544093185', 'sign': '7aa04fa4a8fd739916e32040e2a8b593'}, 'url': None}, 'message': '请绑定手机后再试哦~'} when try to get http://music.163.com/api/album/251130/
Traceback (most recent call last):
  File "/usr/bin/ncm", line 33, in <module>
    sys.exit(load_entry_point('netease-cloud-music-dl==0.2.0', 'console_scripts', 'ncm')())
  File "/usr/lib/python3.10/site-packages/netease_cloud_music_dl-0.2.0-py3.10.egg/ncm/start.py", line 76, in main
  File "/usr/lib/python3.10/site-packages/netease_cloud_music_dl-0.2.0-py3.10.egg/ncm/start.py", line 29, in download_album_songs
  File "/usr/lib/python3.10/site-packages/netease_cloud_music_dl-0.2.0-py3.10.egg/ncm/api.py", line 67, in get_album_songs
TypeError: 'NoneType' object is not subscriptable
icyfox-bupt commented 2 years ago

感觉是网易云加了一个登录验证,看起来作者还木有时间改

shinvdu commented 2 years ago

同问

codezjx commented 2 years ago

@Ahacad @icyfox-bupt @shinvdu 抱歉,现在才看到,已修复

这个问题应该是猪厂加了header的校验,请求的url地址是http://music.163.com/api/album/19313/ 发现在浏览器上直接请求每次都成功,但是通过python或者curl去访问,就有概率返回-462。参考了浏览器的Cookie设置,给带上一个随机的NMTID就好了。