Track Museum Availability with AI

5 min read

|

Nov 28 2024

Recently, I went on a trip to Dublin and wanted to visit the famous Kilmainham Gaol Museum. It used to be a prison and now it’s a museum that holds a big chunk of Irish history.

It’s very popular so it solds out quickly. I tried booking it three weeks in advance, but it was already fully booked for the dates we planned to be there. So, instead of giving up, I had an idea: People cancel bookings - I might be able to find us a slot if I check it everyday.

Since doing it manually everyday is too much work for an automation freak like myself, I decided to code something up real quick. It was late in the day when this happened and I was (am) lazy, so I assigned most of the job to AI - in this case, Claude.

I knew exactly what needed to be done, I just didn’t want to write the code. Here’s the idea:

  • Every day, our bot will run and scrape a bit of the Kilmainham Gaol Museum website.
  • It will then extract the relevant information from the html page and detect if there’s any availability for the dates of our trip.
  • It will send me a telegram message reporting about it’s findings.
  • This entire process would run free of charge in github actions.
  • It will use the Telegram Bot API to automatically send messages.

All I had to give Claude was some information on how to navigate to the relevant page and what html should it look for.

After checking Kilmainham Gaol Museum website, we can see that the availability page has an url like this:

https://kilmainhamgaol.admit-one.eu/?p=calendar&ev=TOUR&mn=202412

Where mn is the month and year that we want to check. For example, 202412 is December 2024.

In this page, if we check the HTML source code, we can see that the availability is displayed in a table with the class OPW_calendarTable:

I copied that table code and send it to claude along with the following prompt:

I need a quick script that: 

- Scrapes the Kilmainham Gaol Museum website (kilmainhamgaolmuseum.ie) daily. For that, it should go to a link like this:

https://kilmainhamgaol.admit-one.eu/?p=calendar&ev=TOUR&mn=202412

where mn is the year and month in YYYYMM format. 

- Checks if there's any availability between 2 dates provided. If it's 8, 9 and 10 of december for example, it should go to mn=202412 and see if those dates are available.

- Sends me a Telegram message with the results and the relevant links
- Can run on GitHub Actions for free , and runs everyday at 15h

The script should be in Python and use the Telegram Bot API. Also give me the github action script. I'll set up the GitHub secrets for the bot token.  

Atached you can find a piece of the html of that page, the relevant table

You can see our full conversation here.

It first tried to use the telegram library and I knew from experience that it is way too much for such a simple task. I told it to avoid it, and just use plain old requests. It created a few functions, where the most relevant one was something like this:


def main():
    # Get environment variables
    bot_token = os.environ.get('TELEGRAM_BOT_TOKEN')
    chat_id = os.environ.get('TELEGRAM_CHAT_ID')
    
    # Example: Check availability for dates in December 2024
    year = 2024
    month = 12
    target_dates = [8, 9, 10]
    
    # Check availability
    available_dates = check_tour_availability(year, month, target_dates)
    
    # Prepare message
    if available_dates:
        message = f"Available Kilmainham Gaol Tours in {year}-{month:02d}:\n"
        for date, link in available_dates.items():
            message += f"{date}: {link}\n"
    else:
        message = f"No available tours found for {year}-{month:02d}"
    
    # Send Telegram message
    if bot_token and chat_id:
        send_telegram_message(bot_token, chat_id, message)
    else:
        print("Telegram bot token or chat ID not set")

You can find the final result here.

I saved the python file locally, installed the required libraries (requests and beautifulsoup4) and quickly ran it with:

python kilmainham_availability_checker.py

Note: I already had the TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID set up in my environment variables (if you don’t have them yet, you can follow this tutorial).

It worked perfectly - it sent me a telegram message with something like this:

Available Kilmainham Gaol Tours in 2024-12:
9: https://kilmainhamgaol.admit-one.eu/?p=details&ga=1&dt=20241209&ev=TOUR

which was the only day between 8, 9 and 10 of December that had a free slot. Amazing!

I also noticed that the github action script was not going to run whenever I pushed to the main branch, so I asked Claude to fix it and it delivered again:

on:
  schedule:
    # Run daily at 3 PM UTC
    - cron: '0 15 * * *'
  push:
    branches:
      - main
  workflow_dispatch:
    # Allow manual triggering

    # Jobs...

I created the github repo and kept receiving messages everyday with the availability of the museum.

It did help me find a spot - in the day of our flight to Dublin, I got a message saying that there was a spot available for the next day at 9am. However, we arrived quite late that night, so we decided to skip an early morning visit to the museum. Maybe next time!

Sometimes AI is just what you need to create a simple and quick tool to solve a stupid problem. It took me less than 10 minutes to put this up and live and it made me go to bed earlier. Sometimes, that’s all you need.

PS: this trip actually happened some time ago, all the dates here are fictional because I don’t want you, stranger on the internet, to know about my personal life (that much).

Published: Nov 28 2024
Updated: Nov 28 2024