Hi guys. I would like to present this small Python script that allows you to quickly and efficiently clear your list of blocked users. This could serve as an alternative to certain browser extensions on GitHub that do the same thing, but right now, you are in full control of the entire process yourself
The basics
To get everything working, you need Python as well as several modules, such as: requests and numpy
Cookie
This is not the usual .ROBLOSECURITY token we are used to. The process of obtaining it and the information it contains differ
- Go to roblox.com/home
- Open “Inspect element” in your browser
- Go to the “Network” menu and refresh the page
- Set the filter name for “users” queries (one of many ways)
- Select this request, locate the “Cookie” entry in the “Request headers”, and then copy its entire content
Usage
Run the script provided below in any compiler that supports Python. Customize it by changing the values ​​of the constants UNBLOCK_AMOUNT and UNBLOCK_DELAY, and don’t forget to set MY_COOKIES to the content you copied
import math
from time import sleep
from sys import exit
from numpy import clip
from requests import get,post
UNBLOCK_AMOUNT = math.inf # Number of users to unblock
UNBLOCK_DELAY = 1.2 # Wait time after each unlock, in seconds
MY_COOKIES = '' # !READ ABOVE! This isn't the usual data we're used to seeing from just the .ROBLOSECURITY cookie
headers = {'Cookie':MY_COOKIES}
pageCursor = ''
removed = 0
while True:
if pageCursor == None:
print('unblocking finished')
exit()
def getBlockedIds():
global pageCursor
response = get(f'https://apis.roblox.com/user-blocking-api/v1/users/get-blocked-users?cursor={pageCursor}&count=50',headers=headers)
responseError = response.raise_for_status()
if responseError:
print('failed to get blocked users')
exit()
responseData = response.json()['data']
pageCursor = responseData['cursor']
return responseData['blockedUserIds']
Ids = getBlockedIds()
IdsAmount = len(Ids)
if IdsAmount == 0:
print('no blocked users')
exit()
UNBLOCK_AMOUNT = clip(UNBLOCK_AMOUNT,1,IdsAmount)
for v in Ids:
if removed > UNBLOCK_AMOUNT:
print('unblocking stopped')
exit()
requestUrl = f'https://apis.roblox.com/user-blocking-api/v1/users/{v}/unblock-user'
response = post(requestUrl,headers=headers)
if response.status_code == 403:
sleep(UNBLOCK_DELAY)
headers.update({'x-csrf-token':response.headers['x-csrf-token']})
post(requestUrl,headers=headers)
removed += 1
sleep(UNBLOCK_DELAY)
That’s all, thanks for using it!
The issue
In addition to the method for obtaining the cookie that I presented above, this script supports the use of the .ROBLOSECURITY token in the headers. However, after sending the first API request, I get the error:
Request Context BrowserTrackerID is missing or invalid
I figured out how to find my BrowserTrackerID and even wrote a reply about it addressing the same issue. I’ve tried many ways to include this information in the request, but the problem persists. Could you tell me what’s causing this and how to fix it, if possible? Thanks!
