Created
February 10, 2023 08:55
-
-
Save seoutopico/39845b82bacb37e0815e7c6de1919f49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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