Added Steam Names
This commit is contained in:
parent
c86f17317e
commit
afc7c4123a
|
|
@ -1,6 +1,8 @@
|
|||
import re
|
||||
import requests
|
||||
import json
|
||||
import xml
|
||||
import xmltodict
|
||||
|
||||
|
||||
#Steamid converter
|
||||
|
|
@ -17,28 +19,21 @@ def steamid_to_64bit(steamid):
|
|||
#Kinda disgusting with the fixed lines and really easy to break.
|
||||
# I really need to clean this up
|
||||
def get_user_input():
|
||||
|
||||
print("Status Screen to FaceIT ELO by HerZ ")
|
||||
print("https://steamcommunity.com/id/HerzGegenFame")
|
||||
print()
|
||||
print("Please paste the output from the status command and then press Enter until the program resumes")
|
||||
|
||||
no_of_lines = 22
|
||||
status_string_i = ""
|
||||
for i in range(no_of_lines):
|
||||
status_string_i+=input()+"\n"
|
||||
return status_string_i
|
||||
|
||||
|
||||
|
||||
#Regex the SteamIDs from status
|
||||
def regex_for_steamids(input_string):
|
||||
steamids_from_status = re.findall(r"\S*STEAM_+[0-9]+:[0-9]+:[0-9]+", input_string)
|
||||
return steamids_from_status
|
||||
|
||||
|
||||
|
||||
|
||||
#Get FaceIT Data
|
||||
def get_faceit_data(steamid_64):
|
||||
url = "https://open.faceit.com/data/v4/players?game=csgo&game_player_id=" + str(steamid_64)
|
||||
|
|
@ -47,22 +42,18 @@ def get_faceit_data(steamid_64):
|
|||
faceit_response_json = faceit_response.json()
|
||||
return faceit_response_json
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#Get Steam Data
|
||||
def get_steam_data(steamid_64):
|
||||
steamurl ="https://steamcommunity.com/profiles/" + str(steamid_64) +"/?xml=1"
|
||||
steam_req = requests.get(steamurl)
|
||||
steamdict_funct = xmltodict.parse(steam_req.content)
|
||||
return steamdict_funct
|
||||
|
||||
|
||||
status_string = get_user_input()
|
||||
|
||||
steamids = regex_for_steamids(status_string)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#Stupid counter that counts stupid numbers
|
||||
i=0
|
||||
|
||||
|
|
@ -72,18 +63,26 @@ for entrys in steamids:
|
|||
steamid = steamids[i]
|
||||
steamid_64 = steamid_to_64bit(steamid)
|
||||
|
||||
faceit_json = get_faceit_data(steamid_64)
|
||||
steam_dict = get_steam_data(steamid_64)
|
||||
|
||||
#Print the Output
|
||||
print("SteamID: "+steamids[i])
|
||||
|
||||
print()
|
||||
|
||||
try:
|
||||
print("Steam Name: "+ steam_dict['profile']['steamID'])
|
||||
except:
|
||||
print("STEAM ERROR")
|
||||
|
||||
try:
|
||||
print("FaceIT Name: "+ faceit_json['nickname'],)
|
||||
print("Country: "+ faceit_json['country'])
|
||||
print("ELO: "+ str(faceit_json['games']['csgo']['faceit_elo']))
|
||||
print("Level : "+ str(faceit_json['games']['csgo']['skill_level']))
|
||||
print("FaceIT Name: "+ faceit_json['nickname'],)
|
||||
print()
|
||||
print("############################################################")
|
||||
|
||||
except:
|
||||
print('No FaceIT Account found for this Steam ID')
|
||||
print()
|
||||
|
|
|
|||
|
|
@ -18,6 +18,3 @@ players : 10 humans, 0 bots (10/10 max) (not hibernating)
|
|||
# 13 12 "juice" STEAM_1:0:14734584 15:13 66 0 active 786432
|
||||
# 14 13 "halfway crook" STEAM_1:1:33757872 15:13 61 0 active 786432
|
||||
#end
|
||||
|
||||
|
||||
pa
|
||||
Loading…
Reference in New Issue