Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
google-images
Advanced tools
Search images using Google Custom Search Engine API.
$ npm install --save google-images
Note: You'll need to set up your own Google Custom Search Engine to execute queries.
const GoogleImages = require('google-images');
const client = new GoogleImages('CSE ID', 'API KEY');
client.search('Steve Angello')
.then(images => {
/*
[{
"url": "http://steveangello.com/boss.jpg",
"type": "image/jpeg",
"width": 1024,
"height": 768,
"size": 102451,
"thumbnail": {
"url": "http://steveangello.com/thumbnail.jpg",
"width": 512,
"height": 512
}
}]
*/
});
// paginate results
client.search('Steve Angello', {page: 2});
// search for certain size
client.search('Steve Angello', {size: 'large'});
Please see Google's API documentation for details on the option and response properties and their possible values. Note that the option names used here may differ slightly (e.g. no img
prefix).
Type: string
The identifier for a Custom Search Engine to use.
Type: string
The credentials for accessing Google's API.
Perform an image search for query
.
Type: string
The search terms to use for finding images. Identical to those you would use in a web search.
Type: object
Type: number
Default: 1
The range of results to return. Useful because often results cannot be returned in a single response. Note that it is a one-based unsigned integer. E.g. page 1
has the first 10 results, page 2
has the next set of 10, etc.
Type: string
The size of images to search. E.g. medium
or xxlarge
.
Type: string
The category of images to search. E.g. face
or photo
.
Type: string
The dominant color to search for. E.g. yellow
or purple
.
Type: string
The category of color spectrums to search. E.g. gray
or color
.
Type: string
The heuristic level to use for filtering out explicit content using SafeSearch. E.g. off
or high
.
Google deprecated their public Google Images API, so to search for images you need to sign up for Google Custom Search Engine. Here are the steps you need to do:
You can do this here: https://cse.google.com/cse.
Do not specify any sites to search but instead use the "Restrict Pages using Schema.org Types" under the "Advanced options".
For the most inclusive set, use the Schema: Thing
. Make a note of the CSE ID.
In your search engine settings, enable "Image search":
Register a new app and enable Google Custom Search Engine API here: Google Developers Console. Make a note of the API key.
MIT © Vadim Demedes
FAQs
Search images using Google Custom Search Engine API
The npm package google-images receives a total of 861 weekly downloads. As such, google-images popularity was classified as not popular.
We found that google-images demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.