What's the URL for getting the players favorite games?

Hello I’m trying to get a players favorited games.
I have this script to do this:

local HttpService = game:GetService("HttpService");
local remote = game.ReplicatedStorage.Favorites
remote.OnServerInvoke = function(plr, UserId)
	local followers = {};
	local url = ("https://www.roblox.com/users/favorites/list-json?assetTypeId=9&itemsPerPage=100&pageNumber=1&userId=261"):format(tostring(UserId))
	local success, output = pcall(function() return HttpService:JSONDecode(HttpService:GetAsync(url)) end);
	if not (success) then
		print("Error fetching fat stacks of info")
		return followers;
	end
	for _, v in pairs(output.data) do
		table.insert(followers, {
			name = v.name;
			displayName = v.displayName;
			userId = v.id;
		});
	end
	return followers;
end

however, the URL is invalid. I’d been searching for 4 hours now, and I can’t find one. Well I have, they just didn’t work. (Maybe I have to add extra to the URL but I’m not sure.) Can I get some help on the URL?

2 Likes

You could try using Roblox’s API, though you would need a Proxy.

1 Like

Your URL appears to be correct, however you cannot access Roblox API resources/endpoints through the HttpService. You’ll need to setup a proxy such as ProxyService in order to send requests to any Roblox endpoints. You may also find other free proxies on Roblox but ProxyService allows you to set it up yourself which is probably more secure than third-party hosted ones.

Avoid posting duplicate threads, I gave you the solution in the other thread.

I told you I wanted a link that wasn’t by Roblox so I didn’t have to make a Robot since i dont know java and you ignored me.

Is there a link that isnt by roblox because i dont want to make a bot to do it

also I don’t know how to code java and I’m just starting to learn CSS and HTML but I’m a noob at it and I can’t code a robot to get the information cause I don’t know how

You just need to replace ‘roblox.com’ in your URL with a proxy’s domain name.

1 Like
local HttpService = game:GetService("HttpService");
local remote = game.ReplicatedStorage.Favorites
remote.OnServerInvoke = function(plr, UserId)
	local followers = {};
	local url = ("https://roproxy-lite/users/favorites/list-json?assetTypeId=9&itemsPerPage=100&pageNumber=1&userId=261"):format(tostring(UserId))
	local success, output = pcall(function() return HttpService:JSONDecode(HttpService:GetAsync(url)) end);
	if not (success) then
		print("Error fetching fat stacks of info")
		return followers;
	end
	for _, v in pairs(output.data) do
		table.insert(followers, {
			name = v.name;
			displayName = v.displayName;
			userId = v.id;
		});
	end
	return followers;
end

i replaced roblox.com but it STILL doesn’t work :frowning:

1 Like
roproxy-lite
roproxy.com
("https://roproxy-lite/users/favorites/list-json?assetTypeId=9&itemsPerPage=100&pageNumber=1&userId=261"):format(tostring(UserId))

This is also an invalid string.format call, you have no format options.

("https://roproxy-lite/users/favorites/list-json?assetTypeId=9&itemsPerPage=100&pageNumber=1&userId=%d"):format(UserId)

Use the format option ‘%i’ or ‘%d’ for integers.

1 Like
local HttpService = game:GetService("HttpService");
local remote = game.ReplicatedStorage.Favorites
remote.OnServerInvoke = function(plr, UserId)
	local followers = {};
	local url = ("https://roproxy-lite/users/favorites/list-json?assetTypeId=9&itemsPerPage=100&pageNumber=1&userId=%d"):format(UserId)
	local success, output = pcall(function() return HttpService:JSONDecode(HttpService:GetAsync(url)) end);
	if not (success) then
		print("Error fetching fat stacks of info")
		return followers;
	end
	for _, v in pairs(output.data) do
		table.insert(followers, {
			name = v.name;
			displayName = v.displayName;
			userId = v.id;
		});
	end
	return followers;
end

I still got an error bruh

ERROR:

 HttpError: DnsResolve
1 Like

As mentioned here, you need to use roproxy.com. It should look like the following.

https://www.roproxy.com/users/favorites/list-json?assetTypeId=9&itemsPerPage=100&pageNumber=1&userId=261

local Game = game
local HttpService = Game:GetService("HttpService")

local BaseUrl = "https://www.roproxy.com/users/favorites/list-json?assetTypeId=%d&itemsPerPage=%d&pageNumber=%d&userId=%d"

local function GetFavorites(assetTypeId, itemsPerPage, pageNumber, userId)
	local Url = string.format(BaseUrl, assetTypeId, itemsPerPage, pageNumber, userId)
	local Success, Result = pcall(HttpService.GetAsync, HttpService, Url)
	if not Success then warn(Result) return end
	Success, Result = pcall(HttpService.JSONDecode, HttpService, Result)
	if not Success then warn(Result) return end
	return Result
end

local Favorites = GetFavorites(9, 100, 1, 261)
for _, Favorite in ipairs(Favorites.Data.Items) do
	print(Favorite.Item.Name) --Outputs the names of 100 places favorited by user ID 261.
end

I didn’t want to spoonfeed but here.

4 Likes