Skip to content

Instantly share code, notes, and snippets.

@seoutopico
Created February 10, 2023 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seoutopico/39845b82bacb37e0815e7c6de1919f49 to your computer and use it in GitHub Desktop.
Save seoutopico/39845b82bacb37e0815e7c6de1919f49 to your computer and use it in GitHub Desktop.
//script básico para para hacer consutlas en Google con serpApi
const SerpApi = require('google-search-results-nodejs');
const search = new SerpApi.GoogleSearch("YOUR_API_KEY");
const wordsList = ["master seo", "master metaverso", "master marketing digital"];
wordsList.forEach(word => {
const params = {
engine: "google",
q: word,
hl: "es",
gl: "es",
google_domain: "google.es"
};
const callback = function(data) {
const organicResults = data.organic_results;
const positionAndLink = organicResults.map(result => ({
position: result.position,
link: result.link,
word: data.search_parameters.q // Add the search word
}));
console.log(positionAndLink);
};
// Show result as JSON
search.json(params, callback);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment