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