Google image from cocoa

175 Views Asked by At

I'd like to write a program in cocoa that parse a google image webpage and extract the images. i use a code like this:

NSURL *url = [ NSURL URLWithString: [ NSString stringWithFormat: @"https://www.google.it/search?q=%@&tbm=isch", searchString] ];
NSStringEncoding enc;
NSString *test = [NSString stringWithContentsOfURL:url usedEncoding:&enc error:NULL];

The problem is that the page that is returned in this way is different from what it is in a browser. I'don't get the imgurl parameter with the url of the full image. only the thumbnails. There is a way to have the complete google images results in cocoa like i have in firefox? Thank you

1

There are 1 best solutions below

1
Fahim Parkar On BEST ANSWER

What you are doing is not correct way.

To get list of images, you should use Google API for image Search

Follow below link for more details.

https://developers.google.com/image-search/v1/jsondevguide

The URL for webservice would look like below.

https://ajax.googleapis.com/ajax/services/search/images?q=soccer&v=1.0
                                                          ^^^^^^ your search keyword here...