Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to Search a Roblox's Music using Proxy or httpservice?

How to Search a Roblox's Music using Proxy or httpservice? Can someone help me!!!

3 comments

0

Can you explain this in more detail

0

Use http request to get all the information from the website, then use JSON:Decode() to make it into a Lua table and then you can access it like a list of arrays. Iterate through it with a for each iteration.

0

I typically use XPath to get the title. But there's no method for it in RBXL Lua. What @KingLoneCat says, just try to extract them using JSON:Decode. Or better yet, write a PHP/ASP.NET in your Proxy server to manually extract it for you, much simplier too.

2 answers

I'll spoonfeed you. The simplest way is a quick GetAsync from http://rprxy.xyz.

Here is a basic function to get the ID from a search query.

local hs = game:GetService("HttpService")

function getSoundId(name)
	--format the query like a web browser url
	name = hs:UrlEncode(name)
	--get a massive string from this search
	local json = hs:GetAsync("https://rprxy.xyz/proxy/api/SearchMusic/"..name)
	--turn the string into a Lua table
	local tab = hs:JSONDecode(json)
	--this table is an array of dictionaries that describe assets
	--return the first item; the most relevant result; and it's id
	return (tab[1] or {}).AssetId
	--the operator prevents an error
end

Of course once you have the id you then simply plug it into a sound.

3 comments

0

Thank you <3

0

But i want to put the musics on GUI.

0

You get any other info the same way, like replacing ".AssetId" with ".Name"

:GetSync()

3 comments

0

Explain it more...

0

That's a horrible answer. Like, there literally isn't an answer worse than this. Honestly, this is a horrible, horrible, horrible answer. Like you should have -999 rep. I don't even know what to say.

0

This is OP so I think he was trying to edit the post or something.

This discussion is preserved as it was. New answers, comments, and votes are closed.