├── config.json ├── requirements.txt ├── README.md └── main.py /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "email": "", 3 | "password": "", 4 | } 5 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | astroid==2.4.2 2 | certifi==2020.6.20 3 | chardet==3.0.4 4 | colorama==0.4.3 5 | configparser==5.0.0 6 | crayons==0.3.1 7 | idna==2.10 8 | isort==4.3.21 9 | lazy-object-proxy==1.4.3 10 | mccabe==0.6.1 11 | pylint==2.5.3 12 | python-nmap==0.6.1 13 | requests==2.24.0 14 | selenium==3.141.0 15 | six==1.15.0 16 | toml==0.10.1 17 | urllib3==1.25.9 18 | webdriver-manager==3.2.1 19 | wrapt==1.12.1 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Join Google Meet automatically with camera and microphone turned off 2 | 3 | ### This python script script uses Selenium to log into your gmail account at first to get all around access of google services and then joins the meeting link! 4 | 5 | ## Installation 6 | 7 | ### Navigate to the directory where you want to have this file. 8 | ### Clone this repo with ` $ git clone https://github.com/utkrixx/Google-Meet-automation-with-Python.git ` 9 | ### The required packages can be installed with 10 | 11 | > `pip install -r requirements.txt` 12 | 13 | ### A config.json file is used to store passwords, rather than hardcoding the password in the code. 14 | 15 | ## You should change the meeting links and time according to your needs from the ` main.py ` file. 16 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | 2 | from selenium import webdriver 3 | from selenium.webdriver.common.keys import Keys 4 | from selenium.webdriver.chrome.options import Options 5 | import datetime 6 | import time 7 | import signal 8 | 9 | 10 | 11 | # Code will stop executing after 720 seconds == 10 mins. 12 | signal.alarm(720) 13 | 14 | 15 | 16 | now = datetime.datetime.now() 17 | current_time = now.strftime("%H:%M / %A") 18 | # %A is to get the name of the Day! 19 | justtime = now.strftime("%H:%M") 20 | print (current_time) 21 | 22 | # Code to allow access for Microphone, Camera and notifications 23 | # 0 is disable and 1 is allow. 24 | opt = Options() 25 | opt.add_argument("--disable-infobars") 26 | opt.add_argument("start-maximized") 27 | opt.add_argument("--disable-extensions") 28 | # Pass the argument 1 to allow and 2 to block 29 | opt.add_experimental_option("prefs", { \ 30 | "profile.default_content_setting_values.media_stream_mic": 1, 31 | "profile.default_content_setting_values.media_stream_camera": 1, 32 | "profile.default_content_setting_values.geolocation": 1, 33 | "profile.default_content_setting_values.notifications": 1 34 | }) 35 | 36 | # Conditions to check time and append if necessary 37 | while justtime != "09:50" or justtime != "13:50" or justtime != "15:20" or justtime != "16:50": 38 | time.sleep(20) 39 | now = datetime.datetime.now() 40 | current_time = now.strftime("%H:%M / %A") 41 | justtime = now.strftime("%H:%M") 42 | print(justtime) 43 | if justtime == "09:50" or justtime == "13:50" or justtime == "15:20" or justtime == "16:50": 44 | print("Class is going to start in 10 Minutes.") 45 | break 46 | 47 | # directing to the link to be visited; The program first logs into gmail for all around access of google services. 48 | def gmail_login(): 49 | driver.get("https://accounts.google.com/ServiceLogin?service=mail&passive=true&rm=false&continue=https://mail.google.com/mail/&ss=1&scc=1<mpl=default<mplcache=2&emr=1&osid=1#identifier") 50 | time.sleep(4) 51 | driver.find_element_by_xpath("//input[@name='identifier']").send_keys("####EMAIL ADDRESS HERE####") 52 | time.sleep(2) 53 | # Next Button: 54 | driver.find_element_by_xpath("//*[@id='identifierNext']/div/button/div[2]").click() 55 | time.sleep(5) 56 | #Password: 57 | driver.find_element_by_xpath("//input[@name='password']").send_keys("#your email password herer###") 58 | time.sleep(2) 59 | #next button: 60 | driver.find_element_by_xpath("//*[@id='passwordNext']/div/button").click() 61 | time.sleep(5) 62 | # #opening Meet: 63 | driver.get(sub) 64 | driver.refresh() 65 | time.sleep(5) 66 | # Turning off video 67 | driver.find_element_by_xpath("//*[@id='yDmH0d']/c-wiz/div/div/div[4]/div[3]/div/div[2]/div/div/div[1]/div[1]/div[3]/div[2]/div/div").click() 68 | time.sleep(5) 69 | # turning off audio 70 | driver.find_element_by_xpath("//*[@id='yDmH0d']/c-wiz/div/div/div[4]/div[3]/div/div[2]/div/div/div[1]/div[1]/div[3]/div[1]/div/div/div").click() 71 | time.sleep(180) 72 | # Join class 73 | driver.find_element_by_xpath("//*[@id='yDmH0d']/c-wiz/div/div/div[4]/div[3]/div/div[2]/div/div/div[2]/div/div[2]/div/div[1]/div[1]/span").click() 74 | 75 | # Conditions which checks the time and goes to the classlink if Classes are happening at that time. 76 | 77 | # Math 78 | if current_time == "09:50 / Monday" or current_time == "16:50 / Tuesday" or current_time == "13:50 / Thursday" or current_time == "15:20 / Friday": 79 | #sub is the class id with the meet link. sub changes with the time accoriding to the class. 80 | sub = "###hangouts meet links here with time variations###" 81 | driver = webdriver.Chrome(chrome_options=opt, executable_path=r'chromedriver') 82 | #you will need to change the executable_path=r'chromedriver' to the path where you have downloaded the chromedriver or any browerdrive. I used chromium for the test. 83 | gmail_login() 84 | 85 | 86 | # Physics 87 | elif current_time == "13:50 / Monday" or current_time == "16:50 / Wednesday": 88 | sub = " ###hangouts meet links here with time variations###" 89 | driver = webdriver.Chrome(chrome_options=opt, executable_path=r'chromedriver') 90 | gmail_login() 91 | 92 | 93 | # Nepali 94 | elif current_time == "15:20 / Monday" or current_time == "16:50 / Thursday" : 95 | sub = "###hangouts meet links here with time variations###" 96 | driver = webdriver.Chrome(chrome_options=opt, executable_path=r'chromedriver') 97 | gmail_login() 98 | 99 | 100 | #Chemistry 1 101 | elif current_time == "16:50 / Monday" or current_time == "15:20 / Wednesday": 102 | sub = "###hangouts meet links here with time variations###" 103 | driver = webdriver.Chrome(chrome_options=opt, executable_path=r'chromedriver') 104 | gmail_login() 105 | 106 | 107 | #Chemistry 2 108 | elif current_time == "13:52 / Tuesday" or current_time == "16:50 / Friday": 109 | sub = "###hangouts meet links here with time variations###" 110 | driver = webdriver.Chrome(chrome_options=opt, executable_path=r'chromedriver') 111 | gmail_login() 112 | 113 | 114 | # English 115 | elif current_time == "15:20 / Tuesday" or current_time == "13:50 / Friday": 116 | sub = "###hangouts meet links here with time variations###" 117 | driver = webdriver.Chrome(chrome_options=opt, executable_path=r'chromedriver') 118 | gmail_login() 119 | 120 | 121 | # Physics 2 122 | elif current_time == "13:50 / Wednesday" or current_time == "15:20 / Thursday": 123 | sub = "###hangouts meet links here with time variations###" 124 | driver = webdriver.Chrome(chrome_options=opt, executable_path=r'chromedriver') 125 | gmail_login() 126 | 127 | 128 | else: 129 | print("No classes right now") 130 | 131 | 132 | 133 | --------------------------------------------------------------------------------