New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

puppeteer-real-browser

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

puppeteer-real-browser

This package is designed to bypass puppeteer's bot-detecting captchas such as Cloudflare. It acts like a real browser and can be managed with puppeteer.

  • 1.2.11
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10K
decreased by-6.77%
Maintainers
1
Weekly downloads
 
Created
Source

Logo

Puppeteer Real Browser

This package prevents Puppeteer from being detected as a bot in services like Cloudflare and allows you to pass captchas without any problems. It behaves like a real browser.

https://github.com/zfcsoftware/puppeteer-real-browser/assets/123484092/bd8ca2b0-a661-4248-9bf5-3ef12e3f5801

Contributors Forks Stargazers Issues License

Installation

If you are using a Linux operating system, xvfb must be installed for the library to work correctly.

npm i puppeteer-real-browser

if you are using linux:

sudo apt-get install xvfb

Include

CommanJS


const start = async () => {
    var { connect } = await import('puppeteer-real-browser')
    const { page, browser } = await connect({})
}

Module


import { connect } from 'puppeteer-real-browser'

const { page, browser } = await connect({})

Usage

import { connect } from 'puppeteer-real-browser'

connect({

    headless: 'auto',

    args: [],

    customConfig: {},

    skipTarget: [],

    fingerprint: true,

    turnstile: true,

    connectOption: {},

    tf: true,

    // proxy:{
    //     host:'<proxy-host>',
    //     port:'<proxy-port>',
    //     username:'<proxy-username>',
    //     password:'<proxy-password>'
    // }

})
.then(async response => {
    const {browser, page} = response
    await page.goto('<url>')
    
})
.catch(error=>{
    console.log(error.message)
})

headless: auto can take the values true and false. If auto is set, it uses the option that is stable on the operating system in use.

args: If there is an additional flag you want to add when starting Chromium, you can send it with this string.

customConfig: When launch is executed, the variables you send in be onje are added. For example, you can specify the browser path with executablePath.

skipTarget: It uses target filter to avoid detection. You can send the targets you want to allow. This feature is in beta. Its use is not recommended.

fingerprint: If set to true, it injects a unique fingerprint ID into the page every time the browser is launched and prevents you from being caught.

turnstile: Cloudflare Turnstile automatically clicks on Captchas if set to true

connectOption: The variables you send when connecting to chromium created with puppeteer.connect are added

tf: We use targetfilter to avoid detection. This feature prevents the opening of new pages and some startup options. For this reason, we have added a feature to turn off the filter when starting the browser. This filter can also be removed later with the setTarget function.

For example, if you want to open a 2nd page, you can use this library as follows.


import { connect } from 'puppeteer-real-browser'

connect({
    tf: true, // If a feature you want to use at startup is not working, you can initialize the tf variable false and update it later.
    turnstile: true
})
.then(async response => {
        const { page, browser, setTarget } = response

        page.goto('https://nopecha.com/demo/cloudflare', {
            waitUntil: 'domcontentloaded'
        })

        setTarget({ status: false })

        let page2 = await browser.newPage();

        setTarget({ status: true })

        await page2.goto('https://nopecha.com/demo/cloudflare');
})

Docker

You can use the Dockerfile file in the main directory to use this library with docker. It has been tested with docker on Ubuntu server operating systems.

To run a test, you can follow these steps

git clone https://github.com/zfcsoftware/puppeteer-real-browser
cd puppeteer-real-browser
docker build -t puppeteer-real-browser-project .
docker run -p 8080:3000 puppeteer-real-browser-project

Support Us

This library is completely open source and is constantly being updated. Please star this repo to keep these updates coming. Starring the repo will support us to improve it.

License

Distributed under the MIT License. See LICENSE for more information.

Thank You

  • Jimmy Laurent - Jimmy Laurent - inspired by cloudflare-scraper library
  • CrispyyBaconx - CrispyyBaconx - Contributed to converting this library to Typescript
  • Pavle Aleksic - pavlealeksic - We change the fingerprint with the puppeteer-afp library.

Disclaimer of Liability

No responsibility is accepted for the use of this software. This software is intended for educational and informational purposes only. Users should use this software at their own risk. The developer cannot be held liable for any damages that may result from the use of this software.

This software is not intended to bypass Cloudflare Captcha or any other security measure. It must not be used for malicious purposes. Malicious use may result in legal consequences.

This software is not officially endorsed or guaranteed. Users can visit the GitHub page to report bugs or contribute to the software, but they are not entitled to make any claims or request service fixes.

By using this software, you agree to this disclaimer.

Keywords

FAQs

Package last updated on 06 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc