当前位置:   article > 正文

python爬取付费音乐包_Python爬咪咕收费音乐 高音质无损音乐

怎么爬取收费音乐

[Python] 纯文本查看 复制代码def migu_search(keyword, page=1):

params = {

'feature': '1111000000',

'isCopyright': 1,

'isCorrect': 1,

'pageIndex': page,

'pageSize': 20,

'searchSwitch':'{"song":1,"album":0,"singer":0,"tagSong":1,"mvSong":0,"songlist":0,"bestShow":1,"lyricSong":0,"concert":0,"periodical":0,"ticket":0,"bit24":0,"verticalVideoTone":0}',

'sort': 0,

'text': keyword,

'uiVersion': 'I_music_3.0.2',

}

response = Api.request('http://jadeite.migu.cn:7090/music_search/v2/search/searchAll', "GET", params)

res_data = response.get('songResultData', {}).get("resultList", [])

print(json.dumps(res_data))

result = []

for items in res_data:

for item in items:

singers = ','.join([s.get("name", "") for s in item.get('singers')])

song = {

'song_name': item.get('name'),

'singers': singers

}

rate_list = item.get('rateFormats', [])

urls = {}

for x in rate_list:

if len(x.get('url', "")) > 0:

urls[x.get('formatType')] = x.get('url').replace('ftp://218.200.160.122:21', 'http://freetyst.nf.migu.cn')

else:

format_type = x.get('formatType')

if format_type == 'SQ':

urls['SQ-flac'] = x.get('androidUrl').replace('ftp://218.200.160.122:21', 'http://freetyst.nf.migu.cn')

urls['SQ-m4a'] = x.get('iosUrl').replace('ftp://218.200.160.122:21', 'http://freetyst.nf.migu.cn')

song['urls'] = urls

result.append(song)

return result

if __name__ == '__main__':

r = migu_search("周杰伦", 1)

print(json.dumps(r, indent=4))

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/141360
推荐阅读
相关标签
  

闽ICP备14008679号