No project description provided
Project description
Official repository: https://github.com/Brainicism/bgutil-ytdlp-pot-provider
BgUtils POT Provider
[!CAUTION] Passing PO tokens no longer bypasses the bot check for majority of cases. See #37 for more details.
A proof-of-origin token (POT) provider to be used alongside coletdjnz's POT plugin framework. We use LuanRT's Botguard interfacing library to generate the token.
This is used to bypass the 'Sign in to confirm you're not a bot' message when invoking yt-dlp from an IP address flagged by YouTube. See What is a PO Token? for more details.
The provider comes in two parts:
- Provider: Two options -
- (a) An HTTP server that generates the POT, and has interfaces for the plugin to retrieve data from (easy setup + docker image provided)
- (b) A POT generation script supplied via extractor arguments
- Provider plugin: uses POT plugin framework to retrieve data from the provider, allowing yt-dlp to simulate having passed the 'bot check'
Installation
Base Requirements
-
Requires yt-dlp
2024.09.27
or above. -
If using Docker image for option (a) for the provider, the Docker runtime is required.
Otherwise, Node.js (>= 18) and Yarn are required. You will also need to clone the repository.
1. Set up the provider
There are two options for the provider, an always running POT generation HTTP server, and a POT generation script invoked when needed. The HTTP server option is simpler, and comes with a prebuilt Docker image. You only need to choose one option.
(a) HTTP Server Option
The provider is a Node.js HTTP server. You have two options of running it: as a prebuilt docker image, or manually as a node application.
Docker:
docker run --name bgutil-provider -d -p 4416:4416 brainicism/bgutil-ytdlp-pot-provider
Native:
# replace 0.6.0 with the latest version, or a matching plugin
git clone --single-branch --branch 0.6.0 https://github.com/Brainicism/bgutil-ytdlp-pot-provider.git
cd bgutil-ytdlp-pot-provider/server/
yarn install --frozen-lockfile
npx tsc
node build/main.js
Server Endpoints/Environment Variables
Environment Variables
- TOKEN_TTL: The time in hours for a PO token to be considered valid. While there are no definitive answers on how long a token is valid, it has been observed to be valid for atleast a couple of days. Default: 6
Endpoints
- POST /get_pot: Accepts a
visitor_data
(unauthenticated),data_sync_id
(authenticated) or an empty body in the request body. If no identifier is passed, a new unauthenticatedvisitor_data
will be generated. Returnspo_token
and the associated identifiervisit_identifier
. - POST /invalidate_caches: Resets the PO token cache, forcing new tokens to be generated on next fetch.
(b) Generation Script Option
- Transpile the generation script to Javascript:
# Clone/extract the contents into your home directory (`~/` on Unix-based systems, `%USERPROFILE%` for Windows)
# if you want to use this method without needing to specify `getpot_bgutil_script` extractor argument on each yt-dlp invocation.
cd ~
# replace 0.6.0 with the latest version, or a matching plugin
git clone --single-branch --branch 0.6.0 https://github.com/Brainicism/bgutil-ytdlp-pot-provider.git
cd bgutil-ytdlp-pot-provider/server/
yarn install --frozen-lockfile
npx tsc
- Make sure
node
is available in yourPATH
.
2. Install the plugin
PyPI:
python3 -m pip install -U bgutil-ytdlp-pot-provider
This will automatically install coletdjnz's POT plugin framework if haven't installed it yet.
Manual:
- Make sure you have coletdjnz's POT plugin framework installed already (must be at least version 0.1.1 or newer).
- Download the latest release zip from releases. Install it by placing the zip into one of the plugin folders.
Usage
If using option (a) HTTP Server for the provider, and the default IP/port number, you can use yt-dlp like normal 🙂.
If you want to change the port number used by the provider server, use the --port
option.
node build/main.js --port 8080
If changing the port or IP used for the provider server, pass it to yt-dlp via getpot_bgutil_baseurl
--extractor-args "youtube:getpot_bgutil_baseurl=http://127.0.0.1:8080"
If using option (b) script for the provider, with the default script location in your home directory (i.e: ~/bgutil-ytdlp-pot-provider
), you can also use yt-dlp like normal.
If you installed the script in a different location, pass it as the extractor argument getpot_bgutil_script
to youtube
for each yt-dlp call.
--extractor-args "youtube:getpot_bgutil_script=$WORKSPACE/bgutil-ytdlp-pot-provider/server/build/generate_once.js"
If both methods are available for use, the option (b) script will be prioritized.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file bgutil_ytdlp_pot_provider-0.6.1.tar.gz
.
File metadata
- Download URL: bgutil_ytdlp_pot_provider-0.6.1.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 751be5dd54ddd7983f00093720bf08771c4c60a3a6daf6a678d82f5c813a9ea7 |
|
MD5 | 1bf14b9b1ca2f7d88e2ac91316a16f42 |
|
BLAKE2b-256 | 015be0217fdae1668cbb72379cfddc00e1fc9cf1b1587c8d4cd9208ad714bf91 |
File details
Details for the file bgutil_ytdlp_pot_provider-0.6.1-py3-none-any.whl
.
File metadata
- Download URL: bgutil_ytdlp_pot_provider-0.6.1-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d9ec4c4eccbc1b73ec0b781db89ecb719b8f442c84158d82c99402007f4df08 |
|
MD5 | ac47f023e978e189c4d2600fc9757720 |
|
BLAKE2b-256 | 6b55715c132abe5ec58fa670372fcf2e05e47eb6c77944e383e2547e2f8621ee |