fix(bikegear): add proxy support to Playwright browser context
BIKEGEAR_PROXY_URL now applies to the browser-mode fetcher too. The VPS IP is permanently blocked at Cloudflare network level — a residential proxy is the only remaining solution. Set BIKEGEAR_PROXY_URL=http://user:pass@host:port. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
76bd69a92f
commit
19fd7f16ea
@ -69,6 +69,16 @@ async function getBrowserContext() {
|
||||
const { chromium } = require("playwright");
|
||||
await fs.mkdir(BROWSER_PROFILE_PATH, { recursive: true });
|
||||
|
||||
const proxyOpts = {};
|
||||
if (PROXY_URL) {
|
||||
const u = new URL(PROXY_URL);
|
||||
proxyOpts.proxy = {
|
||||
server: `${u.protocol}//${u.host}`,
|
||||
...(u.username ? { username: decodeURIComponent(u.username), password: decodeURIComponent(u.password) } : {}),
|
||||
};
|
||||
console.log(`[BIKEGEAR] Browser using proxy: ${u.protocol}//${u.host}`);
|
||||
}
|
||||
|
||||
_context = await chromium.launchPersistentContext(BROWSER_PROFILE_PATH, {
|
||||
headless: true,
|
||||
args: [
|
||||
@ -80,6 +90,7 @@ async function getBrowserContext() {
|
||||
locale: "en-US",
|
||||
viewport: { width: 1280, height: 800 },
|
||||
extraHTTPHeaders: { "Accept-Language": "en-US,en;q=0.9" },
|
||||
...proxyOpts,
|
||||
});
|
||||
|
||||
// Apply stealth patches to every new page opened in this context
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user