在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):vadimdemedes/google-images开源软件地址(OpenSource Url):https://github.com/vadimdemedes/google-images开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):google-images
Installation
UsageNote: 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'}); APIPlease 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 Client(engineId, apiKey)engineIdType: The identifier for a Custom Search Engine to use. apiKeyType: The credentials for accessing Google's API. Instance.search(query, option)Perform an image search for queryType: The search terms to use for finding images. Identical to those you would use in a web search. optionType: pageType: 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 sizeType: The size of images to search. E.g. typeType: The category of images to search. E.g. dominantColorType: The dominant color to search for. E.g. colorTypeType: The category of color spectrums to search. E.g. safeType: The heuristic level to use for filtering out explicit content using SafeSearch. E.g. Set up Google Custom Search EngineGoogle 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: 1. Create a Google Custom Search EngineYou 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: 2. Enable Image SearchIn your search engine settings, enable "Image search": 3. Set up a Google Custom Search Engine APIRegister a new app and enable Google Custom Search Engine API here: Google Developers Console. Make a note of the API key. LicenseMIT © Vadim Demedes |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论