python qq音乐网易云音乐酷狗音乐

网易云

    1. 评论   https://music.163.com/weapi/v1/resource/comments/R_SO_4_歌曲id?csrf_token= 
            可以直接传入空{}  
            1.1 {"csrf_token":""}
            1.2 {"ids":"[557581476]","br":128000,"csrf_token":""} 
            1.3 {"rid":"R_SO_4_557581476","offset":"0","total":"true","limit":"20","csrf_token":""}
            1.4 {"id":"557581476","lv":-1,"tv":-1,"csrf_token":""}
            1.5 {}  

    2. 歌词   https://music.163.com/weapi/song/lyric?csrf_token=
            2.1 {"id":"557581476","lv":-1,"tv":-1,"csrf_token":""}

    3. 歌曲   https://music.163.com/weapi/song/enhance/player/url?csrf_token= 
            3.1 {"ids":"[557581476]","br":128000,"csrf_token":""} 

    4. 歌曲信息列表,无歌曲链接  https://music.163.com/weapi/cloudsearch/get/web?csrf_token=
            4.1 {"hlpretag":"<span class=\"s-fc7\">","hlposttag":"</span>","s":"歌曲名或者歌手","type":"1","offset":"0","total":"true","limit":"30","csrf_token":""}

    操作:
        1. 获取歌曲id  https://music.163.com/weapi/cloudsearch/get/web?csrf_token= 
            1.1 {"hlpretag":"<span class=\"s-fc7\">","hlposttag":"</span>","s":"歌曲名或者歌手","type":"1","offset":"0","total":"true","limit":"30","csrf_token":""}
2. 歌曲 https://music.163.com/weapi/song/enhance/player/url?csrf_token= 2.1 {"ids":"[歌曲id]","br":128000,"csrf_token":""} 3. 歌词 https://music.163.com/weapi/song/lyric?csrf_token= 3.1 {"id":"歌曲id","lv":-1,"tv":-1,"csrf_token":""}
4. 评论 https://music.163.com/weapi/v1/resource/comments/R_SO_4_歌曲id?csrf_token=

  QQ音乐

     songid ---- 213910991
     songmid---- 004XePmv4CsaEq

    1. self.vkey_url = 'https://u.y.qq.com/cgi-bin/musicu.fcg?callback=getplaysongvkey626277975566637&g_tk=5381&jsonpCallback=getplaysongvkey626277975566637&loginUin=0&hostUin=0&format=jsonp&inCharset=utf8&outCharset=utf-8&notice=0&platform=yqq&needNewCode=0&data={"req":{"module":"CDN.SrfCdnDispatchServer","method":"GetCdnDispatch","param":{"guid":"552068528","calltype":0,"userip":""}},"req_0":{"module":"vkey.GetVkeyServer","method":"CgiGetVkey","param":{"guid":"552068528","songmid":["%s"],"songtype":[0],"uin":"0","loginflag":1,"platform":"20"}},"comm":{"uin":0,"format":"json","ct":20,"cv":0}}' % songmid

    2. self.search_url = 'https://c.y.qq.com/soso/fcgi-bin/client_search_cp?ct=24&qqmusic_ver=1298&new_json=1&remoteplace=txt.yqq.song&searchid=69457515379027970&t=0&aggr=1&cr=1&catZhida=1&lossless=0&flag_qc=0&p=1&n=20&w={}&g_tk=5381&jsonpCallback=MusicJsonCallback010045556336209849&loginUin=0&hostUin=0&format=jsonp&inCharset=utf8&outCharset=utf-8&notice=0&platform=yqq&needNewCode=0'.format(song搜索)

    3. self.lyric_url = 'https://c.y.qq.com/lyric/fcgi-bin/fcg_query_lyric.fcg?nobase64=1&musicid=%s&callback=jsonp1&g_tk=5381&jsonpCallback=jsonp1&loginUin=0&hostUin=0&format=jsonp&inCharset=utf8&outCharset=utf-8&notice=0&platform=yqq&needNewCode=0' % songid

    操作:
        1. self.search_url % 搜索关键词  获得id与mid
            ps: 
                1. mid如果是['data']['song']['list'][0]['file']下面的media_mid可能有问题
                2. 用['data']['song']['list'][0]下面的mid
                3. 可以使用try在两个mid中选择可以使用的一个,第一个不行使用第二个

        2. self.vkey_url % mid 获得vkey或者purl
            1. vkey---自己拼接
            2. purl---前面加上http://183.230.77.24/amobile.music.tc.qq.com/即可

        3. 得到的URL及是歌曲url

        4. lyric_url % id 获取歌词

  酷狗音乐

1. self.search_url = http://songsearch.kugou.com/song_search_v2?callback=jQuery11240180593475130568_1542792461367&keyword=%s&page=1&pagesize=30&userid=-1&clientver=&platform=WebFilter&tag=em&filter=2&iscorrection=1&privilege_filter=0&_=1542792461369  获得hash

2. self.hash_url = https://wwwapi.kugou.com/yy/index.php?r=play/getdata&callback=jQuery19109053666197784564_1542792630445&hash=59D0561C75CE3CE720D033B47BCE2043&album_id=8778792&_=1542792630447  获得歌曲url  歌词

操作:

    1. self.search_url % 搜索关键词  获得hash值

    2. self.hash_url % hash 获得歌词与歌曲url----ps:获取完整内容把AlbumID也替换

  代码:https://github.com/dearMrYang/python_music/tree/master/Get_music

转载于:https://www.cnblogs.com/dearMrYang/p/9997058.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值