Add generic-mode URL validation and UI

Introduce a "generic_mode" option to allow validating/downloading from non-YouTube sites and wire it through the UI, config, and validation logic. Key changes:

- Add generic_mode default to ConfigManager and persist setting from DownloadSettingsDialog (checkbox + help text).
- Extend validate_video_url to accept a generic_mode flag and allow any http/https URL with a domain when enabled; pass this flag from Analysis and Download flows.
- Update YTSageApp to load/save generic_mode, update URL placeholder and settings tooltip behavior, and refresh tooltip when settings change.
- Improve robustness in FormatTableMixin: handle None/incorrect types for format_note, abr, resolution, ext, and codec values to avoid type errors and ensure consistent display.
- Add localization entries for generic mode, placeholder, and related help text across multiple language files and update the in-app default localization strings.

These changes enable broader site support via yt-dlp while hardening UI format handling and keeping user settings persistent.
This commit is contained in:
oop7
2026-03-12 11:10:10 +02:00
parent a98dad0a33
commit 9afca46c5d
21 changed files with 152 additions and 30 deletions
+9 -1
View File
@@ -731,7 +731,7 @@ def parse_yt_dlp_error(error_message: str) -> str:
return _("ytdlp_errors.generic_error", error=error_message)
def validate_video_url(url: str) -> tuple[bool, str]:
def validate_video_url(url: str, generic_mode: bool = False) -> tuple[bool, str]:
"""
Validate a video URL for supported platforms.
@@ -743,6 +743,10 @@ def validate_video_url(url: str) -> tuple[bool, str]:
- is_valid: True if URL is valid, False otherwise
- error_message: Empty string if valid, error description if invalid
Args:
url: URL entered by the user.
generic_mode: When True, allow any http/https URL with a valid domain.
Example:
>>> is_valid, error = validate_video_url("https://youtube.com/watch?v=xxx")
>>> if not is_valid:
@@ -770,6 +774,10 @@ def validate_video_url(url: str) -> tuple[bool, str]:
# Check if netloc (domain) exists
if not parsed.netloc:
return False, _("url_validation.missing_domain")
if generic_mode:
logger.info(f"Generic mode enabled, allowing URL: {url}")
return True, ""
# YTSage focuses on YouTube and YouTube Music only
# Supported YouTube domains