-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
return to docker with tor and po token
- Loading branch information
1 parent
326d1ae
commit 595e30c
Showing
6 changed files
with
92 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
""" | ||
Copied from https://github.com/iv-org/youtube-trusted-session-generator/tree/master | ||
""" | ||
|
||
import json | ||
import sys | ||
|
||
from nodriver import cdp, loop, start | ||
|
||
|
||
async def main(): | ||
browser = await start(headless=False) | ||
tab = browser.main_tab | ||
tab.add_handler(cdp.network.RequestWillBeSent, send_handler) | ||
page = await browser.get("https://www.youtube.com/embed/jNQXAC9IVRw") | ||
await tab.wait(cdp.network.RequestWillBeSent) | ||
await tab.sleep(10) | ||
button_play = await tab.select("#movie_player") | ||
await button_play.click() | ||
await tab.wait(cdp.network.RequestWillBeSent) | ||
await tab.sleep(30) | ||
|
||
|
||
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) | ||
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 | ||
|
||
|
||
if __name__ == "__main__": | ||
loop().run_until_complete(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
XVFB_WHD=${XVFB_WHD:-1280x720x16} | ||
|
||
Xvfb :99 -ac -screen 0 $XVFB_WHD -nolisten tcp > /dev/null 2>&1 & | ||
sleep 2 | ||
|
||
# Run python script on display 0 | ||
DISPLAY=:99 python multi_crawler/poo_generator.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters