-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnameMC.py
68 lines (54 loc) · 2.09 KB
/
nameMC.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
60
61
62
63
64
65
66
67
68
import json, requests, time, getpass
from selenium import webdriver
waitTime = 60
#gets the username and password so it can login to account
username = input("Enter your username: ")
password = getpass.getpass("Enter your password: ")
print(" ")
#accepts friend lists and gives default value
print("Type nothing for default option.")
apiLink = input("Insert friends list api link: ")
if apiLink == "":
apiLink = "https://api.namemc.com/profile/b4769eac-1010-405a-b668-04a07b2f20f3/friends"
# loads friend list as python dictionary
friendsList = requests.get(apiLink)
friendsNames = json.loads(friendsList.text)
# Opens browser and login page
driver = webdriver.Firefox()
driver.get("https://namemc.com/login")
time.sleep(1)
try:
# password, username and submit fields for the bot to use them
emailField = driver.find_element_by_id("email")
passwordField = driver.find_element_by_id("password")
submitButton = driver.find_element_by_xpath("//button[@class='btn btn-primary']")
#send the inputs and clicks button
passwordField.send_keys(password)
emailField.send_keys(username)
submitButton.click()
except:
t = input("\nPlease complete the captcha then press enter.")
# Gets password, username and submit button form fields
emailField = driver.find_element_by_id("email")
passwordField = driver.find_element_by_id("password")
submitButton = driver.find_element_by_xpath("//button[@class='btn btn-primary']")
#send inputs to form fields and clicks button
passwordField.send_keys(password)
emailField.send_keys(username)
submitButton.click()
for i in friendsNames:
# Opens profile
driver.get("https://namemc.com/profile/" + i["name"])
print("\nUsername: " + i["name"] + " UUID: " + i["uuid"])
try:
# Finds and clicks friend button
button = driver.find_element_by_id('add-friend-button')
button.click()
except:
print("I already sent friend request to them. (Or im not logged in)")
print("Waiting " + str(waitTime) + " Seconds")
else:
print("Request sent, waiting " + str(waitTime) + " Seconds")
# Waits certain time to follow ratelimit
time.sleep(waitTime)
print("Done, have a nice day!")