13

I'm trying out google customsearch api to search image and but the weird thing is my search through api returns different result than regular search through browser. for example

from apiclient.discovery import build
import pprint
import sys
api_key='xxxxxxx'
service = build('customsearch', 'v1', developerKey=api_key)
request=service.cse()
query=request.list(cx='xxxx:xxxxx',q='dogs and cats',searchType='image',imgType='photo')
result=query.execute()
pprint.pprint(result)
for i in result.get('items',[]):
    print (i['link'])

running this code gives totally different result here is result from running above code

https://s.yimg.com/ny/api/res/1.2/tarWzt2ZXfPOEg8oQVlOWw--/YXBwaWQ9aGlnaGxhbmRlcjtzbT0xO3c9ODAw/http://media.zenfs.com/en-US/homerun/people_218/4d82a5fa19dd37247717704975fdf602
https://www.google.com/about/main/machine-learning-qa/img/cat-dog-flow-horizontal.gif
https://www.google.com/trends/2014/static/images/pets-snapshot-reveal-1920.jpg
https://www.google.com/trends/2014/static/images/pets-share.png
https://www.google.com/about/main/machine-learning-qa/img/cat-dog-flow-vertical.gif
https://s.yimg.com/uu/api/res/1.2/YQWuQgTnzQuwXjYzX.QrWg--~B/aD0xMzMzO3c9MjAwMDtzbT0xO2FwcGlkPXl0YWNoeW9u/http://media.zenfs.com/en-US/homerun/people_218/4d82a5fa19dd37247717704975fdf602
https://www.google.com/trends/2014/static/images/pets-video-1080.jpg
https://www.google.com/trends/2014/static/images/pets-video-320.jpg
https://www.google.com/maps/d/thumbnail?mid=1hO0YkGLATyy-ZI9JxX1lbv-wK1M&hl=en_US

here is a snapshot of google search from chrome enter image description here queries are same, anyone knows why?

Dan Cornilescu
  • 39,470
  • 12
  • 57
  • 97
ikel
  • 1,790
  • 6
  • 31
  • 61
  • 1
    Is the snapshot of google chrome from a fresh "incognito" window? google personalises your search results to your profile based on your previous search history, this could be influencing your test criteria. – FraggaMuffin Mar 01 '18 at 11:41

4 Answers4

5

It depends on the custom search engine that you created from google console. Goto the CSE on your google console and try "View it on the web" option to test it in your browser and if the results match. Results should match.

  • I tried and result is different from normal search on google.com using browser...why is that – ikel Mar 04 '18 at 05:09
  • as @Artemis Fowl mentioned - "Your normal google search will be based on a lot of info that google picks up about you. If you sign out of google and use an incognito window, it should be unaffected." – joginder singh Mar 19 '19 at 08:11
4

Your normal google search will be based on a lot of info that google picks up about you.

Artemis
  • 2,553
  • 7
  • 21
  • 36
4

Your normal google search will be based on a lot of info that google picks up about you. If you sign out of google and use an incognito window, it should be unaffected.

Artemis
  • 2,553
  • 7
  • 21
  • 36
3

I think this happens because when using API, you can issue around i think 40 requests per hour. The results you see on the API is not what the real user sees. You are limited to what they give you, it's not really useful if you want to track what a real user would see. That's something you are not allowed to gather.

Moreover, in a regular/normal search through the browser the result can be vary due to one of these reasons:

  • Your personal search history
  • Whether you are logged in to a Google Account while searching
  • Your geographic location
  • What type of browser you are using
  • The number of Google-generated ads on the page
  • Previous Searches On a Single Device
  • Previously Clicked Google Links etc
Abdullah Ahmed Ghaznavi
  • 1,978
  • 3
  • 17
  • 27