In the interest of saving time and completing tedious tasks
View Demo
·
Report Bug
·
Request Feature
Table of Contents
![Web Scraper And Reservation Bot Gif]
Why? For the last couple of years, I have been attending a sailing school to obtain my windsurfing instructor's degree. Every year, the process of signing up is time consuming and stressful as spots quickly decrease and the rules state you must renew your reservations - which entails going to the website, signing up for every course again and clicking through all of the verification - every three days until you are ready to make the financial commitment. To avoid this yearly time consuming and tedious process, I decided to build a web scraper and reservation bot that could deal with this for me.
TL;DR I like to build things to make my life easier.
Features include:
- Prompts User: Prompts the user for login credentials to the school
- Logs In: Logs into the website after prompting the user for their email, password and desired course
- Scrapes the page: Scrapes the location, name, date and number of spots left for the course (note: the number of spots left per course is not public information in that it is not visible to anyone visiting the website.)
- Sends Summarized Data: Summarizes all of the extracted data into a human readable summary sent in an email after every run
- Makes a Reservation: Makes a reservation for the specific course on the specific date
Note: To make a reservation, a Les Glénans account is required. If the email and password you provided when prompted do not correspond to a registered account the program will return before making a reservation but after sending the summary of your requested courses.
To get a local copy up and running follow these steps.
You will need to have Node.js and npm package manager installed. If you do not, visit Node.js and download the version labeled LTS. To install the latest version of npm run npm install npm@latest -g
. Ensure that both are correctly installed using node -v
and npm -v
.
-
Clone the repo
git clone https://github.com/JuliaGrandury/web-scraperandbot.git
-
Install dependencies
npm cheerio puppeteer prompts mocha chai dotenv nodemailer
-
Create a .env file where with two variables which will be used as the sender for the sendEmail function:
MAIL_EMAIL = 'your email'
andMAIL_PASSWORD = 'your password'
. You will need to disable two factor authorization and allow less trusted apps in your Gmail settings. -
Run the application using
npm run start
-
Run the test suite using
npm test
or a specific file usingnpm test <filepath>
- Sending summary email of results
- Expanding sign in to the email and password provided
- Finish unit testing
- Fix formatting of email body to be clearer
- Submitting reservation of courses
- Confirmation email that reservation was made
- Automating as job every three days
Some helpful resources I used for various parts of my project.
- On using RegExp and .split for formatting while keeping the separator in the result: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split
- On using nodemailer: https://www.youtube.com/watch?v=Va9UKGs1bwI
- On array testing in Mocha: https://victorleungtw.medium.com/testing-with-mocha-array-comparison-e9a45b57df27
Distributed under the MIT License. See LICENSE.txt
for more information.
Julia Grandury - [email protected]
Project Link: https://github.com/JuliaGrandury/web-scraperandbot