-
Notifications
You must be signed in to change notification settings - Fork 0
/
covid-appointment.py
105 lines (95 loc) · 3.73 KB
/
covid-appointment.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import time
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
import telebot
from telethon.sync import TelegramClient
from telethon.tl.types import InputPeerUser, InputPeerChannel
from telethon import TelegramClient, sync, events
# get your api_id, api_hash, token
# from telegram
api_id = 11111
api_hash = '######'
token = '#####'
# your phone number
phone = '+19999999'
browser = webdriver.Chrome("./chromedriver.exe")
available = False
while not available:
try:
browser.get("https://snhd.info/get-vaccine/lvccp")
time.sleep(5)
clickMenu = browser.find_element_by_id("dose")
clickMenu.click()
time.sleep(0.1)
clickMenu = browser.find_element_by_id("mat-option-3")
clickMenu.click()
time.sleep(0.1)
clickMenu = browser.find_element_by_id("whereDidYouGetYourFirstDose")
clickMenu.click()
time.sleep(0.1)
clickMenu = browser.find_element_by_id("mat-option-58")
clickMenu.click()
time.sleep(0.1)
clickMenu = browser.find_element_by_css_selector("span.mat-button-wrapper")
clickMenu.click()
time.sleep(1)
clickMenu = browser.find_element_by_id("eligibleGroup")
clickMenu.click()
time.sleep(0.1)
clickMenu = browser.find_element_by_id("mat-option-4")
clickMenu.click()
time.sleep(0.5)
actions = ActionChains(browser)
actions = actions.send_keys(Keys.TAB)
actions.perform()
actions = actions.send_keys(Keys.TAB)
actions.perform()
actions = actions.send_keys(Keys.ENTER)
actions.perform()
time.sleep(0.5)
clickMenu = browser.find_element_by_id("isInIsolation")
clickMenu.click()
time.sleep(0.1)
clickMenu = browser.find_element_by_id("mat-option-22")
clickMenu.click()
time.sleep(0.1)
clickMenu = browser.find_element_by_id("mat-select-5")
clickMenu.click()
time.sleep(0.1)
clickMenu = browser.find_element_by_id("mat-option-27")
time.sleep(0.5)
clickMenu.click()
time.sleep(4)
except Exception as e:
print(e)
print("Error. Restarting!")
try:
clickMenu = browser.find_element_by_id("mat-button-toggle-1-button")
if clickMenu.is_displayed():
# creating a telegram session and assigning
# it to a variable client
client = TelegramClient('session', api_id, api_hash)
# connecting and building the session
client.connect()
# in case of script ran first time it will
# ask either to input token or otp sent to
# number or sent or your telegram id
if not client.is_user_authorized():
client.send_code_request(phone)
# signing in the client
client.sign_in(phone, input('Enter the code: '))
try:
# sending message using telegram client
client.send_message('+177777777', 'The Vaccine Appointment is available!', parse_mode='html')
except Exception as e:
# there may be many error coming in while like peer
# error, wrong access_hash, flood_error, etc
print(e)
# disconnecting the telegram session
print("Appointment Found. Message Sent")
client.disconnect()
available = True
except NoSuchElementException as e:
print("No Appointments Available")