Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Google Search API

Hi

I am using REST API call to query google search via https://www.googleapis.com/customsearch

I understand API has some limitations such as only being able to return 10 results at a time. So, for a query that returns 100 results, I need to re-run the API call 10 times to gather all the Links.

Here is my issue.

Lets say the total search results is 100 from my query.

htps://www.googleapis.com/customsearch/v1key=1234567890&cx=123&q=testnum=10&start=1

I then re-run the query with &start=11 so I get the next 10 links.

I noticed that each time you change the &start value the total number of results becomes less and less. For example., I started with 100 but now after changing the &start parameter, I now get 10 search results.

What happened to the other 90? If they have been dismissed, why? And how can I get the full list of links from my first query so I can see which links have been dopped?

What logic is Google using to reduce the number of total results when all I'm doing is moving from the first 1-10 to 11-20 and then 21-30 etc.

I hope this makes sense, some guidance would be very helpful.

Thanks

0 1 1,063
1 REPLY 1

Hi,

1. The link you provided to google api customsearch gives a 404. 

2. According to the documentation, the response when you execute a search includes a search request metadata. One of the attributes in this meta data is "nextPage" which is the url you should use to retrieve the next page of results. I suggest using that to pull the next set of results.

 

    ......NoCommandLine ......
https://nocommandline.com
        Analytics & GUI for 
App Engine & Datastore Emulator