mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-04-30 12:36:03 +00:00
[ie/youtube] Refactor project structure
This commit is contained in:
parent
0c857e5de8
commit
71de622d19
@ -4,7 +4,7 @@ from collections import OrderedDict
|
|||||||
import pytest
|
import pytest
|
||||||
from yt_dlp.extractor.youtube.pot._provider import IEContentProvider, BuiltInIEContentProvider
|
from yt_dlp.extractor.youtube.pot._provider import IEContentProvider, BuiltInIEContentProvider
|
||||||
from yt_dlp.utils import bug_reports_message
|
from yt_dlp.utils import bug_reports_message
|
||||||
from yt_dlp.extractor.youtube.pot.builtin.cache.memory import MemoryLRUPCP, memorylru_preference, initialize_global_cache
|
from yt_dlp.extractor.youtube.pot._builtin.memory_cache import MemoryLRUPCP, memorylru_preference, initialize_global_cache
|
||||||
from yt_dlp.version import __version__
|
from yt_dlp.version import __version__
|
||||||
from yt_dlp.globals import _pot_memory_cache, _pot_cache_providers
|
from yt_dlp.globals import _pot_memory_cache, _pot_cache_providers
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ from yt_dlp.extractor.youtube.pot.provider import (
|
|||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
from yt_dlp.extractor.youtube.pot.builtin.utils import get_webpo_content_binding, ContentBindingType
|
from yt_dlp.extractor.youtube.pot.utils import get_webpo_content_binding, ContentBindingType
|
||||||
|
|
||||||
|
|
||||||
class TestGetWebPoContentBinding:
|
class TestGetWebPoContentBinding:
|
||||||
|
|||||||
@ -10,7 +10,7 @@ from yt_dlp.extractor.youtube.pot.provider import (
|
|||||||
)
|
)
|
||||||
from yt_dlp.version import __version__
|
from yt_dlp.version import __version__
|
||||||
|
|
||||||
from yt_dlp.extractor.youtube.pot.builtin.cachespec.webpo import WebPoPCSP
|
from yt_dlp.extractor.youtube.pot._builtin.webpo_cachespec import WebPoPCSP
|
||||||
from yt_dlp.globals import _pot_pcs_providers
|
from yt_dlp.globals import _pot_pcs_providers
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ Refer to the [PO Token Guide](https://github.com/yt-dlp/yt-dlp/wiki/PO-Token-Gui
|
|||||||
|
|
||||||
- `yt_dlp.extractor.youtube.pot.cache`
|
- `yt_dlp.extractor.youtube.pot.cache`
|
||||||
- `yt_dlp.extractor.youtube.pot.provider`
|
- `yt_dlp.extractor.youtube.pot.provider`
|
||||||
- `yt_dlp.extractor.youtube.pot.builtin.utils`
|
- `yt_dlp.extractor.youtube.pot.utils`
|
||||||
|
|
||||||
Everything else is internal-only and no guarantees are made about the API stability.
|
Everything else is internal-only and no guarantees are made about the API stability.
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ from yt_dlp.extractor.youtube.pot.provider import (
|
|||||||
register_preference,
|
register_preference,
|
||||||
)
|
)
|
||||||
from yt_dlp.networking.common import Request
|
from yt_dlp.networking.common import Request
|
||||||
from yt_dlp.extractor.youtube.pot.builtin.utils import get_webpo_content_binding
|
from yt_dlp.extractor.youtube.pot.utils import get_webpo_content_binding
|
||||||
from yt_dlp.utils import traverse_obj
|
from yt_dlp.utils import traverse_obj
|
||||||
from yt_dlp.networking.exceptions import RequestError
|
from yt_dlp.networking.exceptions import RequestError
|
||||||
import json
|
import json
|
||||||
@ -50,7 +50,7 @@ class MyPoTokenProviderPTP(PoTokenProvider): # Provider name must end with "PTP
|
|||||||
|
|
||||||
# Innertube Client Name.
|
# Innertube Client Name.
|
||||||
# For example, "WEB", "ANDROID", "TVHTML5".
|
# For example, "WEB", "ANDROID", "TVHTML5".
|
||||||
# For a list of WebPO client names, see yt_dlp.extractor.youtube.pot.builtin.utils.WEBPO_CLIENTS.
|
# For a list of WebPO client names, see yt_dlp.extractor.youtube.pot.utils.WEBPO_CLIENTS.
|
||||||
# Also see yt_dlp.extractor.youtube._base.INNERTUBE_CLIENTS for a list of client names currently supported by the YouTube extractor.
|
# Also see yt_dlp.extractor.youtube._base.INNERTUBE_CLIENTS for a list of client names currently supported by the YouTube extractor.
|
||||||
_SUPPORTED_CLIENTS = ('WEB', 'TVHTML5')
|
_SUPPORTED_CLIENTS = ('WEB', 'TVHTML5')
|
||||||
|
|
||||||
|
|||||||
@ -1 +1,2 @@
|
|||||||
from .builtin import utils as _ # noqa: F401
|
# Trigger import of built-in providers
|
||||||
|
from ._builtin import _trigger_import # noqa: F401
|
||||||
|
|||||||
4
yt_dlp/extractor/youtube/pot/_builtin/__init__.py
Normal file
4
yt_dlp/extractor/youtube/pot/_builtin/__init__.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
from .memory_cache import MemoryLRUPCP as _MemoryLRUPCP # noqa: F401
|
||||||
|
from .webpo_cachespec import WebPoPCSP as _WebPoPCSP # noqa: F401
|
||||||
|
|
||||||
|
_trigger_import = None # noqa: F401
|
||||||
@ -1,7 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from yt_dlp.extractor.youtube.pot._provider import BuiltInIEContentProvider
|
from yt_dlp.extractor.youtube.pot._provider import BuiltInIEContentProvider
|
||||||
from yt_dlp.extractor.youtube.pot.builtin.utils import ContentBindingType, get_webpo_content_binding
|
|
||||||
from yt_dlp.extractor.youtube.pot.cache import (
|
from yt_dlp.extractor.youtube.pot.cache import (
|
||||||
CacheProviderWritePolicy,
|
CacheProviderWritePolicy,
|
||||||
PoTokenCacheSpec,
|
PoTokenCacheSpec,
|
||||||
@ -11,6 +10,7 @@ from yt_dlp.extractor.youtube.pot.cache import (
|
|||||||
from yt_dlp.extractor.youtube.pot.provider import (
|
from yt_dlp.extractor.youtube.pot.provider import (
|
||||||
PoTokenRequest,
|
PoTokenRequest,
|
||||||
)
|
)
|
||||||
|
from yt_dlp.extractor.youtube.pot.utils import ContentBindingType, get_webpo_content_binding
|
||||||
from yt_dlp.utils import traverse_obj
|
from yt_dlp.utils import traverse_obj
|
||||||
|
|
||||||
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
from .cache.memory import MemoryLRUPCP as _MemoryPCP # noqa: F401
|
|
||||||
from .cachespec.webpo import WebPoPCSP as _WebPoPCSP # noqa: F401
|
|
||||||
@ -97,7 +97,7 @@ class PoTokenProvider(IEContentProvider, abc.ABC, suffix='PTP'):
|
|||||||
|
|
||||||
# Innertube Client Name.
|
# Innertube Client Name.
|
||||||
# For example, "WEB", "ANDROID", "TVHTML5".
|
# For example, "WEB", "ANDROID", "TVHTML5".
|
||||||
# For a list of WebPO client names, see yt_dlp.extractor.youtube.pot.builtin.utils.WEBPO_CLIENTS.
|
# For a list of WebPO client names, see yt_dlp.extractor.youtube.pot._builtin.utils.WEBPO_CLIENTS.
|
||||||
# Also see yt_dlp.extractor.youtube._base.INNERTUBE_CLIENTS for a list of client names currently supported by the YouTube extractor.
|
# Also see yt_dlp.extractor.youtube._base.INNERTUBE_CLIENTS for a list of client names currently supported by the YouTube extractor.
|
||||||
_SUPPORTED_CLIENTS: tuple[str] | None = ()
|
_SUPPORTED_CLIENTS: tuple[str] | None = ()
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import urllib.parse
|
|||||||
from yt_dlp.extractor.youtube.pot.provider import PoTokenContext, PoTokenRequest
|
from yt_dlp.extractor.youtube.pot.provider import PoTokenContext, PoTokenRequest
|
||||||
from yt_dlp.utils import traverse_obj
|
from yt_dlp.utils import traverse_obj
|
||||||
|
|
||||||
__all__ = ['WEBPO_CLIENTS', 'get_webpo_content_binding']
|
__all__ = ['WEBPO_CLIENTS', 'ContentBindingType', 'get_webpo_content_binding']
|
||||||
|
|
||||||
WEBPO_CLIENTS = (
|
WEBPO_CLIENTS = (
|
||||||
'WEB',
|
'WEB',
|
||||||
Loading…
x
Reference in New Issue
Block a user