Author Topic: Dictionary From Contents Of URL?  (Read 1930 times)

0 Members and 1 Guest are viewing this topic.

Offline General Butthurt

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Dictionary From Contents Of URL?
« 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.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Re: Dictionary From Contents Of URL?
« Reply #1 on: November 07, 2013, 05:18:54 AM »
http.Fetch is what you're looking for.
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Dictionary From Contents Of URL?
« Reply #2 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.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming