Ejemplo n.º 1
0
def auth_to_steam64(auth):
    auth = auth.strip()
    if 'steamcommunity.com/id/' in auth:
        return custom_url_to_steam3(auth)

    elif 'steamcommunity.com/profiles/' in auth:
        try:
            return True, SteamID.from_community_url(auth.rstrip('/')).as_64()
        except SteamIDError:
            return False, ''

    elif auth.startswith('1:0:') or auth.startswith('1:1'):
        return steam2_to_steam64('STEAM_' + auth)

    elif auth.startswith('STEAM_'):
        return steam2_to_steam64(auth)

    elif auth.startswith('7656119') and 'steam' not in auth:
        return True, auth

    elif auth.startswith('[U:1:'):
        suc, steam2 = steam3_to_steam2(auth)
        if suc:
            return steam2_to_steam64(steam2)
        else:
            return False, ''

    else:
        return custom_name_to_steam3(auth)
Ejemplo n.º 2
0
def steam64_ns2id(i):
    try:
        if 'profiles' in i:
            if i[-1] == '/':
                i = i[:-1]
            profile = SteamID.from_community_url(i)
        elif 'STEAM_0' in i:
            profile = SteamID.from_text(i)
        else:
            if 'id' in i:
                r = requests.get(i).text
                i = re.search('steamid...([0-9]*)', r).group(1)
            profile = SteamID.from_text('STEAM_0:1:{}'.format(
                int((int(i) - 76561197960265728) / 2)))
    except Exception as e:
        logger.error(e)
    else:
        steam64 = int(profile.as_64())
        i_server = 0 if steam64 % 2 == 0 else 1
        steam64 -= i_server
        if steam64 > 76561197960265728:
            steam64 -= 76561197960265728
        steam64 /= 2

        return int(steam64 * 2 + i_server)