Google Custom Search Engine API Image Search not returning results

冷暖自知 提交于 2021-01-27 03:56:10

问题


Just setup my CSE with Image Search enabled in the Basics tab, but still ain't getting results.

If I don't use searchType=image in the query it works, if I put it back it stops working with no errors, just no results.

Any inputs?


回答1:


It seems there are two elements required to consume the Google search API, the configuration of the API key and credentials.

Setup the API key here https://console.developers.google.com/project

and create your own CSE here https://www.google.co.uk/cse/all

I made the mistake like a lot of people of ignoring the CSE side of the setup (it didn't seem logical to search only my own site).

You need to create a CSE though, point it to search any url (I don't think it matters greatly), and then where it says "Sites to search" chose "Search the entire web but emphasise included sites". Also then set image search to "On".

Once you've done this browse to your new CSE, the url should contain your CX code e.g. cx=014341056213260336986:v4fl8n8sabc, you then need to use this in your request query string.

Your API query should now start returning results.




回答2:


Image search needs to be switched to ON at the Custom Search Setup->Basics



来源:https://stackoverflow.com/questions/23294216/google-custom-search-engine-api-image-search-not-returning-results

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!