Google Custom Search Engine API Image Search not returning results - image

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?

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.

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

Related

Google Custom Search Engine - search by image

Right now I'm using Custom Search Engine (CSE) to search through entire web by search term. The request looks like:
GET "https:/www.googleapis.com/customsearch/v1?key=API_KEY&cx=SEARCH_ENGINE_ID&q=SEARCH_TERM"
And this request returns me list of search results.
But, I need to implement search by image or image url. Do Google API provide such a url param? Maybe something like "image_url"? So, the request can look the following:
https://www.googleapis.com/customsearch/v1?key=API_KEY&cx=SEARCH_ENGINE_ID&image_url=http://www.example.com/image.png
Basically, I need to implement the same functionality as images.google.com/ but using my Custom Search Engine. Thanks.
Example of what I need to implement:
As far as I know, what you're looking for is only supported by Vision AI service (partially at least, never used it before). Google CSE API only allows you to search images and not by images as you may noticed.

Query google to get first image result

I am trying to setup a process where I can query a google API with a text string to get the first image result.
I have setup a Google Custom Search Engine but I can't seem to replicate a standard google search. My settings:
Image Search: ON
Domains to include: google.com. Include all sites this page links to
My hope with above settings was that it would imitate a standard google search. But when I try the term "poker", I get no results. I'm assuming this has something to do with my CSE settings but not sure how to adjust.
You need to choose the option to search the entire web:
In the left-hand menu, under Control Panel, click Basics.
In the Search Preferences section, select Search the entire web but emphasize included sites.
screenshot example

Google Custom Search API- Get results specific user location

As in normal Google search page, Google returns me results specific to my location. As i am considering/assuming for this, it gets my ip address my request, find uses location for it and returns the results.
I am writing the proxy server for search engines. So from user browser i get requests for some search terms and server returns search results.
I am curious to know, if from Custom Search API can i get the such results based on some IP address i provide or anything like that, so that i can mock the user location in my proxy server and pretend the Google Custom Search to be that user and get the location specific results
PS.I am new to this search engine api world, so please understand me.
Yes, you can, but just for the country, not the exact location.
Here is the docs for parameters of a query request:
https://developers.google.com/custom-search/json-api/v1/reference/cse/list
Look at the 'gl' parameter.
I'm not aware of any way to specify the location more precisely then this.
After these many years I'm not sure if you still need it, but I found it hard to find a helpful answear, so here's the solution for whoever needs it.
You can achieve that behavior with the "?gl=" query param as mentioned here, and pass the value as one of the country codes.
Worked for me, hope it helps someone!

Google API returning different results than website

When I do a site-specific search on google.com:
site:http://one-month-of-chat-logs.github.io security
I get 12 results. I signed up for a custom search engine (cx: 015271449006306103053:mz6wkimeenc) and API key, and I get only 3 results when I run the same search:
$ curl 'https://www.googleapis.com/customsearch/v1?key=$MY_API_KEY&cx=015271449006306103053%3Amz6wkimeenc&q=security'
Why do the results differ? Is my API request actually querying something different than the search I performed on google.com?
This google page has what you are looking for https://support.google.com/customsearch/answer/70392?hl=en
your results are unlikely to match those returned by Google Web Search, for several reasons:
Even if a custom search engine is configured to search the entire web,
it’s designed to emphasize results from your own sites.
Your custom search engine doesn’t include Google Web Search features such as
Oneboxes, real-time results, universal search, social feaures, or
personalized results.
If your custom search engine includes more than
ten sites, the results may be from a subset of our index and may
differ from the results of a 'site:' search on Google.com.
I found that it is impossible to get the right results using Google APIs. Even if the search is only for one website, their search results are different if you use their UI vs use the API and pay for it. This is I guess, because google makes more money if they can show ads, while APIs are definitely only a face saving measure.
Since some of you are ok with a paid solution(#ihsan) you can try using a third party service like https://www.expertrec.com where you can control your crawl (so crawl depth is not a problem), ranking (adjust it the way you like), use the API or the full solution, with out any ads.

Does Firefox stores keywords in its Google Analytics cookie?

I'm trying to extract the keyphrase someone used to land on a website. And since I have the Google Analytics script, I should be able to get the cookie name ___utmz and then look for the string "utmctr=...." to find what keywords.
However, in Firefox, no matter what, I always see (not provided)
utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided)
Is there a way to extract the keywords if someone visited using FF?
This has nothing to do with Google Analytics or Firefox but instead is a result of how keywords are handled for SSL searches with Google. In those cases, Google search will not pass along the keyword in the referral and instead sets the value to (not provided). For details see the keyword section in https://support.google.com/analytics/answer/1033173

Resources