Files
opencli/test_subtitle.ts
T
jackwener e64fc65554 feat: add Bilibili subtitle adapter with Wbi signing & explore fuzzing
- New: src/clis/bilibili/subtitle.ts - cascading BVID→CID→subtitle fetch
  using apiGet with automatic Wbi signature (w_rid)
- Enhanced: src/explore.ts - added INTERACT_FUZZ_JS for interactive
  API discovery via simulated clicks (--auto flag)
- Enhanced: src/explore.ts - empty-value score penalty for anti-bot detection
- Fixed: src/main.ts - restored explore command syntax, added --auto option
- Updated: CLI-CREATOR.md - cascading requests & anti-bot sections
2026-03-15 18:03:25 +08:00

34 lines
974 B
TypeScript

import { chromium } from 'playwright';
async function main() {
const browser = await chromium.launch({ headless: true });
const page = await browser.newPage();
const apis: string[] = [];
page.on('response', async (res) => {
const url = res.url();
if (url.includes('subtitle') || url.includes('player/v2') || url.includes('x/player/wbi/v2')) {
console.log("Found subtitle API candidate:", url);
}
});
console.log("Navigating to video...");
await page.goto('https://www.bilibili.com/video/BV1K3411r7F9');
await page.waitForTimeout(5000);
// Try to find subtitle info in __INITIAL_STATE__
const initialState = await page.evaluate(() => {
return (window as any).__INITIAL_STATE__;
});
if (initialState) {
console.log("Found __INITIAL_STATE__ exists!");
// check if there's bvid or aid
console.log("BVID:", initialState.bvid);
console.log("AID:", initialState.aid);
}
await browser.close();
}
main();