I’ve been experimenting with API’s recently, but there’s two things I’m missing. An API to grab the current amount of visits a game has, and another API to grab the amount of Likes the game has. Jailbreak had its 2 billion visits update happen live when the game reached 2 billion visits. I know it’s possible. Anyone have any ideas?
I believe Jailbreak just manually updated the game at 2B visits and dubbed it a “live update”, not sure though. If you can’t find the API that’s likely what they did though.
You could use this module: HTML/DOM Reader module and a roblox proxy to scrape the game visits from the games page.
The HttpService does not allow users to make requests to the Roblox website, so you will need another web-server to make a request to the Roblox domain. On that server you can make a GET request to the game page of the game in question. In the case of Jailbreak for example you would just make a GET request to https://www.roblox.com/games/606849621/Jailbreak
.
What this does is it essentially returns the HTML page as a string. Your web-browser will interpret this and create a nice looking web-page, but a server will just see this as text. You can then do some pattern matching to look for the following two things:
- For the current number of visits, you will want to look for this piece of HTML
- For the number of likes a game has you will want to look for this piece of HTML
The number of likes will be easy to grab since the <span>
element has an id
property, which should always be unique. So just search for id="vote-up-text" title="
and grab all consecutively following number characters.
The number of visits is a little more difficult since it is part of a list element with “game-stat” classes. For this one you will have to look for the third occurrence of the string class="game-stat"
and then grab the string of the first number character you find afterwards up until the first double quote. That should grab the “2,334,728,283” part from the first picture I posted above.
Although possible, that method will break if Roblox ever updates their pages, even if they just change a few tags around
Alternatively, you can use the https://games.roblox.com api; the documents can be found at https://games.roblox.com/docs
Look at the V1 for this API, and you will find the following to get some data about a game:
https://games.roblox.com/v1/games?universeIds=ID_HERE
https://games.roblox.com/v1/games/votes?universeIds=ID_HERE
https://games.roblox.com/v1/games/{universeId}/favorites/count
Replace the above ID_HERE with your Universe ID, seperated by commas if you are using multiple universes.
You can use the first link to view the amount of current players, and the visits of the game, and the second link to view upvotes and downvotes
The last one can be used to get the number of favorites (PS. it only accepts one universe id at a time)
Like people have said above, you will, however, need your own web server proxy to request the data from these endpoints, as HttpService cannot grab data from roblox.com endpoints