Last active
May 2, 2025 05:35
-
-
Save parkerlreed/262756ec015465a334eddee29cd9af45 to your computer and use it in GitHub Desktop.
OculusDB downloader using https://addons.mozilla.org/en-US/firefox/addon/external-application/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import os | |
import re | |
import requests | |
import subprocess | |
from datetime import datetime, timezone | |
import shlex | |
# Relaunch in Konsole if not already in a terminal | |
if os.environ.get("RUNNING_IN_KONSOLE") != "1": | |
# Launch Konsole and rerun this script with same args | |
args = [shlex.quote(arg) for arg in sys.argv] | |
script_path = shlex.quote(sys.argv[0]) | |
konsole_cmd = f"env RUNNING_IN_KONSOLE=1 python {script_path} {' '.join(args[1:])}" | |
os.execvp("konsole", ["konsole", "-e", "bash", "-c", konsole_cmd]) | |
# === CONFIG === | |
ACCESS_TOKEN = "oc_ac_at here" | |
if len(sys.argv) != 2: | |
print("Usage: python oculusdb.py <meta_url>") | |
sys.exit(1) | |
meta_url = sys.argv[1].rstrip('/') | |
# === Extract App ID === | |
match = re.search(r'/(\d+)/?$', meta_url) | |
if not match: | |
print("[-] Invalid Meta URL format.") | |
sys.exit(1) | |
app_id = match.group(1) | |
api_url = f"https://oculusdb.rui2015.me/api/v1/connected/{app_id}" | |
download_dir = f"/home/parker/Downloads/Quest/{app_id}" | |
# === Fetch API data === | |
resp = requests.get(api_url) | |
resp.raise_for_status() | |
data = resp.json() | |
# Filter downloadable versions | |
downloadable_versions = [v for v in data["versions"] if v.get("downloadable") is True] | |
if not downloadable_versions: | |
print("[-] No downloadable APK versions found.") | |
sys.exit(1) | |
# Display menu | |
print("Available downloadable versions:\n") | |
# Calculate max width for version string | |
max_vlen = max(len(v.get("version", "")) for v in downloadable_versions) | |
for idx, version in enumerate(downloadable_versions): | |
vname = version.get("version") or version.get("version_name") or "Unknown" | |
vid = version.get("id") | |
date = version.get("created_date") | |
try: | |
dt = datetime.fromtimestamp(int(date), tz=timezone.utc).strftime("%Y-%m-%d %H:%M") | |
except Exception as e: | |
dt = "unknown" | |
print(f"[{str(idx).rjust(2)}] {vname.ljust(max_vlen)} | ID: {vid} | Uploaded: {dt}") | |
# Prompt user | |
choice = input(f"\nSelect version to download [0]: ").strip() | |
if not choice: | |
selected = downloadable_versions[0] | |
else: | |
try: | |
selected = downloadable_versions[int(choice)] | |
except (ValueError, IndexError): | |
print("[-] Invalid selection.") | |
sys.exit(1) | |
# Determine output folder | |
selected_version = selected.get("version") | |
latest_version = downloadable_versions[0].get("version") | |
if selected_version != latest_version: | |
download_dir = f"/home/parker/Downloads/Quest/{app_id}/{selected_version}" | |
else: | |
download_dir = f"/home/parker/Downloads/Quest/{app_id}" | |
apk_url = f'https://securecdn.oculus.com/binaries/download/?id={selected["id"]}&access_token={ACCESS_TOKEN}' | |
obb_list = selected.get("obbList") or [] | |
obb_urls = [ | |
obb["uri"] + f"&access_token={ACCESS_TOKEN}" | |
for obb in obb_list | |
] | |
# === Write aria2c input list === | |
os.makedirs(download_dir, exist_ok=True) | |
url_list_path = os.path.join(download_dir, "urls.txt") | |
with open(url_list_path, "w") as f: | |
f.write(apk_url + "\n") | |
for url in obb_urls: | |
f.write(url + "\n") | |
subprocess.run([ | |
"bash", "-c", | |
f""" | |
aria2c -c -x 16 -s 16 -j 5 --auto-file-renaming=false -d '{download_dir}' -i '{url_list_path}' ; | |
echo -e '\\nDownload complete. Press Enter to exit.' ; | |
read | |
""" | |
]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated with a much simpler script using the API