initial commit

master
Conduitry 4 months ago
commit 3cb9d6f0e8
  1. 1
      .gitignore
  2. 2
      docker.sh
  3. 14
      index.js
  4. 6
      package.json

1
.gitignore vendored

@ -0,0 +1 @@
/node_modules/

@ -0,0 +1,2 @@
#!/bin/sh
docker run --rm --volume "$PWD":/app mcr.microsoft.com/playwright:v1.22.2 node /app $1

@ -0,0 +1,14 @@
import { firefox } from 'playwright';
const browser = await firefox.launch();
const context = await browser.newContext();
const page = await context.newPage();
await page.goto(`https://${process.argv[2]}`);
await new Promise(res => setTimeout(res, 5000));
const cf_clearance = (await context.cookies()).find(({ name }) => name === 'cf_clearance').value;
const user_agent = await page.evaluate('navigator.userAgent');
console.log(JSON.stringify({ headers: { cookie: `cf_clearance=${cf_clearance}`, 'user-agent': user_agent } }));
await browser.close();

@ -0,0 +1,6 @@
{
"type": "module",
"dependencies": {
"playwright": "1.22.2"
}
}
Loading…
Cancel
Save