yt-dlp-get-pot


Nameyt-dlp-get-pot JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2024-09-29 00:37:50
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseThis is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to <http://unlicense.org/>
keywords yt-dlp yt-dlp-plugin yt-dlp-plugins-get-pot
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Official repository: <https://github.com/coletdjnz/yt-dlp-get-pot>

# PO Token Plugin Framework for yt-dlp

_[What is a PO Token?](https://github.com/yt-dlp/yt-dlp/wiki/Extractors#po-token-guide)_

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](#installing)
  * [pip/pipx](#pippipx)
  * [Manual install](#manual-install)
* [Developing a Provider plugin](#developing-a-provider-plugin)
  * [Debugging](#debugging)
  * [Tips](#tips)

## 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.**
> 
> You may be able to find provider plugins in the [yt-dlp-plugins-get-pot](https://github.com/topics/yt-dlp-plugins-get-pot) topic.

**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](https://github.com/coletdjnz/yt-dlp-get-pot/releases) 

2. Add the zip to one of the [yt-dlp plugin locations](https://github.com/yt-dlp/yt-dlp#installing-plugins)

    - 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](https://github.com/yt-dlp/yt-dlp#installing-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](https://github.com/yt-dlp/yt-dlp-sample-plugins)).
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:

```python
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](examples/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](https://github.com/yt-dlp/yt-dlp/wiki/Plugin-Development).

### 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](https://github.com/topics/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](https://github.com/yt-dlp/yt-dlp/wiki/Extractors#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.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "yt-dlp-get-pot",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "yt-dlp, yt-dlp-plugin, yt-dlp-plugins-get-pot",
    "author": null,
    "author_email": "coletdjnz <coletdjnz@protonmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/a0/90/35d9ffde611396902119ae801e7df7a78bfd822d9d9ebcd443eb190ea2c5/yt_dlp_get_pot-0.2.0.tar.gz",
    "platform": null,
    "description": "Official repository: <https://github.com/coletdjnz/yt-dlp-get-pot>\n\n# PO Token Plugin Framework for yt-dlp\n\n_[What is a PO Token?](https://github.com/yt-dlp/yt-dlp/wiki/Extractors#po-token-guide)_\n\nA plugin framework for yt-dlp that allows the YouTube extractor to request Proof of Origin (PO) Tokens from an external source when needed. \nIt allows for multiple providers to co-exist and provide PO Tokens for different scenarios.\n\n> For example, one plugin could support fetching PO Tokens for logged-out users, while another supports fetching PO Tokens for logged-in users.\n\nTo use, a user will need both the client plugin (this plugin) and one or more provider plugins installed.\n\n* [Installing](#installing)\n  * [pip/pipx](#pippipx)\n  * [Manual install](#manual-install)\n* [Developing a Provider plugin](#developing-a-provider-plugin)\n  * [Debugging](#debugging)\n  * [Tips](#tips)\n\n## Installing\n\n> [!IMPORTANT]\n> This repository only contains the **client-side plugin** for yt-dlp!\n> It does not contain an implementation to retrieve PO tokens. **You will need to install a provider plugin in addition to this plugin.**\n> \n> You may be able to find provider plugins in the [yt-dlp-plugins-get-pot](https://github.com/topics/yt-dlp-plugins-get-pot) topic.\n\n**Requires yt-dlp `2024.09.27` or above.**\n\nIf yt-dlp is installed through `pip` or `pipx`, you can install the plugin with the following:\n\n### pip/pipx\n\n```\npipx inject yt-dlp yt-dlp-get-pot\n```\nor\n\n```\npython3 -m pip install -U yt-dlp-get-pot\n```\n\n\n### Manual install\n\n1. Download the latest release zip from [releases](https://github.com/coletdjnz/yt-dlp-get-pot/releases) \n\n2. Add the zip to one of the [yt-dlp plugin locations](https://github.com/yt-dlp/yt-dlp#installing-plugins)\n\n    - User Plugins\n        - `${XDG_CONFIG_HOME}/yt-dlp/plugins` (recommended on Linux/macOS)\n        - `~/.yt-dlp/plugins/`\n        - `${APPDATA}/yt-dlp/plugins/` (recommended on Windows)\n    \n    - System Plugins\n       -  `/etc/yt-dlp/plugins/`\n       -  `/etc/yt-dlp-plugins/`\n    \n    - Executable location\n        - Binary: where `<root-dir>/yt-dlp.exe`, `<root-dir>/yt-dlp-plugins/`\n\nFor more locations and methods, see [installing yt-dlp plugins](https://github.com/yt-dlp/yt-dlp#installing-plugins) \n\nIf installed correctly, you should see the GetPOT YouTubeIE plugin override in `yt-dlp -v` output:\n\n    [debug] Extractor Plugins: GetPOT (YoutubeIE)\n\n## Developing a Provider plugin\n\nThe 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.\n\n1. Create a new plugin (you can use the [yt-dlp sample plugins template](https://github.com/yt-dlp/yt-dlp-sample-plugins)).\n2. Create a new python file under `yt_dlp_plugins.extractor` (recommend naming it `getpot_<name>.py`).\n3. In the plugin file, define a Provider that extends `yt_dlp_plugins.extractor.getpot.GetPOTProvider`.\n4. Implement `_get_pot` method to retrieve the PO Token from your source.\n\nIt should look something like:\n\n```python\nfrom yt_dlp_plugins.extractor.getpot import GetPOTProvider, register_provider\n\n@register_provider\nclass MyProviderRH(GetPOTProvider):\n   _PROVIDER_NAME = 'myprovider'\n   _SUPPORTED_CLIENTS = ('web', )\n   \n   def _get_pot(self, client, ydl, visitor_data=None, data_sync_id=None, **kwargs):\n        # Implement your PO Token retrieval here\n        return 'PO_TOKEN'\n```\n\nSee [getpot_example.py](examples/getpot_example.py) for a more in-depth example.\n\nWhen 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.\n\n### Debugging\n\nTo 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.\n You should see your provider listed:\n \n    [debug] [GetPOT] PO Token Providers: <PROVIDER_NAME>\n\nYou can use `--print-traffic` to see if your provider is being called.\n\nFor general plugin debugging tips, consult the [yt-dlp plugin development wiki](https://github.com/yt-dlp/yt-dlp/wiki/Plugin-Development).\n\n### Tips\n\n- Your implementation should consider caching the PO Token for the given parameters to avoid unnecessary requests.\n- If publishing to GitHub, add the [yt-dlp-plugins-get-pot](https://github.com/topics/yt-dlp-plugins-get-pot) topic to your repository to help users find your provider plugin.\n- If publishing to PyPI, add the `yt-dlp-plugins-get-pot` keyword to your package to help users find your provider plugin.\n- The [PO Token Guide](https://github.com/yt-dlp/yt-dlp/wiki/Extractors#po-token-guide) has more information on PO Tokens.\n- 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.\n",
    "bugtrack_url": null,
    "license": "This is free and unencumbered software released into the public domain.  Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.  In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  For more information, please refer to <http://unlicense.org/>",
    "summary": null,
    "version": "0.2.0",
    "project_urls": null,
    "split_keywords": [
        "yt-dlp",
        " yt-dlp-plugin",
        " yt-dlp-plugins-get-pot"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "131d9b4c2bcc5849862fb193c6218c4c65f171c6a1b18f0db5bc2e929f75d3cb",
                "md5": "d48ca50599937c14796228256ce502d2",
                "sha256": "49614c3f592ce486c80175549056098078539651553072ef657f00ed66bf9cfe"
            },
            "downloads": -1,
            "filename": "yt_dlp_get_pot-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d48ca50599937c14796228256ce502d2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7745,
            "upload_time": "2024-09-29T00:37:49",
            "upload_time_iso_8601": "2024-09-29T00:37:49.073589Z",
            "url": "https://files.pythonhosted.org/packages/13/1d/9b4c2bcc5849862fb193c6218c4c65f171c6a1b18f0db5bc2e929f75d3cb/yt_dlp_get_pot-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a09035d9ffde611396902119ae801e7df7a78bfd822d9d9ebcd443eb190ea2c5",
                "md5": "a671f0e0d1de2b6c5c500988f6e15b90",
                "sha256": "4582b567b47ca8735f3724f7f962664b7e43711aa2208e7673b7826cf5d82af4"
            },
            "downloads": -1,
            "filename": "yt_dlp_get_pot-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a671f0e0d1de2b6c5c500988f6e15b90",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 9289,
            "upload_time": "2024-09-29T00:37:50",
            "upload_time_iso_8601": "2024-09-29T00:37:50.365621Z",
            "url": "https://files.pythonhosted.org/packages/a0/90/35d9ffde611396902119ae801e7df7a78bfd822d9d9ebcd443eb190ea2c5/yt_dlp_get_pot-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-29 00:37:50",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "yt-dlp-get-pot"
}
        
Elapsed time: 0.93225s