Own a dedicated browser lifecycle for YouTube presentation.
More...
|
| None | __init__ (self, *, str|Path profile_path=DEFAULT_YOUTUBE_PROFILE_PATH, tuple[str,...] browser_candidates=("google-chrome", "google-chrome-stable", "chromium", "chromium-browser",), bool software_rendering=False, bool dark_mode=False) |
| | Configure a YouTube player.
|
| bool | play (self, str target, *, str display, tuple[int, int]|None window_position=None, tuple[int, int]|None window_size=None) |
| | Open a YouTube URL or search query.
|
|
None | stop (self) |
| | Stop the browser process owned by this player.
|
|
bool | is_active (self) |
| | Return whether the owned YouTube browser process is running.
|
|
| str | resolve_target (str target) |
| | Convert search text to a YouTube URL or validate a direct URL.
|
Own a dedicated browser lifecycle for YouTube presentation.
◆ __init__()
| None video.youtube_player.YouTubePlayer.__init__ |
( |
| self, |
|
|
* | , |
|
|
str | Path | profile_path = DEFAULT_YOUTUBE_PROFILE_PATH, |
|
|
tuple[str, ...] | browser_candidates = (
"google-chrome",
"google-chrome-stable",
"chromium",
"chromium-browser",
), |
|
|
bool | software_rendering = False, |
|
|
bool | dark_mode = False ) |
Configure a YouTube player.
- Parameters
-
| profile_path | Persistent browser profile used for YouTube sessions. |
| browser_candidates | Browser executables in preference order. |
| software_rendering | Disable GPU paths for compatibility when true. |
| dark_mode | Request browser dark presentation when true. |
◆ play()
| bool video.youtube_player.YouTubePlayer.play |
( |
| self, |
|
|
str | target, |
|
|
* | , |
|
|
str | display, |
|
|
tuple[int, int] | None | window_position = None, |
|
|
tuple[int, int] | None | window_size = None ) |
Open a YouTube URL or search query.
- Parameters
-
| target | YouTube HTTPS URL or search text. |
| display | X11 display used by the browser. |
| window_position | Optional initial X/Y position. |
| window_size | Optional initial width/height. |
- Returns
- True after the browser launch request succeeds.
◆ resolve_target()
| str video.youtube_player.YouTubePlayer.resolve_target |
( |
str | target | ) |
|
|
static |
Convert search text to a YouTube URL or validate a direct URL.
- Parameters
-
| target | Search text or direct YouTube URL. |
- Returns
- Valid YouTube HTTPS URL.
- Exceptions
-
| ValueError | When a direct URL is non-HTTPS or outside YouTube. |
The documentation for this class was generated from the following file:
- controllers/video/youtube_player.py