Overview
This node performs Google Custom Search operations, specifically enabling users to execute search queries using Google's Custom Search API. It is useful for scenarios where you want to programmatically retrieve web or image search results based on a query string, optionally filtered by various parameters such as country code, safe search level, file type, and more.
Practical examples include:
- Searching for relevant articles or documents on the web.
- Retrieving images related to a specific topic.
- Filtering search results by site or file type.
- Integrating custom search capabilities into workflows that require automated data gathering from Google Search.
Properties
| Name | Meaning |
|---|---|
| Query | The search query string to look up. |
| Country Code (GL) | Two-letter country code representing the geolocation of the end user to tailor search results. |
| Return Only Items | Boolean flag indicating whether to return only the array of search result items instead of full response. |
| Additional Options | A collection of optional parameters to refine the search: |
| - Number of Results | Number of search results to return (1-100). |
| - Start Index | The index of the first result to return (pagination). |
| - Safe Search | Search safety level; options are "Off" or "Active". |
| - Search Type | Type of search to perform; options are "Web" or "Image". |
| - Site Search | Restrict results to a specific website domain. |
| - File Type | Restrict results to a specific file type (e.g., pdf, doc). |
| - Date Restrict | Restrict results by date with formats like d[number] (days), w[number] (weeks), m[number] (months). |
Output
The node outputs JSON data structured as follows:
- If Return Only Items is set to
false(default), the output JSON contains the full response from the Google Custom Search API, including metadata and the list of items. - If Return Only Items is
true, the output consists of individual items from the search results array, each emitted as a separate item in the workflow output. - Each output item includes the raw JSON data returned by the API for that particular search result.
- No binary data is produced by this node.
Dependencies
- Requires an API key credential and a Custom Search Engine ID configured in n8n credentials for Google Custom Search API access.
- Internet connectivity to call the Google Custom Search API endpoint.
- Proper configuration of the Google Custom Search Engine to allow the desired types of searches.
Troubleshooting
- No credentials found!: This error occurs if the required API key or Custom Search Engine ID credentials are missing. Ensure credentials are properly set up in n8n.
- Empty or no items in response: If the search query returns no results, the node outputs a message indicating no items were found. Verify the query and additional options for correctness.
- API quota exceeded or invalid API key: Errors related to API limits or authentication failures may occur. Check your Google Cloud Console for quota usage and ensure the API key is valid and enabled for Custom Search.
- Invalid parameter values: Parameters like number of results or start index must be within allowed ranges. Adjust these values accordingly.
- To continue processing other items even if one fails, enable the "Continue On Fail" option in the node settings.