sk1418 / zhuaxia

download mp3 files/albums from xiami.com and music.163.com
Other
410 stars 83 forks source link

网易音乐-H参数异常 #5

Closed jerry74 closed 10 years ago

jerry74 commented 10 years ago

root@lin:/tmp/test# zx -H http://music.163.com/#/playlist?id=10237282 [虾] 登录虾米... WARNING: [虾] 登录失败, 略过登录, 虾米资源质量为 128kbps. Traceback (most recent call last): File "/usr/local/bin/zx", line 5, in pkg_resources.run_script('zhuaxia==1.0.0', 'zx') File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 499, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1235, in run_script execfile(script_filename, namespace, namespace) File "/usr/local/lib/python2.7/dist-packages/zhuaxia-1.0.0-py2.7.egg/EGG-INFO/scripts/zx", line 98, in commander.shall_I_begin(inUrl, is_hq=hq) File "/usr/local/lib/python2.7/dist-packages/zhuaxia-1.0.0-py2.7.egg/zhuaxia/commander.py", line 39, in shall_I_begin from_url_163(m163, in_str) File "/usr/local/lib/python2.7/dist-packages/zhuaxia-1.0.0-py2.7.egg/zhuaxia/commander.py", line 73, in from_url_163 playlist = netease.NeteasePlayList(m163, url) File "/usr/local/lib/python2.7/dist-packages/zhuaxia-1.0.0-py2.7.egg/zhuaxia/netease.py", line 125, in init self.init_playlist() File "/usr/local/lib/python2.7/dist-packages/zhuaxia-1.0.0-py2.7.egg/zhuaxia/netease.py", line 131, in init_playlist song = NeteaseSong(self.m163, song_json=jsong) File "/usr/local/lib/python2.7/dist-packages/zhuaxia-1.0.0-py2.7.egg/zhuaxia/netease.py", line 52, in init self.init_by_json(song_json) File "/usr/local/lib/python2.7/dist-packages/zhuaxia-1.0.0-py2.7.egg/zhuaxia/netease.py", line 68, in init_by_json dfsId = js['hMusic']['dfsId'] TypeError: 'NoneType' object has no attribute 'getitem'

sk1418 commented 10 years ago

经过调试,发现你的playlist里的一首歌: http://music.163.com/#/song?id=316103 (星星堆满天) 网易返回的json没有高音质信息,所以导致错误。

已做如下修正: 在获取高音质信息前先检查, 如果不能获取,就使用一般音质的资源信息。