added wip
This commit is contained in:
parent
417fdd9138
commit
3e834f9de9
|
|
@ -0,0 +1,111 @@
|
|||
from tabnanny import verbose
|
||||
from turtle import st
|
||||
from flask import Flask, render_template, request, redirect, url_for
|
||||
from waitress import serve
|
||||
import requests
|
||||
import re
|
||||
import json
|
||||
import xml
|
||||
import xmltodict
|
||||
import asyncio
|
||||
from joblib import Parallel, delayed
|
||||
import multiprocessing
|
||||
|
||||
#####Define Global Vars
|
||||
|
||||
data_dict = {}
|
||||
|
||||
#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
|
||||
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
|
||||
def loop_faceit_data(steamid64):
|
||||
url = "https://open.faceit.com/data/v4/players?game=csgo&game_player_id=" + str(steamid64)
|
||||
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
|
||||
|
||||
def loop_steam_data(steamid64):
|
||||
steamurl ="https://steamcommunity.com/profiles/" + str(steamid64) +"/?xml=1"
|
||||
steam_req = requests.get(steamurl)
|
||||
steamdict_funct = xmltodict.parse(steam_req.content)
|
||||
return steamdict_funct
|
||||
|
||||
|
||||
|
||||
status_screen = get_user_input()
|
||||
steamids = regex_for_steamids(status_screen)
|
||||
|
||||
|
||||
num_cores = multiprocessing.cpu_count()
|
||||
|
||||
steamid64_dict = {}
|
||||
steamid64_dict = Parallel(n_jobs=num_cores, verbose=50)(delayed(steamid_to_64bit)(steamid)for steamid in steamids)
|
||||
|
||||
|
||||
|
||||
print(steamid64_dict)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue