This project is tested with BrowserStack.
this fork replaces the older nodriver-based chromium automation with playwright, a more modern browser automation framework. key changes:
- switching from
nodriver
toplaywright
- callback system for token updates
- the http server now waits for token updates
- i broke docker version and i cba'ed to fix it because i hate docker.
the (web) server component was rewritten from a wsgi implementation to a more straightforward threaded http server.
This script will output two parameters: po_token and visitor_data. Needed for passing YouTube checks in Invidious or the program that use the po_token functionality.
po_token known as Proof of Origin Token. This is an attestation token generated by a complex anti robot verification system created by Google named BotGuard/DroidGuard. It is used to confirm that the request is coming from a genuine device.
These identity tokens (po_token and visitor_data) generated using this tool will make your entire YouTube session more easily traceable by YouTube because it is tied to a unique identifier.
- You have to run this command on the same public IP address as the one blocked by YouTube. Not necessarily the same machine, just the same public IP address. Subsequent usage of this same token will work on the same IP range or even the same ASN. The point is to generate this token on a blocked IP as "unblocked" IP addresses seems to not generate a token valid for passing the checks on a blocked IP.
- Run the script:
docker run quay.io/invidious/youtube-trusted-session-generator
- Copy paste the values of these the two parameters (po_token and visitor_data) in config.yaml
po_token: XXX visitor_data: XXX
- Restart Invidious or the program that use the po_token functionality.
- Install Chromium or Google Chrome.
- Create a new virtualenv:
virtualenv venv
- Activate the virtualenv:
source venv/bin/activate
- Install the dependencies:
pip install -r requirements.txt
- Run the script:
python potoken-generator.py --oneshot
- Copy paste the values of these the two parameters (po_token and visitor_data) in config.yaml
po_token: XXX visitor_data: XXX
- Restart Invidious or the program that use the po_token functionality.
In "headless: false", Chromium does not support sanboxing when it is not ran by root user.
Run the program: docker run -p 8080:8080 quay.io/invidious/youtube-trusted-session-generator:webserver
- Install Chromium or Google Chrome.
- Create a new virtualenv:
virtualenv venv
- Activate the virtualenv:
source venv/bin/activate
- Install the dependencies:
pip install -r requirements.txt
- Run the program:
python potoken-generator.py
send a request to http://localhost:8080/token to obtain a po_token. the server returns a json object with potoken and visitor_data.
to force a refresh of the token, send a POST request to http://localhost:8080/update. this endpoint has two behaviors:
- it initiates a token refresh process
- it waits for the refresh to complete (up to 60 seconds)
if the update succeeds within the timeout, the endpoint returns the new token as json with status 200. if a refresh is already in progress, you'll get a 409 conflict response. if the update times out, you'll receive a 504 gateway timeout.