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

How do I use advanced image endpoints?

Asked by 5 years ago
Edited 5 years ago

If you enter this link: https://www.roblox.com/place-thumbnails?params=[{placeId:914206360}] you end up on a page on which some values are listed. I would like to know how to use these values in roblox (I would like to get the thumbnailUrl)

0
what are you trying to say? tonyv537 95 — 5y
0
If you enter this link you see a page with several values ??I would like to know how to use these values ??in roblox MageMasterHD 261 — 5y
0
I too am confused by what you tried to ask SteamG00B 1633 — 5y
0
You're trying to use jailbreak's thumbnail in your game? SteamG00B 1633 — 5y
View all comments (11 more)
0
No its just an example MageMasterHD 261 — 5y
0
I've never heard of this before, are you sure it's a thing? I just googled it and couldn't find it on the api SteamG00B 1633 — 5y
0
You can try the link it works MageMasterHD 261 — 5y
0
I wouldn't know though if it exists, but isn't on the api because I only just started scripting 6 days ago, so I might just not know SteamG00B 1633 — 5y
0
What are you trying to use this with? How are you accessing the values? SteamG00B 1633 — 5y
0
That's the problem and what I'm asking for here MageMasterHD 261 — 5y
0
I do not know how to access the values MageMasterHD 261 — 5y
0
Are you making some sort of plugin? Because as far as I know, you can't access outside links from a roblox game other than assetIDs SteamG00B 1633 — 5y
0
I'm trying to find out how to use this link (it's a roblox link) MageMasterHD 261 — 5y
0
You can't grab html and the like from websites other than assetIDs unless roblox has specific support for that type of link like specific social media links SteamG00B 1633 — 5y
0
You could manually do it though SteamG00B 1633 — 5y

1 answer

Log in to vote
3
Answered by 5 years ago
Edited 5 years ago

You probably shouldn't use "advanced image endpoints". HTTP would be more effecient in this case.

Roblox has an API for this, the HttpService (click here for more info).

Don't forget to enable it though:

HttpService starts off as disabled by default.

To enable HTTP requests, the HttpService must be enabled through Studio’s Game Settings by opening the game’s settings via the Game Settings button on the Home tab of the game’s studio window

You can get it through the GetService() method:

local httpService = game:GetService("HttpService")

This allows you to make HTTP requests such as GET and POST. In this case you would use GET to access content. HttpService has a method GetAsync(url) which does just this and accepts url as it's first argument. It returns a string of the response, but it would be really tiresome to use string searches to get specific parts of the response. Since the response in your case would be a JSON table, you would use HttpService's JSONDecode(json) to decode the JSON to a Lua table for easier accessiblity.

One problem though, any url with the Roblox domain (roblox.com) with throw a "Trust Check Error" (why? well so Roblox doesn't get DDoS'd by their own servers lol). In order to do this we would need to use a proxy, there is a free Roblox proxy you can use: rprxy.xyz, just replace www.roblox.com with rprxy.xyz.

Here's what the full thing might look like:

local httpService = game:GetService("HttpService") -- retrieve api service

local url = "https://rprxy.xyz/place-thumbnails?params=[{placeId:914206360}]" -- url to use HTTP requests
local httpResponse = httpService:GetAsync(url) -- HTTP GET method

local decodedData = httpService:JSONDecode(httpResponse) -- returns Lua table

-- finally, do whatever you want with the data
for k, v in pairs(decodedData[1]) do
    print(k, ":", v)
end
Ad

Answer this question