-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautoaccept.py
More file actions
61 lines (50 loc) · 2 KB
/
autoaccept.py
File metadata and controls
61 lines (50 loc) · 2 KB
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
import os
from time import sleep
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
# linkedin post liker
#
# Add your post url (if any) to your posts here for others to like them : https://docs.google.com/document/d/1YiPKlYkzGMO08HfpZuOZ-S4B-t6KrA7-Xe1x1ElFmnk/edit?usp=sharing
#
#
#
# To like other people's post:
# step 0 : you need chrome for this. Also install modules :
# pip install selenium && pip install webdriver_manager && pip install tinydb
# step 1 change this from : https://docs.google.com/document/d/1YiPKlYkzGMO08HfpZuOZ-S4B-t6KrA7-Xe1x1ElFmnk/edit?usp=sharing
#step 2 : run code , check if you are logged in (if not, then login) then press 1 in console
#step 3 : the code shoud take care of the rest add your posts that you would want to get liked
options = webdriver.ChromeOptions()
options.add_argument("user-data-dir={}\driver_data".format(os.getcwd()))
driver = webdriver.Chrome(ChromeDriverManager().install(), chrome_options=options)
driver.get("https://linkedin.com")
# delete this after every month
# while "1" != input("press 1 when signed in: "):
# pass
# for link in links:
# try:
# print("accessing link ", link)
# driver.get(link)
# sleep(2)
# el = driver.find_element_by_class_name("react-button__trigger")
# if "false" == el.get_attribute("aria-pressed"):
# print("liking")
# el.click()
# print("liked")
# sleep(1)
# else:
# print("already processed link ", link)
# except Exception as e:
# print("error processing link\nlink: ", link, "\nerror", e)
driver.get("https://www.linkedin.com/mynetwork/")
sleep(4)
buttons = driver.find_elements_by_class_name("invitation-card__action-btn")
for button in buttons:
word=button.get_attribute("aria-label")
if word.split(" ")[0] == "Accept":
print("Clicking....")
button.click()
print("Clicked!!")
sleep(1)
print("Done")
driver.close()