Initial commit
This commit is contained in:
54
__init__.py
Normal file
54
__init__.py
Normal file
@@ -0,0 +1,54 @@
|
||||
import requests
|
||||
import os
|
||||
import config
|
||||
import logging
|
||||
import sys
|
||||
import json
|
||||
|
||||
VERSION = "0.0.1"
|
||||
|
||||
# Load configuration
|
||||
ROBLOSECURITY = config.roblosecurity or None
|
||||
DST_DIR = config.dst_dir or './AppSettings'
|
||||
|
||||
# Collect AppSettings endpoints
|
||||
AppSettings = {
|
||||
"PCStudioApp": "https://clientsettingscdn.roblox.com/v2/settings/application/PCStudioApp",
|
||||
"PCDesktopClient": "https://clientsettingscdn.roblox.com/v2/settings/application/PCDesktopClient",
|
||||
"MacDesktopClient": "https://clientsettingscdn.roblox.com/v2/settings/application/MacDesktopClient",
|
||||
"MacStudioClient": "https://clientsettingscdn.roblox.com/v2/settings/application/MacStudioApp",
|
||||
"UWPApp": "https://clientsettingscdn.roblox.com/v2/settings/application/UWPApp",
|
||||
"XboxClient": "https://clientsettingscdn.roblox.com/v2/settings/application/XboxClient",
|
||||
"AndroidApp": "https://clientsettingscdn.roblox.com/v2/settings/application/AndroidApp",
|
||||
}
|
||||
|
||||
# Prepare logs
|
||||
if not os.path.exists("logs"):
|
||||
os.makedirs("logs")
|
||||
log_format = logging.Formatter(
|
||||
"[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s"
|
||||
)
|
||||
stdout_handler = logging.StreamHandler(sys.stdout)
|
||||
stdout_handler.setFormatter(log_format)
|
||||
logfile_handler = logging.FileHandler("logs/appsettings.log", mode="w")
|
||||
logfile_handler.setFormatter(log_format)
|
||||
log = logging.getLogger("AppSettings-archiver")
|
||||
log.setLevel(logging.INFO)
|
||||
log.addHandler(stdout_handler)
|
||||
log.addHandler(logfile_handler)
|
||||
|
||||
if ROBLOSECURITY is None:
|
||||
log.warning(f"{"#"*6} ROBLOSECURITY IS NOT SET, SOME FFLAGS MAY BE MISSING {"#"*6}")
|
||||
|
||||
os.makedirs(DST_DIR, exist_ok=True)
|
||||
|
||||
for AppSetting in AppSettings:
|
||||
log.info(f"Processing {AppSetting}")
|
||||
response = requests.get(AppSettings[AppSetting], headers={"Cookie": f".ROBLOSECURITY={ROBLOSECURITY}"})
|
||||
if response.status_code == 200:
|
||||
log.info(f"Successfully retrieved {AppSetting}")
|
||||
with open(os.path.join(DST_DIR, f"{AppSetting}.json"), "w") as f:
|
||||
formatted_response = json.dumps(response.json(), indent=4)
|
||||
f.write(formatted_response)
|
||||
else:
|
||||
log.error(f"Failed to retrieve {AppSetting}: {response.status_code}")
|
||||
Reference in New Issue
Block a user