mirror of
https://github.com/iv-org/youtube-trusted-session-generator.git
synced 2025-01-15 16:12:21 +01:00
make the script waiting for more seconds for the antibot script to load
fixes #7
This commit is contained in:
parent
4bd95c76f2
commit
b4b4cb78b5
1 changed files with 8 additions and 2 deletions
10
index.py
10
index.py
|
@ -11,6 +11,8 @@ async def main():
|
|||
tab.add_handler(cdp.network.RequestWillBeSent, send_handler)
|
||||
page = await browser.get('https://www.youtube.com/embed/jNQXAC9IVRw')
|
||||
await tab.wait(cdp.network.RequestWillBeSent)
|
||||
print("[INFO] waiting 10 seconds for the page to fully load.")
|
||||
await tab.sleep(10)
|
||||
button_play = await tab.select("#movie_player")
|
||||
await button_play.click()
|
||||
await tab.wait(cdp.network.RequestWillBeSent)
|
||||
|
@ -21,8 +23,12 @@ async def send_handler(event: cdp.network.RequestWillBeSent):
|
|||
if "/youtubei/v1/player" in event.request.url:
|
||||
post_data = event.request.post_data
|
||||
post_data_json = json.loads(post_data)
|
||||
print("visitor_data: " + post_data_json["context"]["client"]["visitorData"])
|
||||
print("po_token: " + post_data_json["serviceIntegrityDimensions"]["poToken"])
|
||||
visitor_data = post_data_json["context"]["client"]["visitorData"]
|
||||
po_token = post_data_json["serviceIntegrityDimensions"]["poToken"]
|
||||
print("visitor_data: " + visitor_data)
|
||||
print("po_token: " + po_token)
|
||||
if len(po_token) < 160:
|
||||
print("[WARNING] there is a high chance that the potoken generated won't work. please try again on another internet connection.")
|
||||
sys.exit(0)
|
||||
return
|
||||
|
||||
|
|
Loading…
Reference in a new issue