This Stackoverflow答案指出Google's Custom Search API允许搜索整个网络。
我并不关心结果顺序,但是想...
在我自己的网站上,使用浏览器JavaScript或至少使用NodeJS,使用these等过滤器对整个网络进行图片搜索 ,并在JavaScript中处理结果(显示我网站上的结果)
也进行反向图片搜索(查找类似于特定图片网址的图片)
要明确的是,我不想根据我网站的内容进行搜索,而只是自己显示全球搜索结果。
是否可以采用 legal 方式(不是通过抓取Google网站)?
注意我只对公共领域/ CC0图片感兴趣(Google可以通过许可证过滤图片)。
答案 0 :(得分:0)
如果您正在使用Node.js(因为标记了问题),那么有一个名为fotology的npm模块可以满足您的要求。它甚至允许按许可证过滤:
let options = {
size: "large", // large images only
language: "fr", // French
safe: true, // force safe search on
color: "white", // white cats only please
rights: "cc_publicdomain" // Only public domain images
}
fotology("cats", options)
.then(function (imageURLs) {
for (i in imageURLs)
console.log imageURLs[i];
});
免责声明:我是该模块特定版本的作者(original module不允许按图像许可过滤)
答案 1 :(得分:0)
由于此API不再可用,您可以使用我们的第三方服务(如SerpApi)来抓取Google并获取结构化JSON。
使用Node.js library的示例:
var gsr = require('GoogleSearchResults')
let serp = new gsr.GoogleSearchResults("demo")
serp.json_with_images({
q: "Cats Meme",
location: "Portland"
}, (result) => {
console.log(result)
})
答案 2 :(得分:0)
我今天(2018年)唯一知道的图像搜索API是Bing API。我过去曾使用雅虎和谷歌,但他们都停止了运营。
您每月可获得1000次免费搜索,之后约为5/1000次搜索。我昨晚刚刚实施了它;它运作得很好。