|
发表于 2024-8-7 09:23:51
|
显示全部楼层
浙江省嘉兴市
import execjs
import hashlib
import time
from curl_cffi import requests
import json
requests = requests.Session()
# proxy_ip = "123.182.58.171:8089"
# proxies = {"http": proxy_ip}
stamp = int(round(time.time()*1000))
time_roud = "11:00"
keyword = "茉莉奶绿销量突破3000万杯"
#
def generate_md5(text):
md5 = hashlib.md5()
md5.update(text.encode("utf-8"))
return md5.hexdigest()
text = f'marketingId=1816854086004391938&round={time_roud}&s=2&secretword={keyword}&stamp={stamp}c274bac6493544b89d9c4f9d8d542b84'
sgin = generate_md5(text)
print("md5值为:",sgin)
# 'https://******/api/v1/h5/marketing/secretword/confirm{"marketingId":"1816854086004391938","round":"00:36","secretword":"safasf","sign":"0e4659c0ee96a47821890c8d48a37251","s":2,"stamp":1722434578916}'
N = 'https://mxsa.mxbc.net/api/v1/h5/marketing/secretword/confirm{"marketingId":"1816854086004391938","round":"'+ time_roud +'","secretword":"'+keyword+'","sign":"'+sgin+'","s":2,"stamp":'+str(stamp)+'}'
with open('1.js', encoding='utf-8') as f:
js_code = f.read()
type__1286 = execjs.compile(js_code).call("Get_type_", N)
type__1286 = type__1286.replace("+", "%2B").replace("=","%3D")
params = {
"type__1286": type__1286
}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090a13) XWEB/8555",
"Accept": "application/json, text/plain, */*",
"Access-Token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ3eG1pbmlfMTgxOTkzNzc3NDA1Nzc3OTIwMiIsImlhdCI6MTcyMjc0MTk1Mn0.MPtuFgcrVN8vEwqX0oMLp-ztQaQ295pF-96f3oV2EMe6_pX6e7dbmCrPn0-f64y1Z4UV9jfdRzxsxoLO2B1DEg",
"Content-Type": "application/json;charset=UTF-8",
"origin": "https://mxsa-h5.mxbc.net",
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'csame-site',
"Referer": "https://mxsa-h5.mxbc.net/",
"Accept-Language": "zh-CN,zh;q=0.9",
}
url = f"https://mxsa.mxbc.net/api/v1/h5/marketing/secretword/confirm?type__1286={type__1286}"
data = '{"marketingId":"1816854086004391938","round":"'+ time_roud +'","secretword":"'+keyword+'","sign":"'+sgin+'","s":2,"stamp":'+str(stamp)+'}'
res = requests.post(url,headers=headers,data=data,impersonate="chrome100")
print(res.text) |
|