Obtain item's RAP (API?)

Hello there,

Recently, I was attempting to get an limited’s Recent Average Price, however, it seems Roblox no longer loads the limited page fully because it doesn’t load the Recent Average Price area to a bot.

I’m just trying to have my website pull these Recent Average Price / RAP values when requested and I’m looking for a workaround. The catalog API doesn’t provide me specific asset RAP values

Melon

2 Likes

This post may be of use to you:

You can use inspect element to grab the name of whatever you’re looking for on the page and then use that module to grab the element in Lua. To use HTTP directed at Roblox.com from in game, you can use a proxy such as this one, or set up your own if you know how to do that.

If what you’re trying to do is from a server/bot you have running, and not from Roblox itself, you can just use the native js functions discussed in that module to grab elements from a page to accomplish the same thing (unless you’re not using JavaScript; then you’re going to have to Google the best ways to work with HTML with the language you’re using).

Basically, you’re having your code read the website as a human would, just in a more annoying-to-script fashion.

2 Likes

I am pulling all HTML data from the limited item page but the RAP html item returns nothing.

Oh. Well in that case, it may be how Roblox loads the RAP.

(but also double check that you’re grabbing the right element):

It looks to me that when you open an item’s page, it has a split second of loading for the RAP. It looks like it first sends you the page, then the client is requesting more info from the server to load the page dynamically. This probably saves a bit of loading time for the client as it appears the page has loaded.

What this means for us is that the page loads, THEN the RAP loads on the page. So, the initial GET request won’t return the RAP.

So, you can look through the HTTP Requests in Inspect Element to see what requests your browser made to Roblox to populate the page you needed. And it took me a minute, but after searching through the requests that my browser made, I found the link Roblox uses to get RAP:

https://www.roblox.com/asset/2409285794/sales-data

It returns a JSON Object with all the data you need.

That’s for https://www.roblox.com/catalog/2409285794/Playful-Vampire. So, it looks like you can grab it from there! I tested it in browser and it seemed to work.

1 Like

Useful link,

The issue however is you are using inspect element from your local computer, not a webserver in my case.

Are you able to find the JS script that requests this site https://www.roblox.com/asset/2409285794/sales-data? With that, I can make a workaround to getting the page’s html.

1 Like

Your WebServer can use that link and input the asset ID to grab what it needs. It can make a GET request to the following URL to grab the RAP:

https://www.roblox.com/asset/ASSET-ID-HERE/sales-data

That will return a JSON object that looks something like the following:


  "isValid": true,
  "data": {
    "AveragePrice": 5978,
    "OriginalPrice": 75,
    "QuantitySold": 20000,
    "HundredEightyDaySalesChart": "really long string detailing chart stuff",
    "HundredEightyDayVolumeChart": "really long string detailing chart stuff"
  },
  "error": ""
}

If you’re using NodeJS you can use something like request-promise. Otherwise, JavaScript has some native HTTP functions you can use.

If you’re using PHP, you can use PHP’s native HTTP functionality to grab the data directly from the URL. That link leads to some good information on how to grab data using PHP.

If you’re using Roblox, you can use HTTPService:JSONDecode() on the information you grab from the URL. To make a request directly to the Roblox website, you can use a proxy such as this one.

1 Like

My webserver is making this request via PHP with file_get_contents which normally returns data correctly. I’m not sure what is not letting it load.

1 Like

Well, since you’re using PHP, you can use PHP’s native HTTP functionality to grab the data directly from the URL. That link leads to some good information on how to grab data using PHP.

1 Like

Oh my life, I’m so stupid. I totally misread your past two messages. That page provides the AveragePrice already. Thank you!

I’ll read the data with PHP’s json encode functionality. Appreciate your help.

1 Like

No it’s no problem lmao. I’ve done the same exact thing.

I’m glad I could help solve your problem!

1 Like