-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
client.get_user().rich_presence not returning publicly available information #350
Comments
Anonymous login is very limited. You cannot get persona state with it, you have to login as normal user. If the account is not part of your friendlist, you get limited information. I'm not sure if privacy settings of the user determine whether you get name or not. I think you get the name always, but only get reach presence and state for friends. The name is not username, its the display name. Username, as in the one you use to login, is never display anywhere for anyone except the user themselves. |
So, I did a bit more testing today, I tested mostly with my friends account until I went over to the anon acc. I then used my own account and was unable to get any info still. It seems that rich_presence returns empty dict regardless when not looking your own account up. This is seemingly regardless of privacy settings, as when I use the web version with my friends account it gives me the data I am looking for. I am assuming that any information that is open to the public on the web version should be available to the API? I'll change the title to reflect this |
I suggest enabling debug logging and looking at the contents of the persona state updates. See https://steam.readthedocs.io/en/latest/user_guide.html#logging |
I think the main problem here is that when looking at the page through a browser you get a slightly different version of the page than what the steam API does. When I look at the sources for the page from chrome (using incognito and not logged in) for a profile using a link: session = client.get_web_session()
site = session.get(url)
print(site.text) From this, where the user has enabled the option to share this information, I am expecting to find a div with the class miniprofile_hover which is found using a web browser. This tag contains the key information that I am looking for - the rich presence data. I am, however, unable to find that same div in the sources that is downloaded using the python library. If the information is available to the public using a browser, then why is the same information not possible to extract using the API? Here is the full code I am using without the steam IDs from steam.client import SteamClient
from valve.steam.id import SteamID
import logging
client = SteamClient()
client.verbose_debug = True
# client.anonymous_login()
client.cli_login()
user_id = <<Any Steam ID of non-friend playing a game with game details privacy setting set to public here>>
# an easy way to ensure that the game sharing is enabled for a user, is to visit their page on the browser version in
# incognito mode hover over their profile picture and if a box shows up containing information about the game the
# user is playing then you have the settings correct
url = "https://steamcommunity.com/profiles/{}".format(user_id)
steam_id = SteamID.from_community_url(url)
a = client.get_user(steam_id, False)
session = client.get_web_session()
site = session.get(url)
print(site.text) |
@mrKallah I tried the same use case and also ran into the problem. It becomes apparent why when look at what your browser does on connection level when loading the https://steamcommunity.com/profiles/{id}/games/?tab=all page: The raw HTML result is what you see downloaded as the result of the The raw HTML contains references to some external javascript dependencies and it also has some internal scripts which I presume build the actual game list after the initial page load. There is one script with a variable called I see that this field is called twice in a script file called So, if there is no other way to obtain the friend's game list we'd have to do a full emulation (with javascript) of the browser... |
Using
returns
I have tried using cli_login() instead of anonymous_login().
I have tried using the user_id instead of the steam_id when calling client.get_user()
I have tried using both True and False when calling client.get_user() on the second argument
And I have tried mulitple steam community IDs.
It always returns empty usernames and rich presense.
The text was updated successfully, but these errors were encountered: