Skip to content

scotthooker/nuffield-cli

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nuffield-cli

A set of command-line to make it easier to book Nuffield Health gym classes.

Why (start with why)

With Nuffield Health booking system (https://www.nuffieldhealth.com/account/homepage), you usually have to book 8 days in advance at 7 am to be sure to have space in your classes.

It is not ideal since:

  • you need to book several times a week if you attend several classes,
  • if you forget to book at 7am, the class might be full.

With nuffield-cli:

  • you can book all your classes for the next few weeks in one day,
  • you will be the only one not to have the 8 days limitation, so you can be the first one to book all your classes.

Configuration

You need to find your gym id, your member id and your Auth-Token (it will expire regularly, so you will have to repeat this procedure regularly):

# Check what you have in place of YOUR_GYM_ID_HERE / YOUR_MEMBER_ID / YOUR_AUTH_TOKEN_HERE:
curl 'https://nuffield.bookingbug.com/api/v1/YOUR_GYM_ID_HERE/basket/checkout' -H 'Origin: https://www.nuffieldhealth.com' -H 'App-Key: f0bc4f65f4fbfe7b4b3b7264b655f5eb' -H 'Accept-Language: en-GB,en;q=0.9,en-US;q=0.8,fr;q=0.7' -H 'App-Id: f6b16c23' -H 'Accept-Encoding: gzip, deflate, br' -H 'Connection: keep-alive' -H 'Pragma: no-cache' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36' -H 'Content-Type: application/json' -H 'Auth-Token: YOUR_AUTH_TOKEN_HERE' -H 'Accept: application/hal+json,application/json' -H 'Cache-Control: no-cache' -H 'Referer: https://www.nuffieldhealth.com/gyms/city/timetable' -H 'DNT: 1' --data-binary '{"client":{"id":YOUR_MEMBER_ID}}' --compressed

Requirements

  • Instructions for Ubuntu:
# Install jq (Command-line JSON processor)
sudo apt install jq
  • Instructions for Mac OSX:

Using Homebrew (For details about installing homebrew, see http://brew.sh):

brew install jq

Usage

A sample script is provided: book-my-classes:

# Edit the script with your ids and with the classes that you want to book and execute it every 2 weeks
vi book-my-classes

# Edit the script book-my-classes and then execute:
./book-my-classes -s "2019-01-21"

# Or specify another date, e.g. Monday in 2 weeks (Next Monday + 1 week):
./book-my-classes -s "Monday + 1 week"

Or feel free to use directly the command line tools:

# Print usage
./list-classes -h
./filter-classes -h
./book-class -h

# List all the classes available to book on 01/01/2019
./list-classes -g 1234 -d "2019-01-01" -b

# Book the Yoga class at 06:35 on 01/01/2019
./list-classes -g 1234 -d "2019-01-01" -b | ./filter-classes -n "YOGA" -t "06:35" | ./book-class -a "AnUjfgrTyuihfTgjklMkdd" -g 1234 -m 123456

# Book any Yoga class on 01/01/2019
./list-classes -g 1234 -d "2019-01-01" -b | ./filter-classes -n "YOGA" | ./book-class -a "AnUjfgrTyuihfTgjklMkdd" -g 1234 -m 123456

About

Make it easier to book Nuffield Health gym classes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Shell 100.0%