0

So basically, at the moment, we are trying to write a basic HTML 5 page that, when you press a button, returns whether the user, on Steam, is in-game, offline, or online. We have looked at the Steam API, and to find this information, it requires the person's 64 bit ID (steamID64) and we, on the website, are only given the username. In order to find their 64 bit id, we have tried to scrape off of a website (steamidconverter.com) to get the user's 64 bit id from their username. We tried doing this through the javascript, but of course we ran into the cross domain block, not allowing us to access that data from our google App Engine website.

I have experience in Python, so I attempted to figure out how to get the HTML from that website (in the form of steamidconverter.com/(personsusername)) with Python. That was a success in scraping, thanks to another post on Stack Overflow.

BUT, I have no idea how to get that data back to the javascript and get it to do the rest of the work. I am stumped and really need help. This is all on google App Engine. All it is at the moment, is a button that runs a simple javascript that attempts to use JQuery to get the contents of the page back, but fails. I don't know how to integrate the two!

Please Help!

Ashwini Chaudhary
  • 244,495
  • 58
  • 464
  • 504

2 Answers2

1

Why don't you use Steam as an OpenID provider? Sounds like this would give you the user's ID:

Steam can act as an OpenID provider. This allows your application to authenticate a user's SteamID without requiring them to enter their Steam username or password on your site (which would be a violation of the API Terms of Use.) Just download an OpenID library for your language and platform of choice and use http://steamcommunity.com/openid as the provider. (The returned Claimed ID will contain the user's 64-bit SteamID.

matt b
  • 138,234
  • 66
  • 282
  • 345
  • Still the problem remains, how do I get the person's status now, as I still have to scrape the website that the api provides (http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=XXXXXXXXXXXXXXXXXXXXXXX&steamids=YYYYYYYYYYYYYYYYY of course replacing XXX with the key that we got when we signed up and the YYY with the person's steam ID) to get gameextrainfo, on that page. It also poses that cross domain block. How does that part work and how would I do that most efficiently. I probably am not understanding something easy. Sorry if I seem dumb. – user1504773 Jul 05 '12 at 18:12
  • Usually you'd want to have your backend code - the AppEngine python stuff here - communicate with the 3rd party (Steam in this case) API, as it's problematic to communicate with someone else's API in Javascript running in the browser for the reasons you've found out. I'm not sure about the particular details of the Steam API though as I'm not familiar with it. – matt b Jul 05 '12 at 18:20
  • See the main problem in using the other web framework, is this is supposed to be a mobile compatible and run all in browser. It shouldn't have any local memory. The openID idea seems promising, I will pursue that further. Thanks a bunch for everything, and I wish I could upvote your post somehow. Although I have less than 15 rep =) Thanks so much! – user1504773 Jul 05 '12 at 19:14
1

Since you have the steam id from the service you can then make another request to their steam community page via the id. From there you can use beautiful soup to return a dom to grab the required information for your project.

Now onto your question. You can have all this happen within a request in a handler, if you are using a web framework such as Tornado, and the handler can return json in the page and you can render this json using your javascript code.

Look into a web framework for python such as Tornado or Django to help you with return and displaying the data.

sean
  • 3,955
  • 21
  • 28