How would I get a user's DevForum role?

As the tittle suggest, “how would I get a user’s role on the Forum”?

I’ve looked it up and nothing has seemed to work.

6 Likes

I meant script wise, I want it to return the Player’s trust level!

This seems to be the best one:

However it’s returning my Trust Level as ‘none’

2 Likes

You can do some web scraping by getting the page and then look for:

<dd class="trust-level">Member</dd>

I am not sure, but it seems like this information is embedded within the page directly.

Actually, the approach you mentioned seems much more clean. It appears that you can find the “trust_level” field and then work out what its level stands for.

"trust_level":1

This should work, since I get a valid JSON with a "trust_level":1 with your name.

These are deprecated I think, cause they do not exist. This is why you got ‘none’ as a return value.

Oh boy here we go.

-- Data:
local User = ""
local TrustLevels = {
   ["1"] = "Member",
   ["2"] = "Regular",
       -- and so on
}
-- Variables:
local HttpService = game:GetService("HttpService")

local Json	= HttpService:GetAsync("https://devforum.roblox.com/u/" .. User ..".json")
local ForumData	= HttpService:JSONDecode(Json)

-- Utilities:
local function convertTrustLevel(number)
   if number == 1 then
       print("Member")
    elseif number == 2 then
        print("Regular")
   end
end

-- Main Code:
local TrustLevelNumber = tonumber(ForumData.user.trust_level)

-- Post Setups:
convertTrustLevel(TrustLevelNumber)

Explication

  • So firstly we make a table with all the ranks for reference, then get the HttpService since its a crucial part in this script and using its getasync function we get the async of the user wanted, since it will basically tell the code to get https://devforum.roblox.com/u/User’s_Name.json and will basically get the json file with all the data from it, then we decode it since its all messed up, and then go through the process of finding the constant in the code which will be here in our case.

  • Then we get that constant through basically just doing Data.user.trust_level and then make a function which basically says that if you have trust_level 1 then your a Member if you have trust_level 2 then your a Regular, and just go through a final check to make sure the trust_level constant is a number and then the variable we used to check we use it as a argument for the convertTrustLevel() function.

Also I’d suggest you to use a Chrome Extension called Json Parser since its way easier to see all the data.

2 Likes

Is it not illegal? since you can’t get any roblox website from HTTPs service?

No its not illegal since anyone can do this. If it was illegal information would be encrypted, and the fact that you can just do this right now makes it legal + that its public information mostly.

1 Like

Alright, can I get discord name too?

It is not used for Roblox.com its for the DevForum which is not in the regulations and TOS.

Alrighty thank you so much. :smiley:

1 Like

Can I get discord name too? I know that’s @ItsPlasmaRBLX post but I just ask because it’s interesting.

Seems like I’m getting an error
image

Yeah, they got rid of the groups so that people wouldn’t sort by the group’s recently added in an attempt to game the (TL2) requirements. They’re not deprecated, they’re fully gone.

3 Likes

You have to use a proxy because Roblox servers’ IPs are given access to internal APIs for CoreScripts to be able to add friends/followers/make purchases (and so on) from ingame. Developers can’t force these requests for obvious reasons. As long as you do it from your own server, you are allowed (and encouraged) to use any Roblox web APIs.

2 Likes

I don’t think OP ever got an answer to their question, but you can use rprxy for this as well if you don’t have your own proxy server.

local HttpService = game:GetService("HttpService")

local function get_trust_level(user: string): number
    local info = HttpService:RequestAsync({
        Url = string.format("https://devforum.rprxy.xyz/u/%s.json", user),
        Method = "GET",
    })

    if info.Success then
        return HttpService:JSONDecode(info.Body).user.trust_level
    end
    return -1 -- failed somehow
end
2 Likes