diff --git a/EloFinder-by-HerZ.py b/EloFinder-by-HerZ.py new file mode 100644 index 0000000..a56c9d6 --- /dev/null +++ b/EloFinder-by-HerZ.py @@ -0,0 +1,96 @@ +import re +import requests +import json + + +#Steamid converter +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 + +#Input of Status screen. +#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) + headers = { 'accept': 'application/json', 'Authorization' : 'Bearer ab46a7ab-6ab8-4c00-a8ff-41c0ff71d562' } + faceit_response = requests.get(url, headers=headers) + faceit_response_json = faceit_response.json() + return faceit_response_json + + + + + + + + + +status_string = get_user_input() + +steamids = regex_for_steamids(status_string) + + + + + +#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) + + + #Print the Output + print("SteamID: "+steamids[i]) + + 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() + print("############################################################") + + except: + print('No FaceIT Account found for this Steam ID') + print() + print("############################################################") + + i= i+1 + + +input() +input('Press ENTER to exit') \ No newline at end of file