> ## Content Index
> Fetch the complete content index at: https://serpapi.com/blog/llms.txt
> Use this file to discover other available public pages before exploring further.

# Filter And Scrape Google Events With Python
- URL: https://serpapi.com/blog/filter-and-scrape-google-events-with-python/
- Published: 2024-09-13T22:00:55.000Z
- Updated: 2024-09-16T17:39:24.000Z
- Description: This blog post is a tutorial about scraping Google Events Results using Python and how to filter events data to get relevant results.
- Author: Sonika Arora
- Tags: GOOGLE EVENTS, Google

## **Why SerpApi?**

Usually, to scrape Google Events you would have to write a tedious long DIY solution using some tools like BeautifulSoup, Puppeteer, Requests, etc. When you use SerpApi, you can offload all the scraping work to us and simply use our APIs to get all the data you need. We have a vast network of proxies running the requests and also use necessary captcha solvers. These are required to avoid getting blocked, and would add a lot of complexity if you try to implement your own solution. 

SerpApi offers a structured and dependable method for accessing Google search results without the need for directly scraping Google. Acting as an intermediary, SerpApi manages the intricacies of scraping and returns structured JSON results. This allows you to save time and effort by avoiding the need to build your own Google scraper or rely on other web scraping tools.

Compared to our competitors, we offer superior speed and success rates and, we are able to collect more details from search results than any other provider. We are dedicated to providing the most performant APIs, a legal shield protecting your right to scrape public data, and premium customer service. 

💡

Check out our status graph here: <https://serpapi.com/status>

## About Our Google Events API

The [Google Events API](https://serpapi.com/google-events-api) allows a user to scrape events from the Google Events page. SerpApi is able to make sense of the information presented on the Google Events page and extract `title`, `date`, `address`, `link`, `ticket_info`, `venue`, `thumbnail` and more details about events.

To get started, you can try these searches: "best festivals" or "family friendly events" on our [playground](https://serpapi.com/playground?engine=google%5Fevents&q=Events+in+Austin). You can also add a location to your search query for more specific searches. For example, "concerts in Chicago".

Here is what you can scrape from the [Google Events page](https://www.google.com/search?q=Events&ibp=htl;events&uule=w+CAIQICIaQXVzdGluLFRleGFzLFVuaXRlZCBTdGF0ZXM&hl=en&gl=us&start=0#htivrt=events&htidocid=L2F1dGhvcml0eS9ob3Jpem9uL2NsdXN0ZXJlZF9ldmVudC8yMDI0LTA5LTEyfDU0MTA4ODkzNjQyNjc5OTk1ODg%3D&fpstate=tldetail): 

![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/2024/09/Screenshot-2024-09-09-at-3.45.35-PM-1.png)

## Getting Started With The Google Events API

To begin extracting Google Events data, first, create a [free account on serpapi.com](https://serpapi.com/users/sign%5Fup). You'll receive one hundred free search credits each month to explore the API.

- Get your SerpApi API Key from [this page](https://serpapi.com/manage-api-key).
- \[Optional but Recommended\] Set your API key in an environment variable, instead of directly pasting it in the code. Refer [here](https://developer.vonage.com/en/blog/python-environment-variables-a-primer) to understand more about using environment variables. For this tutorial, I have saved the API key in an environment variable named '`API_KEY`'.
- Next, on your local computer, you need to install the[google-search-results](https://pypi.org/project/google-search-results/) Python library: `pip install google-search-results`

> *As a side note: You can use this library to scrape search results from other Google Search pages and other search engines, not just Google Events.*

Then head to a code editor, and import the necessary libraries to use the Google Events API:

```python
from serpapi import GoogleSearch
import os, json

```

Following this, we can construct a search query and add the necessary parameters for making a request to the API:

```python
params = {
    # https://docs.python.org/3/library/os.html#os.getenv
    'api_key': os.getenv('API_KEY'),    # your serpapi api
    'q': 'Events in Austin',            # search query
    'engine': 'google_events',          # SerpApi search engine
    'hl': 'en',                         # language 
    'gl': 'us',                         # country of the search
    'start': 0                          # pagination
}

```

The expected response from the API is JSON formatted information on events relevant to the search query. SerpApi's Google Events API is able to extract `title`, `date`, `address`, `link`, `ticket_info`, `venue`, `thumbnail` and more.

The response is comprised of four parts:

1. `search_metadata`: This contains the basic data about the search such as `search_id`, `status`, endpoint details, timestamps, and more.
2. `search_parameters`: This specifies which API parameters have been selected for this particular search.
3. `search_information`: This contains extra information about the search such as if Google autocorrected a search query, and more.
4. `events_results`: A list of events scraped from Google Events corresponding to the search parameters.

Let's get the results from the API now. Since all the event details are in a list within the `events_results` key in the JSON response, let's write some code to get that list: 

```python
search = GoogleSearch(params)
results = search.get_dict()
google_events_results = results["events_results"]
```

The entire code file looks like this:

```python
from serpapi import GoogleSearch
import os, json

params = {
    # https://docs.python.org/3/library/os.html#os.getenv
    'api_key': os.getenv('API_KEY'),    # your serpapi api
    'q': 'Events in Austin',            # search query
    'engine': 'google_events',          # SerpApi search engine
    'hl': 'en',                         # language 
    'gl': 'us',                         # country of the search
    'start': 0                          # pagination
}

search = GoogleSearch(params)
results = search.get_dict()
google_events_results = results["events_results"]
```

The resulting `google_events_results` list will look something like this: 

```JSON
[
  {
    "title": "Open Mic Event",
    "date": {
      "start_date": "Sep 9",
      "when": "Sep 1, 7 PM – Oct 1, 2 AM"
    },
    "address": ["The Water Tank, 7309 McNeil Dr", "Austin, TX"],
    "link": "https://www.openmicaustin.com/MoreInfo/NDk0OCMjIyNURVhU",
    "event_location_map": {
      "image": "https://www.google.com/maps/vt/data=2iUNKQGKrw3GNEz8OUiTc6nGQvXYjJ6S0rspA4s0ACYjfllywq2B-VeGghoL7g4ALzVliGyjFnE0DIKiXSrtToYXqzL31afVWK90mqOvC2H-S98NjWQ",
      "link": "https://www.google.com/maps/place//data=!4m2!3m1!1s0x8644ccdf7d6a2d0f:0x850e4869e28806ef?sa=X&ved=2ahUKEwjru6bJtraIAxVdVTABHenmAbIQ9eIBegQIARAA&hl=en&gl=us",
      "serpapi_link": "https://serpapi.com/search.json?data=%214m2%213m1%211s0x8644ccdf7d6a2d0f%3A0x850e4869e28806ef&engine=google_maps&google_domain=google.com&hl=en&q=Events+in+Austin&start=0&type=place"
    },
    "ticket_info": [
      {
        "source": "Austin",
        "link": "https://www.openmicaustin.com/MoreInfo/NDk0OCMjIyNURVhU",
        "link_type": "more info"
      }
    ],
    "venue": {
      "name": "The Water Tank",
      "rating": 4.3,
      "reviews": 817,
      "link": "https://www.google.com/search?sca_esv=cc60acfe50cff9ff&sca_upv=1&hl=en&gl=us&q=The+Water+Tank&ludocid=9587680276327696111&ibp=gwp%3B0,7"
    },
    "thumbnail": "https://www.google.com/maps/vt/data=2iUNKQGKrw3GNEz8OUiTc6nGQvXYjJ6S0rspA4s0ACYjfllywq2B-VeGghoL7g4ALzVliGyjFnE0DIKiXSrtToYXqzL31afVWK90mqOvC2H-S98NjWQ"
  },
  ...
  ...
  ...
]
```

An alternate way to build the request is by heading to our [playground](https://serpapi.com/playground?engine=google%5Fevents&q=Events+in+Austin&location=Austin%2C+Texas%2C+United+States&gl=us&hl=en&start=0), and searching with the relevant parameter values, and then using the 'Export to Code' option as demonstrated below:

![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/2024/09/Screenshot-2024-09-09-at-12.12.29-PM-1.png)

#### More Information About Our Python Libraries

We have two separate Python libraries [serpapi](https://github.com/serpapi/serpapi-python) and [google-search-results](https://github.com/serpapi/google-search-results-python), and both work perfectly fine. However, `serpapi` is a new one, and all the examples you can find on our website are from the old one `google-search-results`. If you'd like to use our Python library with all the examples from our website, you should install the `google-search-results` module instead of `serpapi`.

For this blog post, I am using `google-search-results` because all of our documentation references this one. 

You may encounter issues if you have both libraries installed at the same time. If you have the old library installed and want to proceed with using our new library, please follow these steps:

1. Uninstall `google-search-results` module from your environment.
2. Make sure that neither `serpapi` nor `google-search-results` are installed at that stage.
3. Install `serpapi` module, for example with the following command if you're using `pip`: `pip install serpapi`

### Setting The Origin Of The Search With Location Specific Parameters

The `location` parameter defines where you want the search to originate from. If several locations match the location requested, we'll pick the most popular one. You can pick a location from the available ones at [/locations.json API](https://serpapi.com/locations-api) if you need more precise control. It is recommended to specify location at the city level in order to simulate a real user’s search. If location is omitted, the search may take on the location of the proxy. 

An alternative to using the `location` parameter is using the `uule` parameter. This parameter is the Google encoded location you want to use for the search. Please note: The `uule` and `location` parameters can’t be used together.

Here is an example of using the `location` parameter: 

```python
params = {
    # https://docs.python.org/3/library/os.html#os.getenv
    'api_key': os.getenv('API_KEY'),    # your serpapi api
    'q': 'Events',                      # search query
    'engine': 'google_events',          # SerpApi search engine
    'hl': 'en',                         # language 
    'gl': 'us',                         # country of the search
    'start': 0,                         # pagination
    'location': 'Austin, Texas, United States' # location
}
```

Playground Example: <https://serpapi.com/playground?engine=google%5Fevents&q=Events&location=Austin%2C+Texas%2C+United+States&gl=us&hl=en&start=0>

Alternatively, you can use the UULE for Austin, Texas, United States:

```python
params = {
    # https://docs.python.org/3/library/os.html#os.getenv
    'api_key': os.getenv('API_KEY'),    # your serpapi api
    'q': 'Events',                      # search query
    'engine': 'google_events',          # SerpApi search engine
    'hl': 'en',                         # language 
    'gl': 'us',                         # country of the search
    'start': 0,                         # pagination
    'uule': 'w+CAIQICISQXVzdGluLCBUZXhhcywgVVNB' # location
}

```

Playground Example: <https://serpapi.com/playground?engine=google%5Fevents&q=Events&uule=w%2BCAIQICISQXVzdGluLCBUZXhhcywgVVNB&gl=us&hl=en&start=0>

This will give you events relevant to the specified location or UULE. 

## Ways To Get Precise Event Results

In many cases, you may be looking for precise results over a certain time period or for certain types of events. For those cases, I want to highlight some ways to filter event results, and general tips which can help. 

### Filter Results By Date/Time Specific Parameters

The available options for the `htichips` parameter can help filter results by date/time:

`date:today` \- Today's Events  
`date:tomorrow` \- Tomorrow's Events  
`date:week` \- This Week's Events  
`date:next_week` \- Next Week's Events  
`date:month` \- This Month's Events  
`date:next_month` \- Next Month's Events

Here is an example of using this parameter to get results for today's events: 

```python
params = {
    # https://docs.python.org/3/library/os.html#os.getenv
    'api_key': os.getenv('API_KEY'),            # your serpapi api
    'q': 'Events in Austin',                    # search query
    'engine': 'google_events',                  # SerpApi search engine
    'hl': 'en',                                 # language 
    'gl': 'us',                                 # country of the search
    'start': 0,                                 # pagination
    'location': 'Austin, Texas, United States', # location
    'htichips': 'date:today'                    # filter by date
}
```

Playground Example: <https://serpapi.com/playground?engine=google%5Fevents&q=Events+in+Austin&location=Austin%2C+Texas%2C+United+States&gl=us&hl=en&start=0&htichips=date%3Atoday>

This will give you events happening today in Austin, Texas, United States. 

💡

You can also combine different filters by separating them with a comma. For example: specifying `'htichips':'date:today,date:tomorrow'` will give you results for today's and tomorrow's events.

### Tips To Use The Query Parameter To Get Precise Results

Every request has the required query parameter `q` which gets you relevant events. You can word your query in certain ways to get more precise results.

To get results for events happening next year in Austin, Texas, you can form your query parameter like this:

`'q' = 'Events in Austin in 2025'`

Playground Example: <https://serpapi.com/playground?engine=google%5Fevents&q=Events+in+Austin+in+2025&location=Austin%2C+Texas%2C+United+States&gl=us&hl=en&start=0>

To get results for events related to music happening this year, you can form your query parameter like this:

`'q' = 'Music related Events in 2024'`

Playground Example: <https://serpapi.com/playground?engine=google%5Fevents&q=Music+related+Events+in+2024&location=Austin%2C+Texas%2C+United+States&gl=us&hl=en&start=0>

To get results for events related to sports happening within 2 particular months of 2024, you can form your query parameter like this:

`'q' = 'Sports Related Events in October and November 2024'`

Playground Example: <https://serpapi.com/playground?engine=google%5Fevents&q=Sports+Related+Events+in+October+and+November+2024&location=Austin%2C+Texas%2C+United+States&gl=us&hl=en&start=0>

For all the examples above I've still specified the location parameter as Austin, Texas, United States because if the location is omitted, the search may take on the location of the proxy. You can specify it in your code like this:

`'location': 'Austin, Texas, United States'` 

Just like the examples above, you can modify the query in many different ways and get relevant results for your use case. 

## Pagination

By default, the Google Events API response returns 10 events at a time. 

If you'd like to access more results, you need to paginate using the start parameter. Here are a couple of examples:

1st page of results - First 10 results (use `start=0` parameter):

💡

The start parameter is optional in this case, because `start = 0` by default.

<https://serpapi.com/playground?engine=google%5Fevents&q=Events+in+Austin&location=Austin%2C+Texas%2C+United+States&gl=us&hl=en&start=0>

2nd page of results - Next 10 results (use `start=10` parameter):  
<https://serpapi.com/playground?engine=google%5Fevents&q=Events+in+Austin&location=Austin%2C+Texas%2C+United+States&gl=us&hl=en&start=10>

3rd page of results - Next 10 results (use `start=20` parameter):  
<https://serpapi.com/playground?engine=google%5Fevents&q=Events+in+Austin&location=Austin%2C+Texas%2C+United+States&gl=us&hl=en&start=20>

## Conclusion

We've covered how to scrape Google Events with SerpApi's [Google Events API](https://serpapi.com/google-events-api) using SerpApi's Python library.

I hope you found this tutorial helpful. If you have any questions, don't hesitate to reach out to me at sonika@serpapi.com.

## Relevant Links

#### Documentation

- [Google Events API](https://serpapi.com/google-events-api)
- [API Status Graph](https://serpapi.com/status)
- [Our Playground](https://serpapi.com/playground)

#### Related Posts

[Scrape Google Events Results with PythonThis blog post is a step-by-step tutorial about scraping Google Events Results using Python.![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/size/w256h256/2021/07/serpapi-favicon.png)SerpApiArtur Chukhrai![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/size/w100/2022/08/photo_2022-07-28_20-49-00.jpg)](https://serpapi.com/blog/scrape-google-events-results-with-python/)

[Web Scraping Google Events Results with NodejsA step-by-step tutorial on creating a Google Events Results web scraper in Nodejs.![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/size/w256h256/2021/07/serpapi-favicon.png)SerpApiMikhail Zub![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/size/w100/2021/10/SAM_92531.JPG)](https://serpapi.com/blog/web-scraping-google-events-results-with-nodejs/)

[How to Scrape Google Events ResultsGoogle has many results for your search keywords. It’s not a surprise that Google can give you a list of activities and events results when you search: “Events in Austin”. There are many types of Google Events: concerts, festivals, sports games, conferences, local meetups, and other gatherings or happenings. Google![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/size/w256h256/2021/07/serpapi-favicon.png)SerpApiAndy L![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/size/w100/2023/02/Screen-Shot-2022-05-30-at-22.17.37.png)](https://serpapi.com/blog/how-to-scrape-google-events-results/)