-
Notifications
You must be signed in to change notification settings - Fork 19
/
remove_users.py
59 lines (40 loc) · 1.17 KB
/
remove_users.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from selenium import webdriver
import time
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
#Firefox used
driver = webdriver.Firefox()
# base url
driver.get("http://github.com/login")
username = driver.find_element_by_id("login_field")
password = driver.find_element_by_id("password")
# password and username need to go into these values
username.send_keys("username")
time.sleep(1)
password.send_keys("password")
time.sleep(1)
login_form = driver.find_element_by_xpath("//input[@value='Sign in']")
time.sleep(1)
login_form.click()
time.sleep(1)
prepend = ["your_username"]
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)
driver.get(string)
time.sleep(1)
follow_button = driver.find_elements_by_xpath("//button[@aria-label='Unfollow this person']")
# time.sleep(1)
# print len(follow_button)
try:
for i in follow_button:
i.submit()
except:
pass
time.sleep(1)
driver.close()
time.sleep(3)
time.sleep(3)
driver.close()