Ulysses

General => Developers Corner => Topic started by: General Butthurt on November 06, 2013, 08:10:49 PM

Title: Dictionary From Contents Of URL?
Post by: General Butthurt on November 06, 2013, 08:10:49 PM
Hi everyone, I'm working on a mod for TTT that attempts to detect ghosters (friends who trade information privately to cheat the game). The way it works is by going player by player and seeing how many of their friends are currently on the server. I have a usergroup called member that I will exclude from the check to prevent false positives from my community members. The goal is to alert the admins of new people who have friends on the server so that they can look out for ghosting.

Right now I want to use the steam get friends api (https://developer.valvesoftware.com/wiki/Steam_Web_API#GetFriendList_.28v0001.29)

The problem that comes up is that this api returns a dictionary containing your friends list on a webpage. Does anyone know of a way in default lua or within ulx/ulib to get the contents of a webpage and store it into a dictionary? I don't want to display the page, I need the actual text on the page so I can get the dictionary and manipulate it.
Title: Re: Dictionary From Contents Of URL?
Post by: Megiddo on November 07, 2013, 05:18:54 AM
http.Fetch (http://wiki.garrysmod.com/page/http/Fetch) is what you're looking for.
Title: Re: Dictionary From Contents Of URL?
Post by: JamminR on November 07, 2013, 04:54:26 PM
Returns a web page?
Odd, not according to the 'format' portion of the wiki.
https://developer.valvesoftware.com/wiki/Steam_Web_API#Formats

XML/JSON and some custom 'Valve Data Format' I've not heard of or researched further.
I've not tested this of course to see what returns, as I don't have a key.

However, http.fetch as Megiddo stated would return data.