This commit is contained in:
afkarxyz
2025-10-12 00:23:26 +07:00
parent f6f238361c
commit 3eda3245ca
12 changed files with 346 additions and 89 deletions
+18 -4
View File
@@ -1,5 +1,6 @@
from time import sleep
from urllib.parse import urlparse, parse_qs
from pathlib import Path
import requests
import json
import time
@@ -14,19 +15,32 @@ def get_random_user_agent():
# https://github.com/xyloflake/spot-secrets-go
def generate_totp():
url = "https://raw.githubusercontent.com/afkarxyz/secretBytes/refs/heads/main/secrets/secretBytes.json"
local_path = Path.home() / ".spotify-secret" / "secretBytes.json"
used_local = False
try:
url = "https://raw.githubusercontent.com/afkarxyz/secretBytes/refs/heads/main/secrets/secretBytes.json"
resp = requests.get(url, timeout=10)
if resp.status_code != 200:
raise Exception(f"Failed to fetch TOTP secrets from GitHub. Status: {resp.status_code}")
raise Exception(f"GitHub fetch failed with status: {resp.status_code}")
secrets_list = resp.json()
except Exception as github_error:
try:
if local_path.exists():
with open(local_path, 'r') as f:
secrets_list = json.load(f)
used_local = True
else:
raise Exception(f"GitHub failed ({github_error}) and no local file found at {local_path}")
except Exception as local_error:
raise Exception(f"Failed to fetch secrets from both GitHub and local: {local_error}")
try:
latest_entry = max(secrets_list, key=lambda x: x["version"])
version = latest_entry["version"]
secret_cipher = latest_entry["secret"]
except Exception as e:
raise Exception(f"Failed to fetch secrets from GitHub: {str(e)}")
raise Exception(f"Failed to process secrets: {str(e)}")
processed = [byte ^ ((i % 33) + 9) for i, byte in enumerate(secret_cipher)]
processed_str = "".join(map(str, processed))