Travis Horn
Travis Horn

Travis Horn

My Title Boxing Club schedule scraper

My Title Boxing Club schedule scraper

Travis Horn's photo
Travis Horn

Published on Sep 27, 2018

3 min read

I built a tool to scrape the latest schedule from Title’s website and output CSV data ready for import into Google Calendar.

Title Boxing Club is a fitness gym that holds trainer-led classes daily. On their website, each location has its own “homepage.” You can find the schedule for the next 11–12 days on this page. This is the only way to access the schedule online. There is no iCal or alternative transportable version. This makes it difficult to integrate their schedule with your own personal calendar.

I decided to create a command line utility that solves this problem.

If you feed this command a location’s homepage URL (for example: https://titleboxingclub.com/chicago-south-loop-il/), it will pull the available schedule and automatically create a CSV file.

The output can be saved to a file and imported into Google Calendar.

Installation

You will need to have Node.js installed already. Once it is installed, clone the repository and install dependencies.

> git clone [https://github.com/travishorn/title-schedule-scraper.git](https://github.com/travishorn/title-schedule-scraper.git)
> npm install

Usage

  1. Go to https://titleboxingclub.com

  2. Enter your zip or city and state in the search bar

  3. Click your location

  4. Copy the URL

Once you have the URL, simply run…

> node index [options] <url>

Options

  • -V, --version Output the version number

  • -c, --class &lt;name&gt; Only include the specified class type (ex: Boxing)

  • -d, --duration &lt;minutes&gt; Only include the classes that last the specified number of minutes (ex: 60)

  • -t, --trainer &lt;name&gt; Only include the specified trainer (ex: Jordan)

  • -h, --help Output usage information

Example

> node index -c Boxing -d 60 -t Jordan https://titleboxingclub.com/chicago-south-loop-il/

This command will output CSV data to the terminal. You can pipe this data to a file like so:

> node index https://titleboxingclub.com/chicago-south-loop-il/ > title-schedule.csv

Once you have the CSV, you can import it into Google Calendar if you wish.

The end resultThe end result

Since Title understandably only supplies the schedule for the next week or so, you’ll need to rerun the process periodically.

How does it work?

You can see the full source code on GitHub. travishorn/title-schedule-scraper Scrapes the latest schedule from Title's website and outputs a CSV file ready for import into Google Calendar. …github.com

Each time the command is run…

  1. CLI options are parsed by Commander

  2. The URL is requested by Axios

  3. Cheerio parses the returned HTML

  4. Details of each class are loaded into an array of objects

  5. If any options are specified (ex: Only kickboxing), the array is filter()ed for each one.

  6. The filtered array is fed into csv-writer, which uses Moment to parse and format the dates/times

  7. csv-writer outputs data in CSV format

 
Share this