-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply cf cookie for curl GET requests
Fix #52 It's getting... complicated ¯\_(ツ)_/¯
- Loading branch information
Showing
4 changed files
with
99 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,6 @@ node_modules | |
package-lock.json | ||
.editorconfig | ||
.* | ||
cookie.json | ||
bin/*.json | ||
user-agent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env node | ||
|
||
process.removeAllListeners('warning'); | ||
const puppeteer = require('puppeteer-extra'); | ||
const StealthPlugin = require('puppeteer-extra-plugin-stealth'); | ||
puppeteer.use(StealthPlugin()); | ||
const cPath = process.argv[2]; | ||
const url = process.argv[3]; | ||
const ua = process.argv[4]; | ||
|
||
(async() => { | ||
const browser = await puppeteer.launch({executablePath: cPath, headless: true}); | ||
const page = await browser.newPage(); | ||
await page.setUserAgent(ua); | ||
await page.goto(url, {timeout: 15000, waitUntil: 'domcontentloaded'}); | ||
await page.waitForSelector(".content-wrapper"); | ||
const cookie = await page.cookies(); | ||
console.log(JSON.stringify(cookie)); | ||
await browser.close(); | ||
})(); |