1 接口地址
请求参数里面有一个code需要破解,直接搜索code比较困难,我们再这里搜索platform
搜索到platform对应的文件
code=r, r 有一个函数o()加密我们可以测试o()加密算法
可以看到这个是一个md5算法(c4ca4238a0b923820dcc509a6f75849b)这个是字符串'1'的md5加密后的字符串
因此上述的代码使用MD5 js算法的代码如下
const CryptoJS = require('crypto-js')
function MD5Test() {
n = Date.now().toString()
text = n + "9527" + n.substr(0, 6)
return CryptoJS.MD5(text).toString()
}
我们可以永curl转为request请求
最终py代码如下 需要把timestamp单独提取出来
import requests
import hashlib
import time
n = str(int(time.time()))
def MD5Test():
text = n + "9527" + n[:6]
return hashlib.md5(text.encode()).hexdigest()
headers = {
"authority": "api.mytokenapi.com",
"accept": "application/json, text/plain, */*",
"accept-language": "zh-CN,zh;q=0.9",
"cache-control": "no-cache",
"content-type": "application/x-www-form-urlencoded;charset=utf-8",
"origin": "https://www.mytokencap.com",
"pragma": "no-cache",
"referer": "https://www.mytokencap.com/",
"sec-ch-ua": "^\\^Google",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "^\\^Windows^^",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "cross-site",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
}
url = "https://api.mytokenapi.com/ticker/currencylistforall"
params = {
"pages": "2,1",
"sizes": "100,100",
"subject": "market_cap",
"language": "en_US",
"timestamp": n,
"code": MD5Test(),
"platform": "web_pc",
"v": "0.1.0",
"legal_currency": "USD",
"international": "1"
}
response = requests.get(url, headers=headers, params=params)
print(response.text)
print(response)