Advertisement
Guest User

Add banned roblox users to your friends list

a guest
Mar 12th, 2019
2,786
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.68 KB | None | 0 0
  1. # this will add a banned user to your friends list
  2. # you need to input authorization and usernames
  3.  
  4. import requests
  5.  
  6. acc_cookie = "" # place your account .roblosecurity cookie here
  7. banned_cookie = "" # place your banned account .roblosecurity cookie here
  8.  
  9. acc_username = "" # your username
  10. banned_username = "" # username of banned user
  11.  
  12. class roblox:
  13.     def __init__(self):
  14.         self.xsrf = ""
  15.         self.session = requests.Session()
  16.         self.session.headers["User-Agent"] = "Roblox/WinInet"
  17.     def update_cookie(self, cookie): self.session.cookies[".ROBLOSECURITY"] = cookie
  18.     def get_userid(self, username): return self.session.get("https://api.roblox.com/users/get-by-username?username="+username).json()["Id"]
  19.     def send_request(self, userId):
  20.         resp = self.session.post(
  21.             url="https://www.roblox.com/api/friends/sendfriendrequest",
  22.             headers={"X-CSRF-TOKEN": self.xsrf},
  23.             json={"targetUserID": userId}
  24.         )
  25.         if "X-CSRF-TOKEN" in resp.headers:
  26.             self.xsrf = resp.headers["X-CSRF-TOKEN"]
  27.             return self.send_request(userId)
  28.         return resp.text
  29.     def accept_request(self, userId):
  30.         resp = self.session.post(
  31.             url="https://api.roblox.com/user/accept-friend-request",
  32.             headers={"X-CSRF-TOKEN": self.xsrf},
  33.             json={"requesterUserId": userId}
  34.         )
  35.         if "X-CSRF-TOKEN" in resp.headers:
  36.             self.xsrf = resp.headers["X-CSRF-TOKEN"]
  37.             return self.accept_request(userId)
  38.         return resp.text
  39.  
  40. roblox = roblox()
  41.  
  42. if acc_cookie and banned_cookie:
  43.     roblox.update_cookie(acc_cookie)
  44.     send_resp = roblox.send_request(roblox.get_userid(banned_username))
  45.     roblox.update_cookie(banned_cookie)
  46.     accept_resp = roblox.accept_request(roblox.get_userid(acc_username))
  47.     print(send_resp, accept_resp)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement