I’m wanting to make a library of songs the player can play in game, but I can’t figure the most efficient/easiest way to gather such a large library.
I don’t want to manually grab ids, as this’d take forever. I’d then need to do GetProductInfo on every single id to get their title, artist, length, etc.
Ideally I want a way to grab like 100 of each genre (pop/rock/electric/etc.) and store all its information in game (title/artist/length)
After some research, I found a web endpoint for it at https://apis.roblox.com/toolbox-service/v1/marketplace/3. You can go to the next page of audio by putting ?cursor= followed by the value of nextPageCursor. However, you’ll need a proxy to access this as HttpService cannot access Roblox domains at this point in time.
Here’s some other information that might be useful:
Edit:
I just found this, which I thought the AI Assistant hallucinated, but apparently it’s real:
One way that I think you’d be able to efficiently do this is via uploading all game-specific sounds to a separate Roblox account (at the cost of having to keep the inventory public). You can then use Roblox’s Marketplace Api (as the above reply mentions) to query every audio uploaded to the specific userId and further decode it into a simple array.
A quick example I put together:
-- Bulk Audio Importer
local HttpService = game:GetService("HttpService")
function getSounds(userId)
local soundIds = {}
local response
local success, err = pcall(function()
response = HttpService:GetAsync("https://inventory.roproxy.com/v2/users/"..userId.."/inventory/3?sortOrder=Asc&limit=100")
end)
if response then
response = HttpService:JSONDecode(response)
for _,soundId in pairs(response.data) do
if soundId["assetId"] then
table.insert(soundIds, "rbxassetid://"..soundId.assetId)
end
end
return soundIds
end
return {}
end
local ids = getSounds(82347291)
print(ids)
Despite this potentially not being an optimal way for you, you can still use the function to implement similar approaches. Hope it helps.