kkoooqq / fakebrowser

🤖 Fake fingerprints to bypass anti-bot systems. Simulate mouse and keyboard operations to make behavior like a real person.
GNU Lesser General Public License v3.0
1.18k stars 214 forks source link

ERR_TOO_MANY_REDIRECTS #47

Open serzz1990 opened 2 years ago

serzz1990 commented 2 years ago

ERR_TOO_MANY_REDIRECTS error occurs when opening google.com or youtube.com with a proxy. The problem is not observed when using the original puppeteer and puppeteer-extra, also when using fakebrowser without a proxy.

new FakeBrowser.Builder()
      .evasionPaths([])
      .usePlugins([])
      .vanillaLaunchOptions({
        headless: false
      })
      .proxy({
        proxyType: 'https',
        proxy: `${this.$config.proxy.host}:${this.$config.proxy.port}`,
        exportIP: this.$config.proxy.host,
        username: this.$config.proxy.username,
        password: this.$config.proxy.password
      })
      .userDataDir(config.userDataDir);
kkoooqq commented 2 years ago

@serzz1990 which proxy provider did you used? and proxy.host it's a real IP or a server hostname?

0xTushar commented 2 years ago

Same Problem

(node:2568) UnhandledPromiseRejectionWarning: Error: net::ERR_TOO_MANY_REDIRECTS at https://mail.google.com/mail/u/1/?tab=wm#inbox

Node Version: 14.15.2 OS: Windows 10 x64

Sample Code:

// cjs
const {FakeBrowser} = require('fakebrowser');

// esm
// import {FakeBrowser} from 'fakebrowser';
// import {createRequire} from 'module';
// const require = createRequire(import.meta.url);

const path = require('path')
const userDataDir = path.resolve(__dirname, './fakeBrowserUserData')

!(async () => {
    // [Optional]: Select a fake device description
    const windowsDD = require('./node_modules/fakebrowser/device-hub-demo/Windows.json');

    const builder = new FakeBrowser.Builder()
        // [Optional]: Set the fake device description
        .deviceDescriptor(windowsDD)
        // [Optional]: Show user action layers
        // .displayUserActionLayer(true)
        // [Optional]: Set startup options (https://pptr.dev/#?product=Puppeteer&show=api-puppeteerlaunchoptions)
        .vanillaLaunchOptions({
            headless: false,
            // executablePath: '/Applications/Google Chrome 93.0.4577.82.app/Contents/MacOS/Google Chrome',
            userDataDir,
        })
        // Must be set: path to save user data
        // We will create a fake device description (fake browser fingerprint) and save the browser's user cache information to this folder.
        // Note: Once the fake browser fingerprint is created, it will not change, just like a normal user using the browser.
        // If you want to get a different browser fingerprint, see demo2.
        .userDataDir(userDataDir);

    const fakeBrowser = await builder.launch();

    // vanillaBrowser is a puppeteer.Browser object
    const page = await fakeBrowser.vanillaBrowser.newPage();
    await page.goto('https://mail.google.com/mail/u/1/?tab=wm#inbox', {waitUntil: 'networkidle0'});

    // ***** Do something automatic *****

    // Don't forget to close your browser to release resources
    await fakeBrowser.shutdown();
})();
returnednull commented 2 years ago

As my experiences with puppeteer and this repository this problem appears when switching user agent too mobile and using regular sock5 ipv4 proxy. I think this problem not releated with this repo