Skip to content

Commit

Permalink
feat: print plugin version in debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
coletdjnz committed Sep 3, 2024
1 parent 3259757 commit ab4f440
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
9 changes: 8 additions & 1 deletion tests/test_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest
from yt_dlp.networking import Request
from yt_dlp.networking.exceptions import UnsupportedRequest, RequestError
from yt_dlp_plugins.extractor.getpot import GetPOTProvider, register_provider, register_preference
from yt_dlp_plugins.extractor.getpot import GetPOTProvider, register_provider, register_preference, __version__
from yt_dlp import YoutubeDL


Expand Down Expand Up @@ -61,6 +61,13 @@ def test_preference_registration():
assert a_test_preference in ie._provider_rd.preferences


def test_imports():
assert isinstance(__version__, str)
assert GetPOTProvider
assert register_provider
assert register_preference


class TestClient:
def test_get_pot(self):
with YoutubeDL() as ydl:
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp_plugins/extractor/getpot.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


__version__ = '0.0.2'
__all__ = ['GetPOTProvider', 'register_provider', 'register_preference']
__all__ = ['GetPOTProvider', 'register_provider', 'register_preference', '__version__']


class GetPOTResponse(Response):
Expand Down
9 changes: 5 additions & 4 deletions yt_dlp_plugins/extractor/getpot_client.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
from __future__ import annotations

import base64
import json
import typing

from yt_dlp.extractor.youtube import YoutubeIE
from yt_dlp.networking import Request
from yt_dlp.networking.exceptions import NoSupportingHandlers, RequestError
from yt_dlp.utils import update_url_query, ExtractorError
from yt_dlp.utils import ExtractorError

if typing.TYPE_CHECKING:
from yt_dlp.YoutubeDL import YoutubeDL
from yt_dlp.networking.common import RequestDirector

from yt_dlp_plugins.extractor.getpot import __version__


class _GetPOTClient(YoutubeIE, plugin_name='GetPOT'):
"""
Expand All @@ -24,8 +24,9 @@ def set_downloader(self, downloader: YoutubeDL):
if downloader:
self._provider_rd: RequestDirector = self._downloader.build_request_director(
YoutubeIE._GETPOT_PROVIDERS.values(), YoutubeIE._GETPOT_PROVIDER_PREFERENCES)
downloader.write_debug(f'GetPOT plugin version {__version__}', only_once=True)
downloader.write_debug(
f'PO Token Providers: {", ".join(rh.RH_NAME for rh in self._provider_rd.handlers.values())}',
f'PO Token Providers: {", ".join(rh.RH_NAME for rh in self._provider_rd.handlers.values()) or "none"}',
only_once=True)

def _fetch_po_token(self, client, visitor_data=None, data_sync_id=None, player_url=None, **kwargs):
Expand Down

0 comments on commit ab4f440

Please sign in to comment.