zfcsoftware / 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.
https://www.npmjs.com/package/puppeteer-real-browser
MIT License
490 stars 74 forks source link

Cannot Bypass Cloudflare Protection on StockX.com #88

Closed AhmerRaza12 closed 1 month ago

AhmerRaza12 commented 1 month ago

I am experiencing an issue with puppeteer-real-browser where it cannot bypass Cloudflare protection on StockX.com.

Below is my script

(async () => { const {connect} = await import('puppeteer-real-browser'); const { page, browser } = await connect({headless: false});

const urls = [
    "https://stockx.com/sneakers",
    "https://stockx.com/streetwear",
    "https://stockx.com/collectibles",
    "https://stockx.com/handbags",
    "https://stockx.com/watches",
];

for (const url of urls) {
    await page.goto(url, { waitUntil: 'domcontentloaded' });
    await page.waitForSelector('div[data-testid="productTile"]');

    const data = await page.evaluate(() => {
        const productContainers = Array.from(
            document.querySelectorAll('div[data-testid="productTile"]')
        );

        const products = productContainers.map(container => {
            const nameElement = container.querySelector('p[data-testid="product-tile-title"]');
            const priceElement = container.querySelector('p[data-testid="product-tile-lowest-ask-amount"]');
            const linkElement = container.querySelector('a[data-testid="productTile-ProductSwitcherLink"]');
            const imageElement = container.querySelector('img[alt]');

            return {
                name: nameElement ? nameElement.textContent : null,
                price: priceElement ? priceElement.textContent : null,
                link: linkElement ? linkElement.href : null,
                image: imageElement ? imageElement.src : null,
                website: "Stockx.com"
            };
        });

        return products;
    });

    console.log(data);
}

await browser.close();

})();

Hartyshow26 commented 1 month ago

Hi,

I have the problem on the site Stake.games. My code is the following : const { page, browser } = await connect({ turnstile: true, fingerprint: true });

And the browser is just stuck in CloudFlare screen and can't click on the checkbox : image

And some times the challenge is directly passed successfully but if I ask for cookies, I don't have any cf_clearance token... Is this normal ? I have used this solution for weeks without any problem and now for 1 week I can't get any new cf_clearance tokens !

Thanks in advance for your help !

AhmerRaza12 commented 1 month ago

got if fixed by adding turnstile const { page, browser } = await connect({ headless: false, turnstile: true });