Giter Club home page Giter Club logo

puregym-tracker's Introduction

puregym-tracker

Fork of p-karanthaker's puregym-tracker (https://github.com/p-karanthaker/puregym-tracker)

Simple scripts written to scrape gym activity data from the PureGym website members' area.

Works with:

  • Windows (requires PowerShell 3 or higher)
  • Linux
  • OSX

The script logs into the PureGym website using your credentials, scrapes the gym activity from the members' webpage. Then writes the data to a CSV file along with a timestamp. Use the data as it is or import it into a graphing tool to visualise the gym activity trends over time!

It can be scheduled to scrape data at any interval you wish. The following instructions schedule the script to run every 5 minutes.

Important things to note

  • You must be a member of PureGym in order to use these scripts.
  • When the gym activity is above 100, the website will only display '100+ people' so the script will record it as 100 people.
  • Some gyms may pad their numbers. As a result you may see, for example, 20 people being logged in the gym when actually nobody is in the gym at that time.
  • The script writes to file using Unix line endings for the Bash script and Windows line endings for the PowerShell script.

General Intructions

Clone from GitHub
Clone the project in your terminal by typing:
git clone https://github.com/p-karanthaker/puregym-tracker.git
This will clone it to your current working directory. Change to another directory if you don't want it stored in your current directory.

Execution permissions The script needs to be executable in order to run.
Use command chmod 744 puregym-tracker.sh in your terminal to allow execution.
For Windows you may need to set your execution policy for PowerShell.

Manually Running the Script
It is a good idea to manually run the script once before setting up scheduled tasks.

For Bash, the script can be run from the terminal by changing directory to its location and entering
./puregym-tracker.sh LOGIN_EMAIL LOGIN_PIN.

For Windows, the script can be run from a PowerShell console by changing directory to its location and entering .\puregym-tracker.ps1 -email LOGIN_EMAIL -pin LOGIN_PIN.

The script should run with no errors and the CSV file should appear in the logs directory of the puregym-tracker.

Windows

Setting up Task Scheduling

  1. Import the puregym-tracker.xml into Task Scheduler.
  2. If you want it to run when you're not logged in, select the radio button on the window that pops up.
  3. Go to the Actions tab and edit the action listed.
  4. In Add arguments, replace path\to\puregym-tracker.ps1 with its real path.
  5. Replace LOGIN_EMAIL and LOGIN_PIN with your PureGym login credentials.
  6. Click OK and OK again when you're done. The task will run within the next 5 minutes.

Linux and OSX

Setting up a CRON job
In your terminal enter crontab -e. This will open a Vi editor.
Press i to go into insert mode.
On a new line enter */5 * * * * /path/to/puregym-tracker.sh LOGIN_EMAIL LOGIN_PIN. Make sure the correct full path is provided.
Press Esc, then type :wq followed by pressing Enter to save the file.
The job will run within the next 5 minutes.

puregym-tracker's People

Contributors

p-karanthaker avatar nickrenwick avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.