Skip to content

Commit

Permalink
Merge pull request #7 from Anteste/master
Browse files Browse the repository at this point in the history
Merge Master -> Selenium
  • Loading branch information
Anteste authored Jun 22, 2020
2 parents 1b38240 + 5db27e8 commit b6bce00
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 49 deletions.
84 changes: 42 additions & 42 deletions follow_bot.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
import time
import sys
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

# Initializing the headless chrome
driver = webdriver.Chrome()
driver.get("https://github.com/login")
wait = WebDriverWait(driver, 10)

# Locating username and password field
username = wait.until(EC.presence_of_element_located((By.ID, "login_field")))
password = wait.until(EC.presence_of_element_located((By.ID, "password")))

# password and username need to go into these values
username.send_keys("Username")
password.send_keys("Password")

# Clicking the sign in button
login_form = wait.until(EC.presence_of_element_located((By.XPATH, "//input[@value='Sign in']")))
login_form.click()

# Go to the followers tab
prepend = ["BaseMax"]

for user in prepend:
for t in range(19, 100):
string = "https://github.com/{}?page={}&tab=followers".format(user, t)
driver.get(string)
time.sleep(1)

follow_button = driver.find_elements_by_xpath("//input[@aria-label='Follow this person']")

try:
for i in follow_button:
i.submit()
except:
pass
time.sleep(1)

import time
import sys
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

# Initializing the headless chrome
driver = webdriver.Chrome()
driver.get("https://github.com/login")
wait = WebDriverWait(driver, 10)

# Locating username and password field
username = wait.until(EC.presence_of_element_located((By.ID, "login_field")))
password = wait.until(EC.presence_of_element_located((By.ID, "password")))

# password and username need to go into these values
username.send_keys("username")
password.send_keys("password")

# Clicking the sign in button
login_form = wait.until(EC.presence_of_element_located((By.XPATH, "//input[@value='Sign in']")))
login_form.click()

# Go to the followers tab
prepend = ["Anteste", "andrewsyc"]

for user in prepend:
for t in range(1, 50):
string = "https://github.com/{}?page={}&tab=followers".format(user, t)
driver.get(string)
time.sleep(1)

follow_button = driver.find_elements_by_xpath("//input[@aria-label='Follow this person']")

try:
for i in follow_button:
i.submit()
except:
pass
time.sleep(1)

driver.close()
13 changes: 6 additions & 7 deletions unfollow_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
reload(sys)
sys.setdefaultencoding('utf-8')

# Initializing the headless chrome
driver = webdriver.Chrome()
Expand All @@ -17,24 +15,25 @@
password = wait.until(EC.presence_of_element_located((By.ID, "password")))

# password and username need to go into these values
username.send_keys("Username")
password.send_keys("Password")
username.send_keys("username")
password.send_keys("password")

# Clicking the sign in button
login_form = wait.until(EC.presence_of_element_located((By.XPATH, "//input[@value='Sign in']")))
login_form.click()

prepend = ["your_username"]

prepend = ["prot0-root"]


for user in prepend:
for i in range(0, 200):
for t in range(1, 100):
string = "https://github.com/{}/following?page={}".format(user, t)
string = "https://github.com/{}?tab=following&page={}".format(user, t)
driver.get(string)
time.sleep(1)

follow_button = driver.find_elements_by_xpath("//button[@aria-label='Unfollow this person']")
follow_button = driver.find_elements_by_xpath("//input[@aria-label='Unfollow this person']")

# time.sleep(1)
# print len(follow_button)
Expand Down

0 comments on commit b6bce00

Please sign in to comment.