Compare commits
2 Commits
e562d1ee14
...
7086177a58
| Author | SHA1 | Date | |
|---|---|---|---|
| 7086177a58 | |||
| dc8009db23 |
@@ -81,7 +81,7 @@ stage3_headers = {
|
||||
"Sec-Fetch-Mode": "navigate",
|
||||
"Content-Type": "application/json",
|
||||
"X-Youtube-Client-Name": "1",
|
||||
"X-Youtube-Client-Version": "2.20250829.01.00",
|
||||
"X-Youtube-Client-Version": "2.20250911.00.00",
|
||||
"Origin": "https://www.youtube.com",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"Cookie": "PREF=hl=en&tz=UTC; SOCS=CAI"
|
||||
@@ -93,7 +93,7 @@ stage3_body = {
|
||||
"client":
|
||||
{
|
||||
"clientName": "WEB",
|
||||
"clientVersion": "2.20250829.01.00",
|
||||
"clientVersion": "2.20250911.00.00",
|
||||
"hl": "en",
|
||||
"timeZone": "UTC",
|
||||
"utcOffsetMinutes": 0
|
||||
@@ -113,7 +113,7 @@ web_context_dict = {
|
||||
'deviceModel': '',
|
||||
'userAgent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0) Gecko/20100101 Firefox/142.0,gzip(gfe)',
|
||||
'clientName': 'WEB',
|
||||
'clientVersion': '2.20250829.01.00',
|
||||
'clientVersion': '2.20250911.00.00',
|
||||
'osName': 'Windows',
|
||||
'osVersion': '10.0',
|
||||
'screenPixelDensity': 2,
|
||||
|
||||
@@ -95,15 +95,15 @@ def translateLinks(link):
|
||||
def getUptime():
|
||||
return int(time.time()) - starttime
|
||||
|
||||
def safeTraverse(obj: dict, path: list, default=None):
|
||||
def safeTraverse(obj: dict, path: list, default=None, quiet: bool = False):
|
||||
result = obj
|
||||
try:
|
||||
for x in path:
|
||||
#print(f"traversing {result} with respect to {x}")
|
||||
result = result[x]
|
||||
except (KeyError, TypeError):
|
||||
except (KeyError, TypeError, IndexError):
|
||||
result = default
|
||||
print(f"error reading: {' -> '.join(path)} - returning: {default}")
|
||||
if not quiet: print(f"error reading: {' -> '.join(path)} - returning: {default}")
|
||||
finally:
|
||||
return result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user