Skip to content

Python script for scraping Puregym occupancy data from the members' area of their website. Optional bash script for automating and saving the data to csv.

Notifications You must be signed in to change notification settings

jakub-sekula/puregym-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

puregym-scraper

Simple script for scraping Puregym occupancy data.

Usage

  1. Clone this repository

git clone https://github.com/jakub-sekula/puregym-scraper && cd puregym-scraper

  1. Activate virtual environment

python -m venv venv & source venv/bin/activate

  1. Install dependencies

pip install -r requirements.txt

  1. Run script and enter your credentials as arguments on the command line

python scraper.py username password

Output

The script outputs the current number of people in the default gym for your account and the time it took to perform the data retrieval.

The format of the output is as follows:

$ python scraper.py <username> <password>
113
Finished in  21.584192991256714 s

Caveats

This script uses requests and beautifulsoup4 to recrete the login flow to the members' area of the Puregym website. For some reason, the Puregym servers are really really slow, so the login process takes around 20 seconds.

A better way to do this would be to call the Puregym API directly, like in puregym-attendance created by 2t6h. However, I wanted to figure out a way to do this without having any knowledge of the backend setup and API endpoints.

In any case, the outputs of both scripts are the same, but the API method is much faster, taking around 6-7 seconds on average.

Bonus

I've also included a shell script that I used to set up an automation and save the outputs of the scraper to a csv file for analysing later. You can use this with cron to run the script at regular intervals. I have been using it to log data every minute and it works great.

About

Python script for scraping Puregym occupancy data from the members' area of their website. Optional bash script for automating and saving the data to csv.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published