Skip to content

Commit

Permalink
chore: fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
barjin committed Nov 2, 2023
1 parent 384e0c9 commit 41fb582
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test/live-testing/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { readFileSync } from 'fs';
import { setTimeout } from 'timers/promises';
import { gotScraping } from '../../dist/index.js';
import got from 'got';
import { gotScraping } from '../../dist/index.js';

async function processUrls(gotImplementation, urls) {
let passed = 0;
let blocked = 0;
let failed = 0;

let url = null;
while (url = urls.shift()) {
let url = urls.shift();
while (url) {
try {
//console.log(`crawling ${url}`);
// console.log(`crawling ${url}`);
const request = gotImplementation.get(url);

const result = await Promise.race([
Expand All @@ -24,7 +23,7 @@ async function processUrls(gotImplementation, urls) {
throw new Error('timeout');
}

//console.log(`crawled ${url}`);
// console.log(`crawled ${url}`);

if (result.body.includes('Just a moment...')) {
blocked++;
Expand All @@ -33,12 +32,13 @@ async function processUrls(gotImplementation, urls) {
}
} catch (e) {
failed++;
//console.error(e.message);
continue;
// console.error(e.message);
}

url = urls.shift();
}

//console.log('done!');
// console.log('done!');
return { passed, blocked, failed };
}

Expand All @@ -51,11 +51,11 @@ async function runInParallel(implementation, urls) {
acc.blocked += blocked;
acc.failed += failed;
return acc;
}, {passed: 0, blocked: 0, failed: 0});
}, { passed: 0, blocked: 0, failed: 0 });
}

(async () => {
const { body } = await got.get('https://raw.githubusercontent.com/apify/fingerprint-suite/master/test/antibot-services/live-testing/cloudflare-websites.csv')
const { body } = await got.get('https://raw.githubusercontent.com/apify/fingerprint-suite/master/test/antibot-services/live-testing/cloudflare-websites.csv');
const urls = body.split('\n');

const [gotScrapingResults, gotResults] = await Promise.all([
Expand Down

0 comments on commit 41fb582

Please sign in to comment.