For one, I don’t really know what is supposed to be put in place of “targetid”.
But anyway, if I use the link as the image url, and put the place id in place of “targetid”, it’s just the first thumbnail, and of course, won’t return a table. If i try to use it for a JSONDecode, I just get errors, or get back “http doesnt have access to that roblox resource”
I believe the link he gave has probably been deprecated or something, nonetheless the proper way of getting the thumbnails of a game would be using this:
https://games.roblox.com/v2/games/aUniverseId/media -- after you use HttpService and do some stuff other stuff
Where “aUniverseId” is the universe Id of the game you want.
Also to test out the media thing you should use this site (made by roblox): https://create.roblox.com/docs/cloud/legacy/games/v2#/GamesV2/get_v2_games__universeId__media.
Click “Try it out” then input your UniverseId (or 703124385 for Tower of Hell), then click execute (execute will appear after you click “Try it out”). Then you can scroll down and check what will be returned when you call the https://games.roblox.com/v2/games/703124385 /media (reminder again you have to do some extra stuff and not just call the link in a script to get the table).
To call it in a script you do something like this (this won’t work, technically it would if it weren’t for roblox prohibiting calling its own API service but we’ll get into that later):
local HttpService = game:GetService("HttpService") -- Have to enable some stuff first, just look up a different tutorial, this is just an example :/
function getMedia(univID)
local link = HttpService:UrlEncode("https://games.roblox.com/v2/games/"..tostring(univID).."/media") -- changes the text into link that that can be searchable on the internet
local data
local didRun,returnVal = pcall(function() -- pcall checks if anything was returned cause it can fail to get the data
local response = HttpService:GetAsync(link) -- actually (tries) to get the Data from link
local JSONData = HttpService:JSONDecode(response) -- Decodes the table returned from the Link into Lua so the Script can read it
data = JSONData["response"]["data"] -- just me shortening it
end)
if didRun then
return data
else
warn("Failed to get game media "..univID)
return nil
end
end
local getTowerHeck = getMdeia(703124385)
local TowerHeckImg1 = getTowerHeck[1]["imageId"] -- gets the assest id of Tower of Hell 1st Thumbnail
As stated before this won’t work as roblox won’t allow you to call Roblox’s own API for security reasons or something idk I forgot. Thus, you’ll either need to make your own proxy or use a different proxy.
As for the rprxy.xyz proxy, it apparently shut down a few years ago
Also in that post, he showcases his own proxy(RoProxy), but I don’t know how to use it :p.
Honestly I’d suggest you make your own proxy, you can pretty easily make one by using Google Apps (Click here for tutorial). Also if you’re wondering, Google Apps uses JavaScript. If you have any trouble setting it up feel free to ask as the tutorial doesn’t show you some of the errors you might run into.
There’s also Roblox’s Open Cloud thing, never touched it before. Though from what I’ve read about it I believe it’ll let you call Roblox’s API without the use of a proxy. Anyway here’s a tutorial of someone making it work and the Announcement page of it.
[spoiler]
If this doesn’t solve youre problem im gonna curse you >:(
Idk why I didn’t realize that that solution was an endpoint, or why I didn’t understand why it gave me the roblox resource error, as I know about the prohibition of roblox’s API within scripts + the roblox url..
I also was aware of rprxy.xyz shutting down, but I guess I didn’t realize that the first part/domain is the proxy, and that meant the second link wouldn’t work.
Anyway!
As for the reply,
First, I just tried to use the roblox endpoint using roproxy and kept getting error 404.
Then, I followed the tutorial for my own proxy, to a T, and got error 403 from line 8 in the module script (got it both times from two different target urls (including the one in the tut));
local response = HttpService:GetAsync(proxyURL .. query)
I think i’ll just have to use the test it out to get all the ids and insert them manually..
Not sure about the roproxy one since I’ve never used it. As for your own tutorial, I’m not too sure what you mean by 403 error in line 8 in the module script. I’m assuming you mean the Google Apps script and the error was a pop-up from when you tried testing it. I’d appreciate an image if you can show one. If you want to just use the “Try it out” method you can, you’re just gonna have to manually update it again after they add or remove a thumbnail, which I doubt you want to do.
If you still want to try to make your own proxy, replace the Google Apps Script with this:
function doGet(e){ // e = link/URL
let output = UrlFetchApp.fetch(e) //Gets the JSON value from site
return ContentService.createTextOutput(output) //Converts output to String, I think
}
Should of mentioned I didn’t copy the tutorial exactly when making my own. If you want to test out the google apps script, make sure to add a “?q=” then whatever link you’re getting. So if you were to test it out (putting this in Google Search Bar) it would look like this
[your proxy url]?q=https://games.roblox.com/v2/games/703124385/media -- 703124385 is tower of hell
And here’s the Roblox Script I used:
local HttpService = game:GetService("HttpService")
local proxyURL = "Your proxy URL, make sure to not share this"
function getMedia(univID) --Gets images of Game
local link = "?q="..HttpService:UrlEncode("https://games.roblox.com/v2/games/"..tostring(univID).."/media")
local data
local didRun = pcall(function()
local response = HttpService:GetAsync(proxyURL..link)
local JSONData = HttpService:JSONDecode(response)
data = JSONData["response"]["data"]
end)
if didRun then
return data
else
warn("Failed to get game media "..univID)
return nil
end
end
local getTowerHeck = getMedia(703124385)
local TowerHeckImg1 = getTowerHeck[1]["imageId"]
If you’re still having trouble, make sure to send an image or explain where the problem is exactly (on roblox or google apps)
So after receiving these errors I tried to get a more specific error message. (First I followed what you said to do exactly though, so this wasnt why it errored.)
When I put in each part line by line in a pcall, the part of the script that returned an error was the line
Alright did some learning and updating. Apparently the Exception error from Google Apps comes from the fact that when the variable e is sent, it’s actually a table and not actually a link/String, so when the UrlFetch is used with e, it errors. Wrote the script I gave you 2 years ago, honestly no clue how mine is (still) working. Why am I even talking here you probably don’t care.
Here’s the revamped code I guess:
Google App Script:
function doGet(e) {
try{
return ContentService.createTextOutput(UrlFetchApp.fetch(e.queryString))
}catch(error){
console.log(e) // Help catch errors, put mouse to left go to executions and click one of the "Deployment"
console.error(error)
return ContentService.createTextOutput("None")
}
}
Roblox Script:
local HttpService = game:GetService("HttpService")
local proxyURL = "Your proxy, don't share"
function getMedia(univID)
local link = "?".."https://games.roblox.com/v2/games/"..tostring(univID).."/media"
local didRun,returnVal = pcall(function()
return HttpService:JSONDecode(HttpService:GetAsync(proxyURL..link))["data"]
end)
if didRun then
return returnVal
else
warn("Failed to get game media",univID)
warn(returnVal)
return nil
end
end
local getTowerHeck = getMedia(703124385)
if getTowerHeck then print(getTowerHeck) end
If you want me to explain why it works just ask. Also make sure to change the Google Apps version to the newest version.
Forgot mention, to test this, put this in a search bar: