文档中心

京东H5ST

京东全平台H5ST参数生成

Endpoint URL
https://www.apiparse.com/api/h5st
HTTP Method
POST
Pricing Tier
1 Credits / Call

请求参数说明

参数名称 必填 类型 描述 示例值
pin Required string

用户id

jd_xxx
appId Required string

h5st第三段,5位字符串

01a47
ua Required string

user-agent

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:146.0) Gecko/20100101 Firefox/146.0
query Required object

xcx需要传递完整的form参数

{ "appid": "search-pc-java", "client": "pc", "clientVersion": "1.0.0", "cthr": "1", "loginType": "3", "keyword": "iphone", "functionId": "pc_search_searchWare", "body": "{}" }
version Optional string

latest: 默认, xcx: 小程序

latest
token Required string

您的 API 访问令牌,用于计费认证

sk-xxxx...

请求 JSON 示例

Content-Type: application/json
{
  "pin": "jd_xxx",
  "appId": "01a47",
  "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:146.0) Gecko/20100101 Firefox/146.0",
  "query": {
    "appid": "search-pc-java",
    "client": "pc",
    "clientVersion": "1.0.0",
    "cthr": "1",
    "loginType": "3",
    "keyword": "iphone",
    "functionId": "pc_search_searchWare",
    "body": "{}"
  },
  "version": "latest",
  "token": "YOUR_ACCESS_TOKEN"
}

响应 JSON 示例

HTTP 200 OK
{
  "success": true,
  "data": {
    "appid": "pc-rate-qa",
    "body": "{}",
    "client": "pc",
    "clientVersion": "1.0.0",
    "functionId": "getCommentListPage",
    "t": 1771915060139,
    "_stk": "appid,body,client,clientVersion,functionId,t",
    "_ste": 2,
    "h5st": "xxxx"
  }
}

多语言集成代码

node Integration
const token = ""; // 请联系管理员获取token
let ua = `Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:146.0) Gecko/20100101 Firefox/146.0`
let referer = 'https://item.jd.com/'
let cookie = `pin=xxxx`
let h5stParams = `appid=pc-item-soa&functionId=pc_detailpage_wareBusiness&client=pc&clientVersion=1.0.0&body={}`;
let query = Object.fromEntries(new URLSearchParams(h5stParams).entries());
let pin = cookie.match(/pin\s*=\s*([^\;]+)/)[1]
fetch(`https://www.apiparse.com/api/token/${token}/h5st`, {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        pin,
        query,
        ua,
        appId: 'fb5df' //如果h5stParams中不带h5st,必须带此参数
    })
}).then(response => response.json()).then(data => {
    let url = `https://api.m.jd.com/?${new URLSearchParams({...query,...data.data}).toString()}`
    fetch(url, {
        headers: {
            'user-agent': ua,
            Cookie: cookie,
            referer
        },
    }).then(response => response.json()).then(data => console.log(data))
});