John G.
John G.

Reputation: 41

Google API for the Search Result Events

I'm looking for the correct API for the events that show up in a regular Google Search, the ones that are structured (with name, datetime, location)

Any help or guidance is appreciated

I have tried the Custom Search with no luck, and also the Calendar API (which seems to require a calendar ID, more so for personal calendars or targeted public ones)

Upvotes: 4

Views: 3531

Answers (2)

I had a quick look - while I didn't find a fully programatic API yet, here are two things that can get you started on more:

  • How to search the events page directly: use the following URL schema: https://www.google.com/search?q=cool+conferences&oq=cool+conferences&ibp=htl;events&rciv=evn - replacing "cool+conferences" with any string you like - this can let you create dynamic URLs for event searches.

  • How to access event metadata for a given page - google is pushing a standard to structure data on webpages to support "smart" searches such as for events. They are using a data structure called JSON-ld. More details. If you want to read such metadata from a webpage, here is one scraper I have found that does that - extruct (though I didn't get a change to test it yet).

Hope this helps :)

Upvotes: 1

Hartator
Hartator

Reputation: 5145

We've actually just made an API to scrape the Google event results. You can query it directly like this:

https://serpapi.com/search.json?engine=google_events&q=Events+in+Austin

Or if you are using Ruby, you can do something like this:

require 'google_search_results' 

params = {
  engine: "google_events",
  q: "Events in Austin",
}

client = GoogleSearchResults.new(params)
events_results = client.get_hash[:events_results]

Some documentation: https://serpapi.com/google-events-api

Upvotes: 1

Related Questions