]> git.lizzy.rs Git - google_images.git/blob - README.md
Bump release
[google_images.git] / README.md
1 # free-google-images
2 Reverse Engineered Google Image Search API
3
4 The usage of this API does NOT require an API key, nor is it rate limited.
5
6 ## Usage
7
8 Exports `search` function that takes query string as first argument, a boolean safeSearch as second and optionally user agent as second. Usage of the user agent argument has not been tested.
9 `search` returns an promise that resolves to an array with objects like this (should be self-explanatory):
10
11 ```js
12 {
13         preview: {
14                 url: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQpttHz6N94mnwy5NbULk733B3srNYPMsmaYQ&usqp=CAU',
15                 size: { width: 300, height: 168 }
16         },
17         image: {
18                 url: 'https://en.free-wallpapers.su/data/media/3/big/anm5679.jpg',
19                 size: { width: 1920, height: 1080 }
20         },
21         color: 'rgb(232,190,194)',
22         link: 'https://en.free-wallpapers.su/img116919.htm',
23         title: 'Astolfo. Desktop wallpaper. 1920x1080'
24 }
25 ```
26
27 ### Example
28
29 ```js
30 const google_images = require("free-google-images");
31
32 google_images.search("astolfo+images").then(results => results.forEach(r => console.log(r.image.url)))
33 google_images.searchRandom("astolfo+images").then(result => console.log(result.image.url))
34
35 google_images.searchRandom("hentai", true).then(result => console.log(result.image.url)) // no results because of safe search
36 ```
37