在图片搜索过程中,谷歌自定义搜索API的多种文件类型。

问题描述 投票:1回答:1

目前,我正在使用Google自定义搜索API,使用REST进行图片搜索。

https:/developers.google.comcustom-searchjs-apiv1referencecselist#request。

我想知道,什么是正确的方式,以特定的多个文件类型?

fileType 在API文档中简单的提到了。

例如,下面是一个GET请求,只搜索 BMP 类型的图像。

https://www.googleapis.com/customsearch/v1?key=GOOGLE_API_KEY&cx=GOOGLE_SEARCH_ENGINE_ID&q=picasso&searchType=image&fileType=bmp

但是,如果我想同时搜索PNG和BMP图像怎么办?

一开始,我以为

fileType=png,bmp

可行 http:/codigogenerativo.comcodegoogle-custom-search-api。

但是,如果我使用

https://www.googleapis.com/customsearch/v1?key=GOOGLE_API_KEY&cx=GOOGLE_SEARCH_ENGINE_ID&q=picasso&searchType=image&fileType=png,bmp

JPEG 图像被返回。

似乎我的假设是错误的。有谁知道如何在搜索图片的过程中为Google Custom Search API设置多个fileType?

ps类似的问题几年前就已经提出来了,但是还没有具体的答案。多文件类型搜索使用谷歌自定义搜索API

google-custom-search google-search-api google-image-search
1个回答
0
投票
https://www.googleapis.com/customsearch/v1?fileType=jpg,png,AND OTHER TYPES YOU NEED&key=GOOGLE_API_KEY&cx=GOOGLE_SEARCH_ENGINE_ID&q=picasso&searchType=image
© www.soinside.com 2019 - 2024. All rights reserved.