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

cloudflare-scraper

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloudflare-scraper - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

4

index.js

@@ -5,5 +5,7 @@ const request = require('request-promise-native');

const fillCookiesJar = require('./src/fillCookiesJar');
const { isCloudflareJSChallenge, isCloudflareCaptchaChallenge } = require('./src/utils');
function isCloudflareIUAMError(error) {
return error.response.body.includes('cf-browser-verification');
const { body } = error.response;
return isCloudflareJSChallenge(body) || isCloudflareCaptchaChallenge(body);
}

@@ -10,0 +12,0 @@

{
"name": "cloudflare-scraper",
"version": "1.0.0",
"version": "1.0.1",
"description": "A package to bypass Cloudflare's protection",

@@ -5,0 +5,0 @@ "author": "Jimmy Laurent",

@@ -6,2 +6,3 @@ const puppeteer = require('puppeteer-extra');

const handleCaptcha = require('./handleCaptcha');
const { isCloudflareJSChallenge, isCloudflareCaptchaChallenge } = require('./utils');

@@ -55,18 +56,21 @@ puppeteer.use(StealthPlugin());

let content = await page.content();
while (content.includes('cf-browser-verification')) {
response = await page.waitForNavigation({
timeout: 45000,
waitUntil: 'domcontentloaded'
});
content = await page.content();
if (count++ === 10) {
throw new Error('timeout on just a moment');
if (isCloudflareCaptchaChallenge(content)) {
await handleCaptcha(content, request, options);
}
else {
while (isCloudflareJSChallenge(content)) {
response = await page.waitForNavigation({
timeout: 45000,
waitUntil: 'domcontentloaded'
});
content = await page.content();
if (count++ === 10) {
throw new Error('timeout on just a moment');
}
}
if (isCloudflareCaptchaChallenge(content)) {
await handleCaptcha(content, request, options);
}
}
content = await page.content();
if (content.includes('cf_captcha_kind')) {
await handleCaptcha(content, request, options);
}
const cookies = await page.cookies();

@@ -73,0 +77,0 @@ for (let cookie of cookies) {

@@ -1,2 +0,1 @@

function extract(string, regexp, errorMessage) {

@@ -12,2 +11,10 @@ const match = string.match(regexp);

module.exports = { extract };
function isCloudflareJSChallenge(body) {
return body.includes('cf-browser-verification');
}
function isCloudflareCaptchaChallenge(body) {
return body.includes('cf_captcha_kind');
}
module.exports = { extract, isCloudflareJSChallenge, isCloudflareCaptchaChallenge };
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