Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

google customsearch returns different result?

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?

like image 244
ikel Avatar asked Feb 24 '18 01:02

ikel


2 Answers

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.

like image 117
Artemis Avatar answered Oct 13 '22 07:10

Artemis


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.

like image 5
joginder singh Avatar answered Oct 13 '22 05:10

joginder singh