-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
60 lines (49 loc) · 1.49 KB
/
main.py
File metadata and controls
60 lines (49 loc) · 1.49 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
#!/usr/bin/env python3
from src.bot import LinkedIn
def run_bot():
import time
print("[MAIN] Starting bot...")
try:
bot = LinkedIn() # LinkedIn Bot object instance creation
print("[MAIN] LinkedIn instance created")
except Exception as e:
print(f"[MAIN] Failed to create LinkedIn instance: {e}")
return
try:
print("[MAIN] Logging in...")
bot.login()
print("[MAIN] Login completed")
except Exception as e:
print(f"[MAIN] Login failed: {e}")
return
try:
print("[MAIN] Generating URLs...")
bot.generate_urls()
print("[MAIN] URLs generated")
except Exception as e:
print(f"[MAIN] URL generation failed: {e}")
return
try:
print("[MAIN] Starting job application process...")
bot.link_job_apply()
print("[MAIN] Job application process completed")
except Exception as e:
print(f"[MAIN] Job application process failed: {e}")
return
# Keep the browser open; user must close it manually.
print("Keeping browser open. Close the browser window to exit.")
try:
while True:
time.sleep(60)
try:
# Break when all windows are closed
if not bot.driver.window_handles:
break
except Exception:
break
except KeyboardInterrupt:
pass
def main():
run_bot()
if __name__ == "__main__":
main()