【安卓逆向】迷谷音乐的音乐接口分析
闲来无事,逆向一下音乐软件吧
软件挂上Justtrustme模块,charles代理挂上,开始搜索,抓包
不是哥们,歌曲url摆我脸上,加密都不加密一下的吗,直接python开梭
import requests
import time
timestamp = int(time.time() * 1000)
url = "http://app.c.nf.migu.cn/MIGUM2.0/strategy/listen-url/v2.4"
headers = {
"gsm": "",
"randomsessionkey": "000000",
"mgm-user-agent": "Redmi Note 8 Pro",
"User-Agent": "Mozilla/5.0 (Linux; U; Android 9; zh-cn; Redmi Note 8 Pro Build/PPR1.180610.011) AppleWebKit/533.1 (KHTML, like Gecko) Version/5.0 Mobile Safari/533.1",
"channel": "0146931",
"language": "Chinese",
"ua": "Android_migu",
"mode": "android",
"appId": "music",
"brand": "Redmi",
"recommendstatus": "1",
"version": "7.41.8",
"mgm-Network-type": "04",
"mgm-network-operators": "01",
"mgm-Network-standard": "01",
"Accept-Language": "zh-CN,zh;q=0.8",
"subchannel": "",
"HWID": "",
"OAID": "",
"platform": "Redmi Note 8 Pro",
"userLevel": "4",
"osVersion": "Android 9",
"pkgName": "cmccwm.mobilemusic",
"verify": "verify",
"logId": "1714996870709",
"os": "Android 9",
"token": "848401000134020058526B4D355130553052446734516B457952454977517A524740687474703A2F2F70617373706F72742E6D6967752E636E2F6E303030312F4039393538623562663737343234333833393630616436313830643562333939610300040104811E0400063232303032340500164E6A51784F5756695A5455794F5463794E4749795977FF0020EA2D08CF840A637AF791B10AA53E279ED55F6E55C300D44A10A3F6E21FA5E6E9",
"Connection": "keep-alive",
"Host": "app.c.nf.migu.cn",
"Accept-Encoding": "gzip",
"signVersion": "V004",
"sign": "06689DDC2858127819B58D6A4F1634B8",
"timestamp": str(timestamp),
"aversionid": "DF94878D9AA2AB8F639A8BA4D0AC9D74C8C6858D999DA7BA6AC284A18B80986EC596B8898EA9D3BD6B948F9D8C819D7399DFD0D397A4A39197C3BCA286829E7397C586BADDECEE896B93859E8A8195739796828991A5EE8969928BA68D82A07597988B8B",
"Pragma": "no-cache",
"Cache-Control": "no-cache",
}
params = {
"albumId": "1140538141",
"lowerQualityContentId": "600910000008056506",
"netType": "01",
"resourceType": "2",
"songId": "5460",
"toneFlag": "PQ",
}
response = requests.get(url, headers=headers, params=params).json()
#print(response)
singer_name = response["data"]["song"]["singerList"][0]["name"]
song_name = response["data"]["song"]["songName"]
song_url = response["data"]["url"]
print("歌手==>>", singer_name)
print("歌名==>>", song_name)
print("歌曲地址==>>", song_url)
输出结果
经过一通分析,接口信息分析完毕:
import requests
import time
timestamp = int(time.time() * 1000)
def get_song_info(url,headers):
res=requests.get(url,headers=headers).json()
#print(res)
#获取全部歌曲信息
for item in res["data"]["contents"][0]["contents"]:
song_name = item["txt"]
content_id = item["resId"]
abbum_name = item["txt3"] #专辑名
album_id = item["songItem"]["albumId"]
song_id = item["songItem"]["songId"]
print("专辑名:", abbum_name)
print("专辑id==>>", album_id)
print("歌曲名:", song_name)
print("内容id==>>", content_id)
print("歌曲id==>>", song_id)
params = {
"albumId": str(album_id),
"lowerQualityContentId": str(content_id),
"netType": "01",
"resourceType": "2",
"songId": str(song_id),
"toneFlag": "PQ",
}
get_song_data(url_song,headers,params)
def get_song_data(url,headers,params):
response=requests.get(url,headers=headers,params=params).json()
#print(response)
singer_name = response["data"]["song"]["singerList"][0]["name"]
song_name = response["data"]["song"]["songName"]
song_url = response["data"]["url"]
print("歌手==>>", singer_name)
print("歌名==>>", song_name)
print("歌曲地址==>>", song_url)
#url = "http://app.c.nf.migu.cn/MIGUM2.0/strategy/listen-url/v2.4"
headers = {
"gsm": "",
"randomsessionkey": "000000",
"mgm-user-agent": "Redmi Note 8 Pro",
"User-Agent": "Mozilla/5.0 (Linux; U; Android 9; zh-cn; Redmi Note 8 Pro Build/PPR1.180610.011) AppleWebKit/533.1 (KHTML, like Gecko) Version/5.0 Mobile Safari/533.1",
"channel": "0146931",
"language": "Chinese",
"ua": "Android_migu",
"mode": "android",
"appId": "music",
"brand": "Redmi",
"recommendstatus": "1",
"version": "7.41.8",
"mgm-Network-type": "04",
"mgm-network-operators": "01",
"mgm-Network-standard": "01",
"Accept-Language": "zh-CN,zh;q=0.8",
"subchannel": "",
"HWID": "",
"OAID": "",
"platform": "Redmi Note 8 Pro",
"userLevel": "4",
"osVersion": "Android 9",
"pkgName": "cmccwm.mobilemusic",
"verify": "verify",
"logId": "1714996870709",
"os": "Android 9",
"token": "848401000134020058526B4D355130553052446734516B457952454977517A524740687474703A2F2F70617373706F72742E6D6967752E636E2F6E303030312F4039393538623562663737343234333833393630616436313830643562333939610300040104811E0400063232303032340500164E6A51784F5756695A5455794F5463794E4749795977FF0020EA2D08CF840A637AF791B10AA53E279ED55F6E55C300D44A10A3F6E21FA5E6E9",
"Connection": "keep-alive",
"Host": "app.c.nf.migu.cn",
"Accept-Encoding": "gzip",
"signVersion": "V004",
"sign": "06689DDC2858127819B58D6A4F1634B8",
"timestamp": str(timestamp),
"aversionid": "DF94878D9AA2AB8F639A8BA4D0AC9D74C8C6858D999DA7BA6AC284A18B80986EC596B8898EA9D3BD6B948F9D8C819D7399DFD0D397A4A39197C3BCA286829E7397C586BADDECEE896B93859E8A8195739796828991A5EE8969928BA68D82A07597988B8B",
"Pragma": "no-cache",
"Cache-Control": "no-cache",
}
# params = {
# "albumId": "1000001920",
# "lowerQualityContentId": "600902000006889102",
# "netType": "01",
# "resourceType": "2",
# "songId": "3790946",
# "toneFlag": "PQ",
# }
url_song = "http://app.c.nf.migu.cn/MIGUM2.0/strategy/listen-url/v2.4"
singer_id = input("请输入歌手id:")
page=input("请输入页数:")
for num in range(1,int(page)):
url_song_info=f"https://app.c.nf.migu.cn/bmw/singer/song/v1.0?pageNo={num}&singerId={singer_id}&type=1"
params=get_song_info(url_song_info,headers)
#print(response)
#get_song_data(url,headers,params)
等我有时间再完善一下脚本