1
Fork 0

initial commit

This commit is contained in:
Conduitry 2022-06-07 21:05:58 -04:00
commit 3cb9d6f0e8
4 changed files with 23 additions and 0 deletions

1
.gitignore vendored Normal file
View File

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

2
docker.sh Executable file
View File

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

14
index.js Normal file
View File

@ -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();

6
package.json Normal file
View File

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