diff --git a/Status_to_FaceIT_Stats.py b/Status_to_FaceIT_Stats.py new file mode 100644 index 0000000..2b687be --- /dev/null +++ b/Status_to_FaceIT_Stats.py @@ -0,0 +1,106 @@ +import re +import requests +import json + + + +def steamid_to_64bit(steamid): + steam64id = 76561197960265728 # Who tf knows how this works + # IT JUST FUCKING DOES! + id_split = steamid.split(":") + steam64id += int(id_split[2]) * 2 # JUST MULTIPLY BY 2... Cause THAT MAKES PERFEKT SENSE RIGHT?! + if id_split[1] == "1": + steam64id += 1 + return steam64id + + +print(" /|_") +print(" ........ / |_ ........") +print(" .........../ /............") +print(" ............/ >..............") +print(" .............( >................") +print(" ............./ /..................") +print("............./ /.....................") +print("............/ /.....................") +print(".........__/ \_____.................") +print(" ......./' |................") +print(" ......./ /-\ /...............") +print(" ...../ / \--/................") +print(" .../ /.......................") +print(" / /.....................") +print(" ( >....................") +print(" / >...................") +print(" / _| .................") +print(" / __/ .............") +print(" /_/ .........") +print(" .....") +print(" ...") +print(" .") +print() +print() +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") +print() + + + +#Input of Status screen. +#Kinda disgusting with the fixed lines and really easy to break. +# I really need to clean this up +no_of_lines = 22 +lines = "" +for i in range(no_of_lines): + lines+=input()+"\n" + + + +#Debug leftovers +#print(lines) + + + +#Regex the SteamIDs from status +steamids = re.findall(r"\S*STEAM_+[0-9]+:[0-9]+:[0-9]+", lines) + + +#Stupid counter that counts stupid numbers +i=0 + +#Loop over all the IDs +for entrys in steamids: + #Converet IDS + steamid = steamids[i] + steamid_64 = steamid_to_64bit(steamid) + + + #Get FaceIT Data + url = "https://open.faceit.com/data/v4/players?game=csgo&game_player_id=" + str(steamid_64) + headers = { 'accept': 'application/json', 'Authorization' : 'Bearer ab46a7ab-6ab8-4c00-a8ff-41c0ff71d562' } + r = requests.get(url, headers=headers) + rjson = r.json() + + #Print the Output + print("SteamID: "+steamids[i]) + + try: + print("FaceIT Name: "+ rjson['nickname'],) + print("Country: "+ rjson['country']) + print("ELO: "+ str(rjson['games']['csgo']['faceit_elo'])) + print("Level : "+ str(rjson['games']['csgo']['faceit_elo'])) + print() + print("############################################################") + + except: + print('No FaceIT Account found for this Steam ID') + print() + print("############################################################") + + i= i+1 + + + + + + diff --git a/test status.txt b/test status.txt new file mode 100644 index 0000000..62837a9 --- /dev/null +++ b/test status.txt @@ -0,0 +1,23 @@ + + + +connected to =[A:1:3454786563:19753]:0 +hostname: Valve CS:GO EU North Server (srcds8027-sto1.188.14) +version : 1.38.2.1 secure +os : Linux +type : official dedicated +map : de_vertigo +players : 10 humans, 0 bots (10/10 max) (not hibernating) + +# userid name uniqueid connected ping loss state rate +# 3 2 "Weabo" STEAM_1:1:61300297 15:13 75 0 active 786432 +# 4 3 "Trihard Wick" STEAM_1:0:82497558 15:13 62 0 active 625000 +# 7 6 "snoukka" STEAM_1:1:114125796 15:13 47 0 active 786432 +# 8 7 "Raphiniert29" STEAM_1:0:119184825 15:13 80 0 active 786432 +# 9 8 "XidoronX" STEAM_1:1:213143672 15:13 62 0 active 196608 +# 10 9 "Lätsä" STEAM_1:1:3550954 15:13 63 0 active 786432 +# 11 10 "HerZ" STEAM_1:0:80639491 15:13 65 0 active 625000 +# 12 11 "Terminator" STEAM_1:0:140700758 15:13 100 0 active 196608 +# 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 \ No newline at end of file