AdminTuts

System Administration and IT Tutorials

Programming

Programmatically checking Steam username availability

Sometimes you need to find an easy and reliable way to do something without resorting to using an official API for various reasons such as distributing an amateur-focused script or program.

Explaining how to obtain API keys is often too much of a hassle. Other times, the service might not provide a convenient endpoint for getting the information you need.

That’s when we can use our detective skills to build our own method as we will learn today. In this tutorial, I’ll show you step-by-step how to make a simple Python script to check whether or not a specific Steam ID is available.

Steam IDs are in the following format:

https://steamcommunity.com/id/[name]

The best method I found to do this is to make a HTTP GET request to the profile url seen above and parse the HTML response to check for the existence of a specific phrase. As of the time of this writing, only error pages contain an H3 element, thus you can safely assume that the Steam ID is available for claiming if it exists. If it doesn’t exist, that means it found a profile with that ID, so it is not available to claim.

I have fully commented the source code below to explain what each part does.

If you have any relevant questions at all, please leave a comment on this post with your question and I will be happy to answer them.

Update 2018/08/10: I have changed the method I’m using to check availability to check for a specific phrase rather than an H3 element. 

4 Comments

  1. This is very fascinating, You’re an overly professional blogger.
    I have joined your feed and look forward to seeking more of your great post.
    Additionally, I have shared your web site in my social networks!

  2. Highly descriptive article, I loved that a lot. Will there
    be a part 2?

  3. I am not very fantastic with English but I line up this really easygoing to translate.

  4. Hello, after reading this awesome piece of writing i am also happy to share my knowledge
    here with friends.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Theme by Anders Norén