-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautolike.py
More file actions
59 lines (41 loc) · 1.77 KB
/
autolike.py
File metadata and controls
59 lines (41 loc) · 1.77 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
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
sleep(4)
buttons = driver.find_elements_by_class_name("react-button__trigger")
count=0
while count < 10:
try:
sleep(2)
if "false" == buttons[count].get_attribute("aria-pressed"):
print("liking")
buttons[count].click()
print("liked")
sleep(1)
buttons = driver.find_elements_by_class_name("react-button__trigger")
else:
print("already processed link ", buttons[count])
count+=1
except Exception as e:
print("error processing link\nlink: ", buttons[count], "\nerror", e)
driver.close()