Google API returning different results than website - google-api

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.

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.

Google Custom Search Engine API Image Search not returning results

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

How to use AJAX to search Google Images?

I'm trying to pull pictures from Google Images using AJAX and a color filter.
The Google Search API has been deprecated, and use of the Custom Search API is encouraged instead. However, in reading the Programmer's Guides found there, I see no option for global search instead of site-specific search. It says here to set up a custom search engine, but this requires the searching to be limited to a specific URL!
There is a similar SO post which links to a Google Groups discussion. The only solutions offered there are either to use the deprecated API, something I'm rather loath to do since access has been limited, or to use the Bing API instead, which cannot filter searches by colors.
Are there really no other solutions? Is it impossible to perform a global Google Images search using AJAX?

Does Google Shows the AJAX based website results in search?

I want to know that i am making a website which shows all the latest information on the front page... the website is completely AJAX working , So all the data is in the Server Databases , If someone searches for a perticular data available in my site through Search engines then will the search engine searches the database?
By default, no, AJAX-only accessible content is not going to be crawled by Google. There is a convention you can use, however, to ensure that it does get crawled - the "Hash Wallop".
When Google (and other search engines), encounter a link that starts with "#!", it will "crawl" the dynamic content returning from an AJAX call. To take advantage of this, rather than having something like:
trigger ajax
...you will want to use something like:
trigger ajax
There is some more info on the technique here (and lots of others sites, just google it): http://www.seomoz.org/blog/how-to-allow-google-to-crawl-ajax-content
Some insight: http://coding.smashingmagazine.com/2011/09/27/searchable-dynamic-content-with-ajax-crawling/
Also, you might want to look into HTML caching, it will boost your SEO performance.

Google Chrome Malware Warning when including images from image search API

I'm using Google and Bing image search APIs to provide a way for users of my web app to search for images to include in the documents they create in the app. A (rare?) problem I encountered today: a result from either Bing or Google (I'm going to assume Bing) caused the Google Chrome Malware detector to go off.
Is there any good way to avoid this that I'm not aware of, aside from only using the Google Image API (which is being deprecated!) since I assume they filter out results from sites they think contain malware?
There doesn't seem to be any performant way on my end to check these results before displaying them to prevent this error from occurring, and I'm very worried that any less savvy computer users will think my site is at fault (not to mention being unable to make the warning go away).
I guess I'm also making the assumption here that images from random Internet sites are okay to include in the page as long as they are returned by these APIs...I do copy them over to our own S3 account a few minutes after they are added to the document in case they are changed/removed on the external site...
EDIT: The result is indeed being included from the Bing API, and it is from thefatlossauthority.com.
I would prefer a solution based in Ruby, but given a general solution I'm more than willing to implement it myself.

Resources