qq 也可以获取支付二维码 成功微信支付了

This commit is contained in:
yml2213
2026-08-12 21:41:26 +08:00
parent 4c978b923b
commit d610933f87
7 changed files with 286 additions and 18 deletions
@@ -0,0 +1,46 @@
import fs from 'node:fs';
import { JSDOM, ResourceLoader } from 'jsdom';
import { patchEnvironment } from './scripts/jsdom-patch-env.mjs';
const ROOT = '/Users/yml/codes/douyu_login_py';
const out = ROOT + '/data/yyb-worker-dev/49684f85543d4fd1/jsdom-order';
const goodsUrl = JSON.parse(fs.readFileSync(`${out}/device-fp.json`, 'utf8')).goods_url;
const captured = [];
const requests = [];
const dom = new JSDOM(fs.readFileSync(`${out}/goods.html`, 'utf8'), {
url: goodsUrl,
referrer: 'https://z.iwan.yyb.qq.com/',
pretendToBeVisual: true,
runScripts: 'dangerously',
resources: new ResourceLoader(),
beforeParse(window) {
patchEnvironment(window);
const NativeXHR = window.XMLHttpRequest;
window.XMLHttpRequest = class extends NativeXHR {
open(method, url, async = true) { this.__m = method; this.__u = String(url); return super.open(method, url, async); }
send(body) {
const name = this.__u.includes('web_save') ? 'web_save'
: this.__u.includes('web_page_info') ? 'web_page_info'
: this.__u.includes('fp-behv') ? 'fp_behv' : 'other';
requests.push({ name, url: this.__u.slice(0, 120), bodyLen: String(body || '').length });
if (name === 'web_save') captured.push(String(body || ''));
this.readyState = 4; this.status = 200;
this.responseText = '{"ret":0,"msg":"","info":{}}';
if (typeof this.onreadystatechange === 'function') this.onreadystatechange();
if (typeof this.onload === 'function') this.onload();
}
};
},
});
await new Promise(r => setTimeout(r, 15000));
console.log('=== 页面发出的 XHR ===');
for (const r of requests) console.log(' ', r.name, '|', r.url, '| bodyLen:', r.bodyLen);
console.log('=== web_save body 捕获:', captured.length ? 'YES len=' + captured[0].length : 'NO');
console.log('=== 页面按钮 ===');
const btns = dom.window.document.querySelectorAll('[class*="btn"],[class*="confirm"],[class*="submit"],button');
for (const b of btns) {
const t = (b.textContent || '').trim().replace(/\s+/g, ' ');
if (t && t.length < 40 && b.offsetParent !== null) console.log(' btn:', t.slice(0, 30));
}