christophebe / serp

Google Search SERP Scraper
101 stars 23 forks source link

Error when searching on google.com #24

Open Fabrizio1990 opened 1 year ago

Fabrizio1990 commented 1 year ago

Hi, i have this code: `const serp = require("serp");

const keyword = "bici sportiva";

var options = { host: "google.com", qs: { q: keyword, filter: 0, pws: 0, }, num: 100, };

const getLinks = async () => { console.log("fetching google..."); const links = await serp.search(options); console.log("links", links); };

getLinks(); ` it work on google.it but not on google.com (also tried to remove host option ad set num to 10), the resulting error is:

_(node:64929) UnhandledPromiseRejectionWarning: Error: Invalid HTTP status code on undefined at requestFromBrowser (/Users/fabriziocoppolecchia/Desktop/Progetti/Freelance sharing/Tools Fabio/serpPositionSearch/node_modules/serp/index.js:125:11) at runNextTicks (internal/process/task_queues.js:58:5) at processImmediate (internal/timers.js:434:9) at async execRequest (/Users/fabriziocoppolecchia/Desktop/Progetti/Freelance sharing/Tools Fabio/serpPositionSearch/node_modules/serp/index.js:110:19) at async doRequest (/Users/fabriziocoppolecchia/Desktop/Progetti/Freelance sharing/Tools Fabio/serpPositionSearch/node_modules/serp/index.js:90:18) at async Object.search (/Users/fabriziocoppolecchia/Desktop/Progetti/Freelance sharing/Tools Fabio/serpPositionSearch/node_modules/serp/index.js:38:20) at async getLinks (/Users/fabriziocoppolecchia/Desktop/Progetti/Freelance sharing/Tools Fabio/serpPositionSearch/index.js:20:17) (Use node --trace-warnings ... to show where the warning was created) (node:64929) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:64929) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code._