Audio Catalog requests using HttpService return empty

I use HttpService to request audio searches for players to find audio to play on their radios. I use a proxy since Roblox.com does not allow requests. Other categories like image search, plugin search, and model search work, but audio search does not, and returns an empty table. It does not produce an error. This was first discovered on 6/23/23.

MusicSearchFunction.OnServerInvoke = function(player,input)
	local Songs = {}
	local Repeated = 0
	repeat
		Songs = {}
		Repeated = Repeated+1
		local success, msg = pcall(function()
			local Request = HttpService:GetAsync("https://search.roproxy.com/catalog/json?CatalogContext=2&Category=9&Keyword="..input)
			print(Request)
			local RequestTable = HttpService:JSONDecode(Request)
			print(RequestTable)
			for i,Audio in ipairs(RequestTable) do
				if Audio.IsThumbnailUnapproved == false and table.find(RemovedAssets,Audio.Description) == nil then
					table.insert(Songs,{Audio.Name,Audio.AssetId})
				end
			end
		end)
		if not success then
			task.wait(3)
		end
	until success or Repeated == 3
	return Songs
end

Output:

[]
{}

Expected behavior

I expect to get a table of the audio search when I decode the Http request.

Page URL: https://search.roblox.com/catalog/json?CatalogContext=2&Category=9&Keyword=fun

2 Likes

Hello ShinyGriffin,

The audio search API is unique in that it requires authentication in order to get results. You can verify this for yourself by opening https://search.roblox.com/catalog/json?Category=9 on a signed in window, and in an incognito window (to act as signed out).

As roproxy is not signed in, you are being given the empty results.

We recommend using AssetService:SearchAudio which lets you search for sounds in experience. Here is the usage example from the documentation:

local AssetService = game:GetService("AssetService")

local audioSearchParams = Instance.new("AudioSearchParams")
audioSearchParams.SearchKeyword = "happy"

local success, result = pcall(function()
    return AssetService:SearchAudio(audioSearchParams)
end)

if success then
    local currentPage = result:GetCurrentPage()
    for _, audio in currentPage do
        print(audio.Title)
    end
else
    warn("AssetService error: " .. result)
end

--[[ Returned data format
{
    "AudioType": string,
    "Artist": string,
    "Title": string,
    "Tags": {
        "string"
    },
    "Id": number,
    "IsEndorsed": boolean,
    "Description": string,
    "Duration": number,
    "CreateTime": string,
    "UpdateTime": string,
    "Creator": {
        "Id": number,
        "Name": string,
        "Type": number,
        "IsVerifiedCreator": boolean
    }
}
--]]
9 Likes

Thank you so much! I was unaware of this change.

4 Likes

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