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?
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.
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
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
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
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