Skip to content

Commit bc02c92

Browse files
committed
fix: Resolves broken Scrapingrobot scraper on new installs.
closes #243
1 parent d9d7c63 commit bc02c92

File tree

3 files changed

+116
-31
lines changed

3 files changed

+116
-31
lines changed

package-lock.json

Lines changed: 113 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"axios": "^1.1.3",
2525
"axios-retry": "^3.3.1",
2626
"chart.js": "^3.9.1",
27-
"cheerio": "^1.0.0-rc.12",
27+
"cheerio": "^1.0.0",
2828
"concurrently": "^7.6.0",
2929
"cookies": "^0.8.0",
3030
"croner": "^5.3.5",

utils/scraper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import axios, { AxiosResponse, CreateAxiosDefaults } from 'axios';
2-
import cheerio from 'cheerio';
2+
import * as cheerio from 'cheerio';
33
import { readFile, writeFile } from 'fs/promises';
44
import HttpsProxyAgent from 'https-proxy-agent';
55
import countries from './countries';
@@ -124,7 +124,7 @@ export const scrapeKeywordFromGoogle = async (keyword:KeywordType, settings:Sett
124124
throw new Error(res);
125125
}
126126
} catch (error:any) {
127-
refreshedResults.error = scraperError;
127+
refreshedResults.error = scraperError || 'Unknown Error';
128128
if (settings.scraper_type === 'proxy' && error && error.response && error.response.statusText) {
129129
refreshedResults.error = `[${error.response.status}] ${error.response.statusText}`;
130130
}

0 commit comments

Comments
 (0)