Skip to main content

Official repository: https://github.com/coletdjnz/yt-dlp-get-pot

PO Token Plugin Framework for yt-dlp

What is a PO Token?

A plugin framework for yt-dlp that allows the YouTube extractor to request Proof of Origin (PO) Tokens from an external source when needed. It allows for multiple providers to co-exist and provide PO Tokens for different scenarios.

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

Requires yt-dlp 2024.09.27 or above.

If yt-dlp is installed through pip or pipx, you can install the plugin with the following:

pip/pipx

pipx inject yt-dlp yt-dlp-get-pot

or

python3 -m pip install -U yt-dlp-get-pot

Manual install

  1. Download the latest release zip from releases

  2. 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/

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.

  1. Create a new plugin (you can use the yt-dlp sample plugins template).
  2. Create a new python file under yt_dlp_plugins.extractor (recommend naming it getpot_<name>.py).
  3. In the plugin file, define a Provider that extends yt_dlp_plugins.extractor.getpot.GetPOTProvider.
  4. Implement _get_pot method to retrieve the PO Token from your source.

It should look something like:

from yt_dlp_plugins.extractor.getpot import GetPOTProvider, register_provider

@register_provider
class MyProviderRH(GetPOTProvider):
   _PROVIDER_NAME = 'myprovider'
   _SUPPORTED_CLIENTS = ('web', )
   
   def _get_pot(self, client, ydl, visitor_data=None, data_sync_id=None, **kwargs):
        # Implement your PO Token retrieval here
        return 'PO_TOKEN'

See getpot_example.py for a more in-depth example.

When yt-dlp attempts to get a PO Token, it will call out to available providers. This is the Fetching PO Token for <client> client line you see in the verbose log.

Debugging

To check that your provider is being loaded, run yt-dlp with the -v flag and a YouTube video, and look for the PO Token Providers line in the output. You should see your provider listed:

[debug] [GetPOT] PO Token Providers: <PROVIDER_NAME>

You can use --print-traffic to see if your provider is being called.

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.
  • If publishing to GitHub, add the yt-dlp-plugins-get-pot topic to your repository to help users find your provider plugin.
  • If publishing to PyPI, add the yt-dlp-plugins-get-pot keyword to your package to help users find your provider plugin.
  • The PO Token Guide has more information on PO Tokens.
  • Advanced: A Provider is a customized yt-dlp HTTP Request Handler, so any parameters and functions that are available to the RequestHandler are also available to a Provider. Check out yt_dlp.networking.common.RequestHandler to see more.

Metadata

Release files for yt-dlp-get-pot 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yt-dlp-get-pot 0.3.0
File Size Uploaded Provenance Actions
yt_dlp_get_pot-0.3.0.tar.gz 9.8 kB With provenance Details for yt_dlp_get_pot-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for yt-dlp-get-pot 0.3.0
File Interpreter ABI Platform Actions
yt_dlp_get_pot-0.3.0-py3-none-any.whl Python 3 none any Details for yt_dlp_get_pot-0.3.0-py3-none-any.whl

Total release size: 17.8 kB

Release files / yt_dlp_get_pot-0.3.0.tar.gz

Download URL yt_dlp_get_pot-0.3.0.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ac9530b9e7b3d667235b9119da475f595d2dc7e6f6bbf98b965011be454e8833
BLAKE2b-256 checksum
How to use checksums
0f776d252ce1a4aa24871e5518737016e2d1bf4d2fffc425767611964fd31fa6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 25, 2025.

Transparency log

Release files / yt_dlp_get_pot-0.3.0-py3-none-any.whl

Download URL yt_dlp_get_pot-0.3.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a49a596a3e3c02cd9ce051192ea3fe8168cf24ece8954bed6aa331a87d86954f
BLAKE2b-256 checksum
How to use checksums
64be3e5551e12943554f66a72f6128862ea7dc11d2429abe957d6d7b5d2b463c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 25, 2025.

Transparency log

Security for yt-dlp-get-pot 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for yt_dlp_get_pot-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 25, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page