Henryhaohao / API_Music_Download

:rainbow:API_Music_Download各大音乐/FM平台歌曲下载API集合
84 stars 27 forks source link

大神你好,FM的下载均报错 #1

Open yangzhengpk opened 5 years ago

yangzhengpk commented 5 years ago

需要给宝宝下载一些喜马拉雅和荔枝FM上的故事,用了您的这个python脚本,网站歌曲测试没问题,但这两个fm网站下载均报错,即便是用了您实例的地址都不行。

yangzhengpk commented 5 years ago

附上报错信息

Traceback (most recent call last): File "I:/python/API_Music_Download-master/Spiders/main.py", line 103, in main(url) File "I:/python/API_Music_Download-master/Spiders/main.py", line 88, in main print('此音乐下载地址为:' + get_music_ximalayafm(url)) File "I:\python\API_Music_Download-master\Spiders\API_music_ximalayaFM.py", line 22, in get_music_ximalayafm mp3_url = html['data']['tracksForAudioPlay'][0]['src'] IndexError: list index out of range

yangzhengpk commented 5 years ago

研究了下喜马拉雅FM的代码,发现可能是喜马拉雅在这三个月做了接口改版,悄悄在ID后面加了个空格,只要去除获取地址的空格即可拿到json数据。id = url.rsplit('/', 1)[1].strip()