How to find game genre via HttpService and random game generator

I am nearly done with my random game generator, but I want the genre to be displayed to potentially filter out games by horror, building, etc… How would I go by doing this?
And if possible, how would I be able to find the creator’s profile and username via a Roblox Place ID?

Script
local TeleportService = game:GetService("TeleportService")
local MarketplaceService = game:GetService("MarketplaceService")

local GetInfo = function(id)
	local thumbnail = "https://assetgame.roblox.com/Game/Tools/ThumbnailAsset.ashx?aid=".. id .."&fmt=png&wd=420&ht=420"
	local Info = MarketplaceService:GetProductInfo(id,Enum.InfoType.Asset)

	if Info.AssetTypeId == 9 then
		return {
			Name = Info.Name,
			Created = Info.Created,
			Updated = Info.Updated,
			Description = Info.Description,
			Thumbnail = thumbnail,
		}
	end
end

local Check = function(id)
	local Info = MarketplaceService:GetProductInfo(id,Enum.InfoType.Asset)
	if string.find(Info.Name, "Place") then
		return false
	end
	return true
end

local IgnoredPlaceIds = {}
local function GRP()
	-- Generates a Random Place
	local RandomPlaceGenerator = Random.new():NextInteger(100000, 14038963653)

	-- Checks for the word Place Before anything
	if not Check(RandomPlaceGenerator) then
		GRP()
		return
	end

	-- Checks if the player has recieved this place before OR contains Place in it
	if table.find(IgnoredPlaceIds, RandomPlaceGenerator) then
		GRP()
		return
	end

	-- This Line Make its so you cant get the same place your recieved before.
	table.insert(IgnoredPlaceIds, RandomPlaceGenerator)

	local success, errormessage = pcall(function()
		-- Recieves Information Needed
		local RecieveInformation = GetInfo(RandomPlaceGenerator)

		-- Fills out returned information
		local SurfaceGUI = script.Parent.Parent.Parent.SurfaceGui
		SurfaceGUI.Thumbnail.Image = RecieveInformation.Thumbnail
		SurfaceGUI.PlaceName.Text = RecieveInformation.Name
		SurfaceGUI.CreationDate.Text = RecieveInformation.Created
		SurfaceGUI.LastUpdated.Text = RecieveInformation.Updated
		SurfaceGUI.Visits.Text = RecieveInformation.Description
		SurfaceGUI.GameID.Text = RandomPlaceGenerator
		SurfaceGUI.Genre.Text = RecieveInformation.Genre
	end)
	if not success then
		warn(errormessage)
		GRP()
		return
	else
		script.Parent.MouseClick:Connect(function(player)
			TeleportService:Teleport(RandomPlaceGenerator, player)
		end)
	end


end

while task.wait(10) do
	GRP()
	end

Getting the creator’s profile and username can be used via Info.Creator when you use MarketPlaceService:GetProductInfo().

However, I don’t think it’s possible to get the genre of a game using the placeId.

I’ve seen some other random game generators find the genre, did they use a proxy and how so?

I’m not really sure how to use proxies but you would use one of them for this.

Were you able to find out how to use the genres?

I found some useful api that you could use, but I don’t know how to incorporate proxies into them.

'https://api.roblox.com/universes/get-universe-containing-place?placeid='.. placeId --Get universe id
'https://games.roblox.com/v1/games?universeIds='.. universeId --Get info about game by universe id, including genre

Not sure how I would be able to use these… I will try to use it in my script to find game genre.

Finally I figured it out!

Try this:

local function genreByPlaceId(placeId)
	local universeDataEncoded = httpService:GetAsync("https://apis.roproxy.com/universes/v1/places/".. placeId.. "/universe")
	
	if universeDataEncoded then
		local universeDataDecoded = httpService:JSONDecode(universeDataEncoded)
		
		local universeId = universeDataDecoded.universeId
		
		if universeId then
			local gameDataEncoded = httpService:GetAsync('https://games.roproxy.com/v1/games?universeIds='.. universeId)
			
			if gameDataEncoded then
				local gameDataDecoded = httpService:JSONDecode(gameDataEncoded)

				local genre = gameDataDecoded.data[1].genre
				
				return genre
			end
		end
	end
end

For example, to get Jailbreak’s genre by it’s placeId:

genreByPlaceId(606849621) --> Town and City
1 Like

Didn’t work for some reason. I cant use genreByPlaceID.
I did this: local Genre = genreByPlaceId(RandomPlaceGenerator)

Were there any errors? It works for me. (Also sorry for incredibly late reply I thought this was marked as the solution so I didn’t check the post)