Skip to content

Browser extension that outputs a cookie JSON file that can be imported by Puppeteer

Notifications You must be signed in to change notification settings

ktty1220/export-cookie-for-puppeteer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

icon Export cookie JSON file for Puppeteer

Browser extension that outputs a cookie JSON file that can be imported by Puppeteer or cheerio-httpcli.

Install

Usage

By clicking on the extension icon, you can save the cookie information stored on the currently open page as a JSON file.

image1 image2

The saved JSON file can be used as follows.

Puppeteer

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

cheerio-httpcli

const client = require('cheerio-httpcli');
  .
  .
  .
const cookies = JSON.parse(fs.readFileSync(<Exported cookie JSON file>, 'utf-8'));
client.importCookies(cookies);
client.fetch(...);

License

MIT license

© 2020 ktty1220

About

Browser extension that outputs a cookie JSON file that can be imported by Puppeteer

Resources

Stars

Watchers

Forks

Packages

No packages published