How to get amount of likes in game

How to make a request to get amount of likes my game has with URL: https://api.roblox.com/universes/get-universe-containing-place?placeid=[URL]?

https://games.roproxy.com/v1/games/[UnvireseID]/votes

how can I use HTTPS service to get data?

local HS = game:GetService("HttpService")
local UID = HS:GetAsync("http://api.roproxy.xyz/universes/get-universe-containing-place?placeid="..game.PlaceId)
local GET = HS:GetAsync("http://games.roproxy.xyz/v1/games/votes?universeIds="..UID:gsub("[^%d%.%-]", ""))
local Data = HS:JSONDecode(GET)
print(Data["data"][1]) -- data = {["data"] = {upVotes = 0, downVotes = 0, id = universeId}}

image

So, I was working on your problem, but I couldn’t get it to work, I tried using roproxy and Roblox API straight up, but it either gave, me a 404, or a InvalidRedirect, heres my failed code if you really want it, this was the closest I got, it returns a JSON, but the upVotes and downVotes are 0:

local HTTPService = game:GetService("HttpService")

function GetLikeCountOnGame(GameId : number) : number
	local URL = "https://games.roproxy.com/v1/games/"..GameId.."/votes"
	
	local success, result = pcall(function()
		return HTTPService:GetAsync(URL)
	end)
	
	if success and result then
		local Decode = HTTPService:JSONDecode(result)
		return Decode.upVotes or 0
	else
		warn(result)
		return 0
	end
end

I guess you would have to use a 3 step process of sending a get request to a 3rd party API like google cloud, google makes another request to get the actual JSON data from the roblox game, and just sends it back. I think only this will work as HTTP and API is very limiting.

1 Like

I have this in one of my games, it works

local likes = 0

local function GetGameLikes()
	local success, error = pcall(function()
		local Result = HttpService:GetAsync("https://games.roproxy.com/v1/games/" .. game.GameId .. "/votes")
		
		likes = tonumber(HttpService:JSONDecode(Result).upVotes)
				
		return --HttpService:JSONDecode(Result)
	end)
	
	if not success then
		
		warn(error)
		
		likes = 0
		
		return
	end
end

GetGameLikes()
print(likes)

while task.wait(90) do
	GetGameLikes()
	print(likes)
end

Hi, I have fixed @axzuvra’s code and now it works properly :slightly_smiling_face:

local HttpService = game:GetService("HttpService")


local uResponse = HttpService:GetAsync(`https://apis.roproxy.com/universes/v1/places/{game.PlaceId}/universe`)
local uData = HttpService:JSONDecode(uResponse)

local vResponse = HttpService:GetAsync(`https://games.roproxy.com/v1/games/{uData.universeId}/votes`)
local vData = HttpService:JSONDecode(vResponse)


print("Likes:", vData.upVotes, "Dislikes:", vData.downVotes)

He was using old API’s, I found the new ones and applied it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.