add support for GUC proxy, move safeTraverse to ythdd_globals
This commit is contained in:
@@ -86,8 +86,21 @@ def translateLinks(link):
|
||||
|
||||
link = link.replace("https://i.ytimg.com/", config['general']['public_facing_url'])
|
||||
link = link.replace("https://yt3.ggpht.com/", config['general']['public_facing_url'] + "ggpht/")
|
||||
link = link.replace("https://yt3.googleusercontent.com/", config['general']['public_facing_url'] + "guc/")
|
||||
|
||||
return link
|
||||
|
||||
def getUptime():
|
||||
return int(time.time()) - starttime
|
||||
return int(time.time()) - starttime
|
||||
|
||||
def safeTraverse(obj: dict, path: list, default=None):
|
||||
result = obj
|
||||
try:
|
||||
for x in path:
|
||||
#print(f"traversing {result} with respect to {x}")
|
||||
result = result[x]
|
||||
except KeyError:
|
||||
result = default
|
||||
print(f"error reading: {' -> '.join(path)} - returning: {default}")
|
||||
finally:
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user