darknessomi / musicbox

网易云音乐命令行版本
MIT License
9.83k stars 1.58k forks source link

歌单中存在用户自己上传的歌曲时会导致崩溃 #642

Open DHPO opened 6 years ago

DHPO commented 6 years ago

如题,在音乐云盘中上传了歌曲并添加到歌曲列表以后,使用musicbox获取列表时会导致musicbox崩溃。

错误信息如下:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/NEMbox/api.py", line 134, in geturl
    return geturl_v1(song)
  File "/usr/local/lib/python3.5/dist-packages/NEMbox/api.py", line 142, in geturl_v1
    if song['hMusic'] and quality <= 0:
KeyError: 'hMusic'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/NEMbox/__init__.py", line 40, in start
    nembox_menu.start_fork(version)
  File "/usr/local/lib/python3.5/dist-packages/NEMbox/menu.py", line 177, in start_fork
    Menu().start()
  File "/usr/local/lib/python3.5/dist-packages/NEMbox/menu.py", line 304, in start
    self.dispatch_enter(idx)
  File "/usr/local/lib/python3.5/dist-packages/NEMbox/menu.py", line 681, in dispatch_enter
    self.datalist = netease.dig_info(songs, 'songs')
  File "/usr/local/lib/python3.5/dist-packages/NEMbox/api.py", line 655, in dig_info
    url, quality = geturl(data[i])
  File "/usr/local/lib/python3.5/dist-packages/NEMbox/api.py", line 136, in geturl
    return geturl_v3(song)
  File "/usr/local/lib/python3.5/dist-packages/NEMbox/api.py", line 174, in geturl_v3
    return song['mp3Url'], ''
KeyError: 'mp3Url'

看上去应该就是没有对应的歌曲链接导致的,能把错误catch住不至于崩溃就行

taotao7 commented 6 years ago

我想问问现在修复了吗

zexi commented 6 years ago

提了一个PR: https://github.com/darknessomi/musicbox/pull/664 尝试过滤云盘里面获取不到 mp3Url 的音乐,避免发生崩溃。

XAS-712 commented 6 years ago

有没有人能试下dump一下这个song,说不定有别的播放方法,但可能又需要逆向登录API了。。。

XAS-712 commented 6 years ago

我猜还有一种情况会没有url,那些版权原因下架的

zexi commented 6 years ago

@XAS-712 那些因为版权不能播放的歌上传到云盘后,通过官方的客户端是可以播放的。可以具体研究下云盘歌曲的播放方法。

XAS-712 commented 6 years ago

@zexi 我抓个包看看。 现在用的是哪个平台的API?