Serp API
Using the Serp API in your bots
The lil’bots platform comes with Serp API access built in. You can use the Serp API to build bots that can scrape search engine results pages (SERPs) like Google and extract structured data from them. Perfect for letting your bots search the web for information.
Using the Serp API
The main endpoint for the Serp API is /search
. You can make requests to this endpoint to scrape search engine results pages (SERPs) like Google. The following parameters are supported:
- q (required) - the search query to scrape the SERP for. You can use anything that you would use in a regular Google search. e.g. inurl:, site:, intitle:. We also support advanced search query parameters such as as_dt and as_eq. See the full list of supported advanced search query parameters.
- location (optional) - Parameter defines from where you want the search to originate. If several locations match the location requested, we’ll pick the most popular one. If location is omitted, the search may take on the location of the proxy.
- google_domain - The Google domain to use for the search. e.g. google.com, google.co.uk, google.fr, etc.
- device - Parameter defines the device to use to get the results. It can be set to desktop (default) to use a regular browser, tablet to use a tablet browser (currently using iPads), or mobile to use a mobile browser (currently using iPhones).
- output - Parameter defines the final output you want. It can be set to json (default) to get a structured JSON of the results, or html to get the raw html retrieved.
This is not an exhaustive list of parameters. For a full list of supported parameters, see the Serp API documentation.
Here’s an example of the JSON returned from the API:
Here’s an example of a bot that uses the Serp API to scrape Google search results, using fetch to make the request: