Skip to content

Instantly share code, notes, and snippets.

@ellygaytor
Last active March 14, 2021 16:50
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ellygaytor/4f058e6ca1e06c70198bfde516832294 to your computer and use it in GitHub Desktop.
Send you a Pushover notification when TurboVax adds an availability

Vaxx Notify

This program will send you a Pushover notification when TurboVax adds an availability

Requires: firefox-gecko from apt, and pushover, selenium, and bs4 from pip.

You will need to fill in your own pushover api details.

import time, re
from bs4 import BeautifulSoup
from selenium import webdriver
from pushover import init, Client
public = Client("gzvd93ueixpk2u1rdej65pxpouui3j", api_token="a88er3ut9n3g77fw9hd45otp8jyfx2")
def createHeadlessFirefoxBrowser():
options = webdriver.FirefoxOptions()
options.add_argument('--headless')
return webdriver.Firefox(options=options)
driver = createHeadlessFirefoxBrowser()
print("Browser ready, starting")
url = "https://www.turbovax.info"
while True:
print("Starting extraction.")
driver.get(url)
time.sleep(1)
print("Extracted.")
html = driver.page_source
page=BeautifulSoup(html,'html.parser')
print(page.select('div.MuiPaper-root.MuiCard-root.MuiPaper-outlined.MuiPaper-rounded'))
cards=page.select('div.MuiGrid-root.MuiGrid-container.MuiGrid-spacing-xs-1')
print(str(len(cards))+" appointments. ")
for card in cards:
location=card.find('h3').text
url=card.find('a', href = re.compile(r'[/]([a-z]|[A-Z])\w+')).attrs['href']
tags=card.find_all(class_="MuiChip-root")
desc="| "
for tag in tags:
desc+=tag.text+" | "
times=card.find_all(class_="MuiTypography-body1")
for appttime in times:
desc+="\n"+appttime.text
public.send_message(desc, title="Vaccine appt. found: "+location, url=url, url_title="Book")
print("▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓")
time.sleep(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment