No project description provided
Project description
Official repository: https://github.com/coletdjnz/yt-dlp-get-pot
Get PO Token Plugin Framework for yt-dlp
[!CAUTION] This plugin is not ready for general use and is awaiting changes to be merged in yt-dlp for it to be functional. Follow https://github.com/yt-dlp/yt-dlp/pull/10648 for updates.
A simple plugin framework for yt-dlp that allows the YouTube extractor to request PO Tokens from an external source when needed. It makes use (abuse) of the yt-dlp HTTP Request Handler framework to allow multiple implementations to co-exist.
For example, one plugin could support fetching PO Tokens for logged-out users, while another supports fetching PO Tokens for logged-in users.
To use, a user will need both the client plugin (this plugin) and one or more provider plugins installed.
Installing
[!IMPORTANT] This repository only contains the client-side plugin for yt-dlp! It does not contain an implementation to retrieve PO tokens. You will need to install a provider plugin in addition to this plugin.
Requires yt-dlp 2024.08.XX
or above.
If yt-dlp is installed through pip
or pipx
, you can install the plugin with the following:
pip or pipx
pipx inject yt-dlp yt-dlp-get-pot
or
python3 -m pip install -U yt-dlp-get-pot
Alternatively, you can install directly from the repo with https://github.com/coletdjnz/yt-dlp-get-pot/archive/refs/heads/master.zip
Manual install
-
Download the latest release zip from releases
-
Add the zip to one of the yt-dlp plugin locations
-
User Plugins
${XDG_CONFIG_HOME}/yt-dlp/plugins
(recommended on Linux/MacOS)~/.yt-dlp/plugins/
${APPDATA}/yt-dlp/plugins/
(recommended on Windows)
-
System Plugins
/etc/yt-dlp/plugins/
/etc/yt-dlp-plugins/
-
Executable location
- Binary: where
<root-dir>/yt-dlp.exe
,<root-dir>/yt-dlp-plugins/
- Binary: where
-
For more locations and methods, see installing yt-dlp plugins
If installed correctly, you should see the GetPOT YouTubeIE plugin override in yt-dlp -v
output:
[debug] Extractor Plugins: GetPOT (YoutubeIE)
Developing a Provider plugin
The provider plugin assumes this plugin is installed. You can define it as a Python dependency in your plugin package, or users can install it manually.
- Create a new plugin (you can use the yt-dlp sample plugins template).
- Create a new python file under
yt_dlp_plugins.extractor
(recommend naming itgetpot_<name>.py
). - In the plugin file, define a GetPOT Request Handler that extends
yt_dlp_plugins.extractor.getpot.GetPOTRequestHandler
. - Follow the example below and implement the
_get_pot
method to retrieve the PO Token from your source.
When yt-dlp attempts to get a PO Token, it will call out to the request handler. This is the Fetching PO Token for <client> client
line you see in the log.
Example
See getpot_example.py for an example implementation.
Debugging
To check that your Request Handler is being loaded, run yt-dlp with the -v
flag and look for the [debug] Request Handlers
section in the output.
You should see your request handler listed with the RH_NAME
:
[debug] Request Handlers: ..., getpot-<name>
For general plugin debugging tips, consult the yt-dlp plugin development wiki.
Tips
- Your implementation should consider caching the PO Token for the given parameters to avoid unnecessary requests.
- See the PO Token Guide for more information on the PO Tokens.
- If publishing to GitHub, add the
yt-dlp-plugins-get-pot
topic to your repository to help users find your provider plugin.
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
Hashes for yt_dlp_get_pot-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58796707efea1ed8009c76198c9a3b7700eb4b819972675cb171adde55ae3652 |
|
MD5 | a3dd599b4623120e5000e8583c962b35 |
|
BLAKE2b-256 | 8181144d246a363811cc46c8a6536872d74a9187619836d5cd6869fbad1a35fc |