Browser extension that outputs a cookie JSON file that can be imported by Puppeteer or cheerio-httpcli.
By clicking on the extension icon, you can save the cookie information stored on the currently open page as a JSON file.
The saved JSON file can be used as follows.
const puppeteer = require('puppeteer');
.
.
.
const browser = await puppeteer.launch({ headless: true });
const page = await browser.newPage();
const cookies = JSON.parse(fs.readFileSync(<Exported cookie JSON file>, 'utf-8'));
for (const cookie of cookies) {
await page.setCookie(cookie);
}
await page.goto(...);
const client = require('cheerio-httpcli');
.
.
.
const cookies = JSON.parse(fs.readFileSync(<Exported cookie JSON file>, 'utf-8'));
client.importCookies(cookies);
client.fetch(...);
© 2020 ktty1220