Google API?

niku's picture

Hi!

I am trying to create something that searches google image search for pictures and shows the pictures in quartz composer. I found this example for yahoo image search but yahoo seems to take fee for it nowdays. Google has 100 free search queries per day so I am using this as a starting point. And this composition as a model for importing the pictures http://kineme.net/composition/smokris/JSONStructure .

I already created a google account and have api key. Here is some information about the google json api: https://developers.google.com/custom-search/v1/using_rest

Searching websites seems easy but I need to use the image search. seachType=image does not seem to work, not atleast how I have tried it.

Has anyone here have any experience with this? Maybe other search engines like bling? Is it possible to do the same thing with XML importer? How do I get the structure right if I do that?

Best regards, Niku

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

dust's picture
Re: Google API?

your on the right track... smokris's ( i must be dyslectic because i have read smork not smok for years ? ) i digress. smokris's json to structure is needed. google changes there api all the time. my google voice qc plugin is broken now ;( i think its the json to nsdictionary framework i used though. a image search is pretty simple. most image services have switched over to a rest api. some of them like facebook for instance are easy as putting in the rest header url and there server spits back the user image url. so just putting the rest header url string into an image importer will work for face book. google for instance takes a rest header and sends back json with html and java script formatted data which is good if your building a web site but qc doesn't really know what to do with html tags. thats ok because you really only need the image url to display an image with the importer. the down side is google image search api is deprecated which means for three years you can use the image search api.

https://groups.google.com/forum/?fromgroups=#!topic/google-ajax-search-api/iNbeR8IEjhc

if you want to do custom image search like your trying to do it would be easier to use kineme data tools to send multiple requests to your cse. you could set it up in google code api and then use a url like this

https://www.googleapis.com/customsearch/v1?key="YOURAPIKEY"AI0&cx="YOURCSEUNIQUEID"&q=monkeys&as_filetype=png&alt=json

you really want something like this if your going to use a custom search.

http://www.google.com/cse/publicurl?searchtype=image&num=10&q=monkey&&as...

you can feed a url like ^^ into a xml reader then parse out the xml data in qc without json ?

google doesn't make it easy this way and limits you to 100 image searches. if you want to go that route you need to set up a custom search engine to get a cx id. http://www.google.com/cse/setup/

if i where you i would use maybe yahoo like the json example uses bing flikr insta or what ever there are a ton of services that will give you a rest header that returns either xml or json. see patch for google image api search....

PreviewAttachmentSize
GImageSearchDeprecated.qtz41.02 KB

.lov.'s picture
Re: Google API?

You can try the CoGeWebKit plugin, I've done with some examples how to grabbing images from the web: http://code.google.com/p/cogewebkit/

dust's picture
Re: Google API?

i just realized i ment twitter not face book lol. but im sure the facebook graph works similar. maybe look for some kind of image search to rss feed type of thing and put that the search query in xml patch ?

dust's picture
Re: Google API?

damn why does chrome always double post my shit. i would stay away from google and images my mate and google are being sued for using google images as art now ? it might better to make your own pictures so you don't piss someone off ?