678 字
3 分钟
羽毛球预约微信小程序网络请求学习
用 Fiddler 抓包 + 用 JavaScript 发包的主线路实战
目标
- 在 Windows 上用 Fiddler 抓到微信小程序真实接口请求
- 提取关键参数(token、scheduleId、date、fingerprint、timestamp)
- 用 JavaScript 在本机复现发包(预约)
一、准备环境(Windows)
- 安装 Fiddler Classic
- 打开 Fiddler → Tools → Options
- Connections:勾选 Allow remote computers to connect(如需抓手机)
- HTTPS:勾选 Decrypt HTTPS traffic → 安装并信任根证书
- 如抓手机流量:手机与电脑同一 Wi‑Fi → 手机 Wi‑Fi 代理指向 电脑IP:8888 → 手机浏览器访问
http://<电脑IP>:8888安装证书并信任
二、抓取小程序请求
-
在 Windows 微信中打开目标小程序,进入预约页面进行一次真实操作
-
回到 Fiddler,过滤 Host 为
wechat.njupt.edu.cn -
找到真实的接口请求(不是 “Tunnel to …”),重点关注:
- 列表/时段:
- GET
/mini_program/v4/venue/user/time/display/{type}?date=YYYY-MM-DD
- GET
- 预约下单:
- POST
/mini_program/v4/venue/user/booking/pomelo/v2/{scheduleId}
- POST
- 列表/时段:
-
记录关键字段
- Headers:
token、Content-Type(表单)、建议带User-Agent、Referer - Body:
date=YYYY-MM-DD&fingerprint=<hex>×tamp=<ms> - 路径参数:
{scheduleId}来自时段/列表返回的stadiumInfos[].id
- Headers:
三、提取参数的主线
- scheduleId:从“时段/列表接口”的响应 JSON 里取
stadiumInfos[].id - token:从下单请求的请求头中复制(JWT)
- date / fingerprint / timestamp:从下单请求的表单中复制(timestamp 可实时生成)
四、用 JavaScript 复现发包(Node.js)
axios
const axios = require('axios');
const BASE = 'https://wechat.njupt.edu.cn/mini_program/v4';const TOKEN = '<你的JWT>'; // 从 Fiddler 复制const FINGERPRINT = '<你的fingerprint>'; // 从 Fiddler 复制const UA = 'Mozilla/5.0 ... MiniProgramEnv/Windows';const REFERER = 'https://servicewechat.com/wx3bb0b520a9e56a99/316/page-frame.html';
async function book(scheduleId, date) { const url = `${BASE}/venue/user/booking/pomelo/v2/${scheduleId}`; const body = new URLSearchParams({ date, fingerprint: FINGERPRINT, timestamp: Date.now().toString() }).toString();
const res = await axios.post(url, body, { headers: { token: TOKEN, 'Content-Type': 'application/x-www-form-urlencoded', 'User-Agent': UA, Referer: REFERER } // 如需通过本机代理调试,可加: // , proxy: { host: '127.0.0.1', port: 8888, protocol: 'http' } }); return res.data; // JSON,含 order/detail}
(async () => { // 假设你在 Fiddler/列表接口中找到了目标条目的 scheduleId const scheduleId = 2666; const date = '2025-09-18'; const ret = await book(scheduleId, date); console.log(ret);})();五、最小 cURL 校验(验证“拉取列表/时段展示”)
- 将
<你的JWT>与日期替换为实际值:
curl.exe "https://wechat.njupt.edu.cn/mini_program/v4/venue/user/time/display/1?date=2025-09-18" -H "token: <你的JWT>" -H "xweb_xhr: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090c11)XWEB/14185" -H "Referer: https://servicewechat.com/wx3bb0b520a9e56a99/316/page-frame.html"- 返回 JSON 中的
data[].timeFields[].stadiumInfos[].id即为各个可预约条目的scheduleId,用于后续下单。
六、目前的问题
fingerprint貌似和时间是绑定的,但是我并没有找到fingerprint的生成逻辑,所以无法发送预约请求。
已解决,感觉在AI的帮助下,只要学会问问题,就能解决大部分问题。
七、主线路回顾(一句话版)
- Fiddler 开启 HTTPS 解密 → 在微信里操作预约 → 在 Fiddler 里找到真实下单请求 → 记录 token、scheduleId、date、fingerprint、UA、Referer → 用 axios 发起 POST 复现预约;用一行 curl 验证 GET 时段展示返回是否正确。
羽毛球预约微信小程序网络请求学习
https://mizuki.mysqil.com/posts/微信小程序/