Giter Site home page Giter Site logo

puffhub / puppeteer-pro Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fast-facts/puppeteer-pro

0.0 0.0 0.0 2.72 MB

A simple puppeteer wrapper to enable useful plugins with ease

License: MIT License

TypeScript 44.02% JavaScript 55.92% Shell 0.06%

puppeteer-pro's Introduction

Puppeteer-Pro

A simple puppeteer wrapper to enable useful plugins with ease

Installation

Requires node v10 and higher

npm install puppeteer-pro

Quickstart

Puppeteer-Pro can do all the same things as puppeteer, just now with plugins!

// Puppeteer-Pro is a drop-in replacement for puppeteer
const PuppeteerPro = require('puppeteer-pro');

// Enable the 'avoidDetection' plugin to prevent headless detection
PuppeteerPro.avoidDetection();

// Enable the 'solveRecaptchas' plugin to solve Google's recaptchas (remember to provide a wit.api API access token)
const solver = PuppeteerPro.solveRecaptchas('WIT_AI_ACCESS_TOKEN');

(async () => {
  const browser = await PuppeteerPro.launch();
  const page = await browser.newPage();
  
  console.log('Testing the ๐Ÿฑโ€๐Ÿ‘ค avoidDetection ๐Ÿฑโ€๐Ÿ‘ค plugin..')
  await page.goto('https://arh.antoinevastel.com/bots/areyouheadless');
  await page.screenshot({ path: 'are-you-headless.png' });
  
  console.log('Testing the recaptcha solver..')
  await page.goto('https://www.google.com/recaptcha/api2/demo');
  await solver.solveRecaptcha(page);
  await page.screenshot({ path: 'is-recaptcha-solved.png' });

  await browser.close();
})();

Passive Improvements

  • There can be multiple request interception handlers for the same request. In such cases, the resulting response will prioritize respond, followed by abort, followed by continue. For example:
    • If amongst 5 handlers, respond is called 1 time, abort is called 2 times and continue is called 2 times, the result will be respond. This will occur after the first respond is called and not when all handlers are finished.
    • If amongst 5 handlers, abort is called 1 time and continue is called 4 times, the result will be abort. This will occur after all handlers are finished.
    • If amongst 5 handlers, all handlers call continue, the result will be continue. This will occur after all handlers are finished.

Optional Built-in Plugins

Anonymize User Agent

  • Anonymize the user-agent across all pages

Avoid Detection

  • Multiple techniques to combat headless browser detection

Block Resources

  • Block any resource type from loading
  • Can be used to speed up loading websites by blocking style sheets and images

Disable Dialogs

  • Block dialogs from popping up and stopping execution

Manage Cookies

  • Save and load cookies across sessions
  • Supports multiple profiles and switching between profiles

Solve Recaptcha

  • Solve Google's reCAPTCHA v2
  • Requires a FREE wit.ai access token

puppeteer-pro's People

Contributors

probot-auto-merge[bot] avatar dependabot[bot] avatar dependabot-preview[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.