Python 爬蟲QQ音樂
Python:3.5
歡迎加入學習交流QQ群:657341423
爬取高質量mp3
import requests
headers={'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8','Cache-Control':'no-cache','Connection':'keep-alive','Host':'dl.stream.qqmusic.qq.com','Pragma':'no-cache','Upgrade-Insecure-Requests':'1','User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.104 Safari/537.36 Core/1.53.2717.400 QQBrowser/9.6.11133.400'}
url='https://c.y.qq.com/base/fcgi-bin/fcg_music_express_mobile3.fcg?g_tk=1400579671&jsonpCallback=MusicJsonCallback1725281637681917&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0&cid=205361747&callback=MusicJsonCallback1725281637681917&uin=0&songmid=003nzgAn0jKPGF&filename=C400003nzgAn0jKPGF.m4a&guid=7286222600'
r=requests.get(url,headers=headers)
print (r.text)
text=r.text.split('(')[1].split(')')[0]
import json
get_json=json.loads(text)
a=get_json['data']['items'][0]['vkey']
print(a)
url='http://dl.stream.qqmusic.qq.com/C400003nzgAn0jKPGF.m4a?vkey=%s&guid=7286222600&uin=0&fromtag=66' %(a)
r=requests.get(url,headers=headers)
f=open('data.m4a','wb')
f.write(r.content)
f.close()
print(r.status_code)
引數修改:第一個url是songmid=003nzgAn0jKPGF,filename=C400003nzgAn0jKPGF.m4a
第二個引數是C400003nzgAn0jKPGF.m4a 和vkey
值得注意的是:第一個連結loginUin,hostUin和uin要等於第二個uin,
兩者guid要相等
獲取歌單資訊
import requests
#獲取全部分類歌單的categoryId
#https://c.y.qq.com/splcloud/fcgi-bin/fcg_get_diss_tag_conf.fcg?g_tk=5381&jsonpCallback=getPlaylistTags&loginUin=0&
# hostUin=0&format=jsonp&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0
#國語歌單的歌單列表資訊
#https://c.y.qq.com/splcloud/fcgi-bin/fcg_get_diss_by_tag.fcg?rnd=0.07499648392820268&g_tk=5381&jsonpCallback=getPlaylist&
# loginUin=0&hostUin=0&format=jsonp&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0&categoryId=165&sortId=5&sin=0&ein=29
#熱門歌單的歌單列表資訊
url= 'https://c.y.qq.com/splcloud/fcgi-bin/fcg_get_diss_by_tag.fcg?rnd=0.04378599143046411&g_tk=5381&jsonpCallback=getPlaylist&' \
'loginUin=0&hostUin=0&format=jsonp&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0&categoryId=10000000&sortId=5&sin=0&ein=29'
#categoryId為分類標籤
#sin為開始,ein為結束,這url代表第一頁,30~59代表第二頁
headers={'referer':'https://y.qq.com/portal/playlist.html',
'user-agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36'}
r = requests.get(url,headers=headers)
print (r.text)
相關文章
- Python爬蟲如何去抓取qq音樂的歌手資料?Python爬蟲
- 【Python爬蟲實戰】使用Selenium爬取QQ音樂歌曲及評論資訊Python爬蟲
- python 爬蟲 1 爬取酷狗音樂Python爬蟲
- Python爬蟲實踐--爬取網易雲音樂Python爬蟲
- Python爬蟲實踐-網易雲音樂Python爬蟲
- python爬蟲:瞭解JS加密爬取網易雲音樂Python爬蟲JS加密
- python爬取qq音樂歌手排行熱度資料Python
- Python 爬蟲獲取網易雲音樂歌手資訊Python爬蟲
- python爬蟲之JS逆向某易雲音樂Python爬蟲JS
- 如何用Python網路爬蟲爬取網易雲音樂歌曲Python爬蟲
- Python爬蟲全網搜尋並下載音樂Python爬蟲
- Python 爬蟲獲取網易雲音樂歌手歌詞Python爬蟲
- Python爬蟲:逆向分析網易雲音樂加密引數Python爬蟲加密
- 利用Python網路爬蟲抓取網易雲音樂歌詞Python爬蟲
- QQ音樂音質加密加密
- music-api-next:一款支援網易、xiami和QQ音樂的JS爬蟲庫APIJS爬蟲
- Python抓取QQ音樂歌單並分析Python
- Python從網易雲音樂、QQ 音樂、酷狗音樂等搜尋和下載歌曲Python
- Python 爬取百度音樂Python
- 第一彈:puppeteer爬蟲小demo —— 網易雲音樂爬蟲
- QQ音樂api介面梳理API
- 【Python學習】爬蟲爬蟲爬蟲爬蟲~Python爬蟲
- Python爬蟲之js加密破解,抓取網易雲音樂評論生成詞雲Python爬蟲JS加密
- Python逆向爬蟲入門教程: 千千音樂加密引數 sign 逆向解析Python爬蟲加密
- 用Python爬取網易雲音樂歌曲Python
- 【python爬蟲】python爬蟲demoPython爬蟲
- 微信小程式-仿QQ音樂微信小程式
- python爬蟲學習:爬蟲QQ說說並生成詞雲圖,回憶滿滿Python爬蟲
- 網易雲音樂評論爬蟲(2):歌曲的全部評論爬蟲
- 如何使用 python 爬取酷我線上音樂Python
- Python爬取網易雲音樂歌單歌曲Python
- python爬蟲---網頁爬蟲,圖片爬蟲,文章爬蟲,Python爬蟲爬取新聞網站新聞Python爬蟲網頁網站
- jQuery實現高仿QQ音樂jQuery
- Python爬蟲:通過做專案,小編了解了酷狗音樂的加密過程Python爬蟲加密
- 一篇文章教會你使用Python網路爬蟲下載酷狗音樂Python爬蟲
- Python逆向爬蟲入門教程: 網易雲音樂加密引數 params & encSecKey 逆向解析Python爬蟲加密
- 音樂App評測之QQ音樂篇:音樂圈多樣演算法差評APP演算法
- python爬蟲:批量下載qq空間裡的照片(一)Python爬蟲