Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 7 years ago

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

0
Can you explain this in more detail User#5423 17 — 7y
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. KingLoneCat 2642 — 7y
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. httpOmqCxpcake 70 — 7y

2 answers

Log in to vote
2
Answered by
cabbler 1942 Moderation Voter
7 years ago

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.

0
Thank you <3 Yamanohera15523 -9 — 7y
0
But i want to put the musics on GUI. Yamanohera15523 -9 — 7y
0
You get any other info the same way, like replacing ".AssetId" with ".Name" cabbler 1942 — 7y
Ad
Log in to vote
-2
Answered by 7 years ago
:GetSync()
0
Explain it more... httpOmqCxpcake 70 — 7y
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. AstrealDev 728 — 7y
0
This is OP so I think he was trying to edit the post or something. cabbler 1942 — 7y

Answer this question