A simple yet powerful module to retrieve organic search results and much more from Google.
A simple yet powerful module to retrieve organic search results and much more from Google.
Google This
A simple yet powerful module to retrieve organic search results and much more from Google.
Installation - Getting Started - Image Search - Related Projects - See Also
# NPM
npm install googlethis@latest
# Yarn
yarn add googlethis@latest
# Git
npm install LuanRT:google-this
// const google = require('googlethis');
import google from 'googlethis';
const options = {
page: 0,
safe: false, // Safe Search
parse_ads: false, // If set to true sponsored results will be parsed
additional_params: {
// add additional parameters here, see https://moz.com/blog/the-ultimate-guide-to-the-google-search-parameters and https://www.seoquake.com/blog/google-search-param/
hl: 'en'
}
}
const response = await google.search('TWDG', options);
console.log(response);
Output
…
As you can see, the library returns a lot of data.
Currently, it can retrieve and parse almost everything you can get from a google search! From knowledge graph and featured snippets to Google Dictionary, Google Translate, song lyrics and more.
All you have to do is search something along the lines of “define xyz”, “translate x to y” or “xyz song lyrics” and their respective fields will appear in the response.
Knowledge Graph:
Will look like:
…
Google Translate:
Will be:
{
//...
"translation": {
"source_language":"English - detected",
"target_language":"German",
"source_text":"this is a test",
"target_text":"das ist ein Test"
}
}
Google Dictionary:
↓↓↓
{
//...
"dictionary":{
"word":"a·maz·ing",
"phonetic":"/əˈmāziNG/",
"audio":"https://ssl.gstatic.com/dictionary/static/sounds/20200429/amazing--_us_1.mp3",
"definitions":[
"causing great surprise or wonder; astonishing.",
"startlingly impressive."
],
"examples":[
"\"an amazing number of people registered\"",
"\"she makes the most amazing cakes\""
]
}
}
Pretty amazing, isn't it? :D
For more info check out the examples file.
The library also supports image search & reverse image search.
Check it out:
// const google = require('googlethis');
import google from 'googlethis';
// Image Search
const images = await google.image('The Wolf Among Us', { safe: false });
console.log(images);
// Reverse Image Search
const my_awesome_image = fs.readFileSync('./wow.png');
const reverse = await google.search(my_awesome_image, { ris: true });
console.log(reverse.results);
Image Search output
…
Reverse Image Search output
…
Contributions, issues and feature requests are welcome. Feel free to check issues page if you want to contribute.
LuanRT - @lrt_nooneknows - [email protected]
Project Link: https://github.com/LuanRT/google-this
(back to top)
No open issues yet, or sync has not completed.