Get Google Search Results (JS)
SERP API to scrape Google search results using Olostep and a Javascript code snippet.
Google Search Scraper with Olostep
This guide demonstrates how to use the Olostep API to scrape Google search results and parse them into structured JSON data. This is particularly useful for automating research tasks, gathering competitive intelligence, or building applications that require search data.
How It Works
The example below in Javascript shows how to search for a LinkedIn profile URL of a specific person (Patrick Collison) using Google search and Olostep’s google search parser @olostep/google-search
Response Format
When you make a request to the Olostep API with the Google Search parser, you’ll receive a JSON response like the example below:
The response contains:
- Basic request information:
id
,object
,created
timestamp,url_to_scrape
- Result object with URLs to access different formats of the data
- json_content with structured search results including:
searchParameters
: Information about the search queryknowledgeGraph
: Detailed information about the search subject (when available)organic
: List of search results with title, link, position, and snippetpeopleAlsoAsk
: Related questions that users commonly search forrelatedSearches
: Suggested related search queries
json_content
is the main part of the response with the structured search results. You can access the JSON content directly from the response or use the hosted URL provided in the response.
Structured Response: json_content
Olostep provides also a hosted JSON file with the structured search results. You can access the JSON file using the json_hosted_url
field in the response:
- Structured JSON: View example JSON
If you want to also get the HTML and Markdown content of the search results, you can include these formats in the formats
parameter and Olostep will return them in the response and provide hosted URLs for each format.
Example Usage Scenarios
1. Finding LinkedIn Profiles
In the example above, we’re searching for Patrick Collison’s LinkedIn profile by using the search query site:linkedin.com Patrick Collison
. This technique can be used to find professional profiles for any person.
2. Researching Companies
You can modify the query to search for company information:
3. Tracking News Articles
Find recent news about a specific topic:
4. Competitive Analysis
Monitor competitors’ online presence:
Important Notes
- Search Parameters: The
gl=us
andhl=en
parameters set the geolocation to US and language to English. Adjust these as needed.
Conclusion
Once you have the search results data, you can:
- Parse specific data points of interest
- Store the results in a database
- Build a custom search interface
- Trigger actions based on search findings
- Integrate with other APIs or services
If you need to extract different data points or customize the search behavior, please get in touch at ‘info@olostep.com`