add support for GUC proxy, move safeTraverse to ythdd_globals

This commit is contained in:
2025-02-28 00:56:13 +01:00
parent 019e47edd9
commit d1b9f90e7e
5 changed files with 27 additions and 12 deletions

View File

@@ -6,6 +6,7 @@
from flask import Response, request, redirect
from markupsafe import escape
from time import strftime, gmtime, time
from ythdd_globals import safeTraverse
import json, datetime
import invidious_formats
import ythdd_globals
@@ -78,17 +79,6 @@ def trending():
def popular():
return send(200, [{}])
def safeTraverse(obj: dict, path: list, default=None):
result = obj
try:
for x in path:
result = result[x]
except KeyError:
result = default
print(f"error reading: {' -> '.join(path)} - returning: {default}")
finally:
return result
def getError(idata: dict):
unknown_error = {"status": "Unknown error", "reason": "This is a generic ythdd error."}
error = ""