The code is for learning and communication only , Do not use for illegal purposes , Encryption key not provided , For reference only
import hashlib
import requests
import json
import random
import execjs
from sign import getSign,getSessionId,getShumeiId
tunnel = "
username = ""
password = ""
proxies = {
"http": "http://%(user)s:%(pwd)[email protected]%(proxy)s/" % {
"user": username, "pwd": password, "proxy": tunnel},
"https": "http://%(user)s:%(pwd)[email protected]%(proxy)s/" % {
"user": username, "pwd": password, "proxy": tunnel}
}
def getProductDetail(spuId):
try:
url = "https://app.dewu.com/api/v1/h5/index/fire/flow/product/detail"
data = {
"spuId": str(spuId),
"productSourceName": "",
"propertyValueId": "",
"sourceName": "shareDetail"
}
data['sign'] = getSign(data)
headers = {
"AppId": "h5",
"appVersion": "4.4.0",
"Content-Type": "application/json",
"Host": "app.dewu.com",
"Origin": "https://m.dewu.com",
"platform": "h5",
"Referer": "https://m.dewu.com/",
"sec-ch-ua": '"Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"',
"sec-ch-ua-mobile": "?0",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-site",
"sessionid": getSessionId(),
"shumeiId": getShumeiId(),
"User-Agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.81 Mobile Safari/537.36",
}
resp = requests.post(url, data=json.dumps(data), proxies=proxies, headers=headers, timeout=8)
print("request start--------------------------------")
print("proxies :" + str(proxies))
print("status_code :" + str(resp.status_code))
print("data :" + str(resp.json()))
print("request end--------------------------------")
except Exception as e:
pass
def queryBuyNowInfo(spuId):
url = "https://app.dewu.com/api/v1/h5/inventory/price/h5/queryBuyNowInfo"
data = {
"spuId": str(spuId)}
data['sign'] = getSign(data)
headers = {
"AppId": "h5",
"appVersion": "4.4.0",
"Content-Type": "application/json",
"Host": "app.dewu.com",
"Origin": "https://m.dewu.com",
"platform": "h5",
"Referer": "https://m.dewu.com/",
"sec-ch-ua": '"Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"',
"sec-ch-ua-mobile": "?0",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-site",
"sessionid": getSessionId(),
"shumeiId": getShumeiId(),
"User-Agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.81 Mobile Safari/537.36",
}
resp = requests.post(url, data=json.dumps(data), proxies=proxies, headers=headers, timeout=8)
print("request start--------------------------------")
print("proxies :" + str(proxies))
print("status_code :" + str(resp.status_code))
print("data :" + str(resp.json()))
print("request end--------------------------------")
def run():
spuId = "28592"
queryBuyNowInfo(spuId)
getProductDetail(spuId)
if __name__ == '__main__':
run()