-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
47 lines (34 loc) · 1.15 KB
/
bot.py
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
from selenium import webdriver
import chromedriver_binary
from pathlib import Path
from like import likePosts
from message import sendMessage
from random import choice
commentsPath = 'comments.txt'
messagesPath = 'messages.txt'
tagsPath = 'tags.txt'
with open(commentsPath, encoding="utf8") as f:
comments = [line.rstrip() for line in f]
print(comments)
with open(messagesPath, encoding="utf8") as f:
messages = [line.rstrip() for line in f]
print(messages)
with open(tagsPath, encoding="utf8") as f:
tags = [line.rstrip() for line in f]
print(tags)
home = str(Path.home())
chromeOptions = webdriver.chrome.options.Options()
chromeProfileDir = home + "\\AppData\\Local\\Google\\Chrome\\New User"
print(chromeProfileDir)
chromeOptions.add_argument("user-data-dir="+chromeProfileDir)
driver = webdriver.Chrome(options=chromeOptions)
usernameList = []
comment = ""
for tag in tags:
usernames = likePosts(driver, tag, 5, choice(comments))
for username in usernames:
if(username not in usernameList):
usernameList.append(username)
print(usernameList)
for name in usernameList:
sendMessage(driver, name, choice(messages))