Я использую API Google Custom Search для поиска изображений. Результат поиска всегда равен 0 при запросе изображений. Я после документации по ссылке ниже:Google пользовательский поиск api возвращает 0 результатов, когда searchType is image
https://developers.google.com/custom-search/json-api/v1/reference/cse/list
согласно документации, указав SearchType = изображения, то апи выглядит только для изображений.
Вот что мой URL выглядит следующим образом:
и результат выглядит следующим образом:
{
"kind": "customsearch#search",
"url": {
"type": "application/json",
"template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&safe={safe?}&cx={cx?}&cref={cref?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&orTerms={orTerms?}&relatedSite={relatedSite?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json"
},
"queries": {
"request": [
{
"title": "Google Custom Search - cars",
"totalResults": "0",
"searchTerms": "cars",
"count": 10,
"inputEncoding": "utf8",
"outputEncoding": "utf8",
"safe": "off",
"cx": "017576662512468239146:omuauf_lfve",
"searchType": "image"
}
]
},
"searchInformation": {
"searchTime": 0.049329,
"formattedSearchTime": "0.05",
"totalResults": "0",
"formattedTotalResults": "0"
}
}
Если удалить SearchType из запроса, я получаю результат обратно в виде веб-страница. Что здесь не так?
Поиск изображений в настоящее время включен –