A Python Bot to Join my Zoom Class

 A python code to join my Zoom class. I made a bot that looks up my daily schedule in Google Calendar. It gets data from it and checks each of the event. From each event, it checks for the teacher who's taking the class, the time when the class starts, the meeting ID for the class and the password for each class. 


Next, when it's time for the class, the bot goes to the Zoom website and joins a meeting. It opens the Desktop Client to join the meeting. 

Then the bot enters the Meeting ID in the desktop Client and enters the password to enter the meeting.


For the bot, I used Selenium web driver to access web and get data. It also uses PyAutoGUI to use the keyboard and mouse to enter meeting ID and password. 

You can check the code below:


import selenium
from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
import re
from datetime import datetime
import pyautogui
options = webdriver.ChromeOptions()
options.add_argument("--user-data-dir=C:\\Users\\pc_name\\AppData\\Local\\Google\\Chrome\\User Data") #chrome profile location
options.add_argument('--profile-directory=Profile 2') #chrome profile
driver = webdriver.Chrome(executable_path="C:\\Users\\chromedriver.exe", options=options)
driver.maximize_window() #opening calendar to get data of class
driver.get("https://calendar.google.com/")
time.sleep(5)
detail=driver.find_elements_by_class_name('ynRLnc')
raw=list()
for i in range(len(detail)):
raw.append(detail[i].text)
print(raw) #getting all data from Google Calendar
driver.quit()
file1 = open("svae.txt","w") #cleaning the data,
file1.writelines(raw)
file1.close()
file1 = open("svae.txt","r")
l=file1.readlines()
final=list()
cname=list()
cstart=list()
wrte=list()
for i in l:
d=re.findall(r'(\d{1,2})([.:](\d{1,2}))?[ ]?(am|pm)?', i)
search=i.split(',')
for name in search:
if "Online Class" in name or "Online class" in name or "OLYMPIAD" in name or "Online TEST" in name:
cname.append(name)
for j in d:
if "am" in j or "pm" in j:
lt=list(j)
tm=list()
tm.append(lt[0])
if len(lt[2])==0:
lt[2]="00"
tm.append(lt[2])
tm.append(lt[3])
final.append(tm)
print(cname)
for n in range(int(len(final)/2)):
o1=final[2*n][0]+":"+final[2*n][1]+" "+final[2*n][2]
cstart.append(final[2*n][0]+":"+final[2*n][1]+final[2*n][2]+" ")
x1=final[2*n+1][0]+":"+final[2*n+1][1]+" "+final[2*n+1][2]
print(n)
c=cname[n]
fc=o1+" to "+x1+" - "+c+"\n"
wrte.append(fc)
print(fc)
a=1
file1 = open("class.txt","w")
file1.writelines(wrte)
file1.close()
fle=open("start.txt", "w")
fle.writelines(cstart)
fle.close()
file1 = open("start.txt","r")
l=file1.readlines()
j=list()
for i in l:
times=i.split()
print(times)
part=list()
for tim in times: #starting to check time
pa=str()
print(times.index(tim))
for letter in tim:
if str(letter).isalpha():
pa+=str(letter)
if len(pa)>1:
part.append(pa)
print(part)
x=len(part)
tno=list() #time in numbers
for tim1 in times:
ps=str()
for let in tim1:
if let.isalpha():
continue
else:
ps+=let
tno.append(ps)
num=0
asdc=list()
for i in range(len(part)):
if part[i]=='pm':
asdc.append(i)
else:
tm1=tno[i]
tm2=tm1.split(':')
if len(tm2[0])==1:
tm2[0]="0"+tm2[0]
tno[i]=':'.join(tm2)
for n in asdc:
mc=tno[n]
mc=mc.split(':')
dc=int(mc[0])
dc+=12
asa=mc[1]
mc[0]=str(dc)
vsdc=":".join(mc)
tno[n]=vsdc
jkl=len(tno)
print(tno)
mnb=0
while jkl>0:
time.sleep(1)
now = datetime.now()
current_time = now.strftime("%H:%M")
if mnb>30:
print('...')
mnb=0
mnb+=1
if current_time in tno: #time for class
options = webdriver.ChromeOptions()
options.add_argument("--user-data-dir=C:\\Users\\sujal\\AppData\\Local\\Google\\Chrome\\User Data")
options.add_argument('--profile-directory=Profile 2')
driver = webdriver.Chrome(executable_path="C:\\Users\\chromedriver.exe", options=options)
driver.maximize_window()
driver.get("https://zoom.us/signin")
time.sleep(5)
driver.find_element_by_link_text("Google").click()
x=driver.find_element_by_xpath('//*[@id="view_container"]/div/div/div[2]/div/div[1]/div/form/span/section/div/div/div/div/ul/li[1]/div')
x.click()
time.sleep(5)
driver.find_element_by_link_text('JOIN A MEETING').click()
inp=driver.find_element_by_id('join-confno')
inp.send_keys('588 930 7086')
inp.send_keys(Keys.RETURN)
time.sleep(10)
pyautogui.write('9876')
pyautogui.press('enter')
jkl-=1
print('joined class LOL')
driver.quit()
view raw joinclass.py hosted with ❤ by GitHub

Comments