Hello there, nice person who spent their time checking this question! I was wondering about Http Service, as I have been trying to learn it. I understand how to retrieve information and finding webpages, but I do not understand how to use the information. Could someone try explaining how to use the information retrieved from a webpage using Http Service I am lucky enough to have gotten help through the community chat, but I still find it hard to understand how to retrieve more than one type of information. For example, if I want to get all the recent questions from the question page, what would I need to do to find the parts that are necessary?
Here's the relevant parts from the Wiki and CrescentCode documentation. Because we could
JSONDecode( string JSONString ) -> var DeserializedData
Deserializes a JSON-formatted table into a Lua table. This is important when processing returns from requests to APIs because most APIs return their data in JSON format, and this allows you to interact with it natively.
local HttpService = game:GetService 'HttpService' -- Make a GET request to httpbin.org/get local GetData = HttpService:GetAsync('http://httpbin.org/get'); -- Decode our data GetData = HttpService:JSONDecode(GetData); -- Take a look at the GET request we just sent print("GET origin:", GetData.origin)
On the off chance that you're not retrieving data from an API source, you'd better start looking into string manipulation and the relevant patterns. The reason for this is that you're going to mostly be out of luck when parsing HTML without any knowledge of string manipulation.
Alternatively, you can use a third-party parser, but expect it to have tricky dependencies, some of which may be unsatisfiable.