dev: block unresolved embed links and retry resolver install
This commit is contained in:
@@ -3677,6 +3677,37 @@ def _is_resolveurl_missing_error(message: str) -> bool:
|
|||||||
return str(message or "").strip().casefold() == "resolveurl missing"
|
return str(message or "").strip().casefold() == "resolveurl missing"
|
||||||
|
|
||||||
|
|
||||||
|
def _is_resolveurl_soft_error(message: str) -> bool:
|
||||||
|
text = str(message or "").strip().casefold()
|
||||||
|
return text in {"resolveurl missing", "unresolved", "invalid url"}
|
||||||
|
|
||||||
|
|
||||||
|
def _looks_like_media_url(url: str) -> bool:
|
||||||
|
raw = str(url or "").strip()
|
||||||
|
if not raw:
|
||||||
|
return False
|
||||||
|
source = raw.split("|", 1)[0]
|
||||||
|
path = urlparse(source).path.casefold()
|
||||||
|
return bool(
|
||||||
|
re.search(r"\.(m3u8|mpd|mp4|mkv|webm|avi|mov|ts)(?:$|[/?#])", path)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _looks_like_embed_page_url(url: str) -> bool:
|
||||||
|
raw = str(url or "").strip()
|
||||||
|
if not raw:
|
||||||
|
return False
|
||||||
|
source = raw.split("|", 1)[0]
|
||||||
|
parsed = urlparse(source)
|
||||||
|
host = (parsed.netloc or "").casefold()
|
||||||
|
path = (parsed.path or "").casefold()
|
||||||
|
if not host.startswith(("voe.", "streamtape.", "dood.", "filemoon.", "vidmoly.", "supervideo.", "veev.", "vidnest.", "vidara.", "strmup.")):
|
||||||
|
return False
|
||||||
|
if _looks_like_media_url(source):
|
||||||
|
return False
|
||||||
|
return bool(re.search(r"/(e|embed|v)/", path))
|
||||||
|
|
||||||
|
|
||||||
def _play_final_link(
|
def _play_final_link(
|
||||||
link: str,
|
link: str,
|
||||||
*,
|
*,
|
||||||
@@ -3809,8 +3840,13 @@ def _play_episode(
|
|||||||
return
|
return
|
||||||
_log(f"Stream-Link: {link}", xbmc.LOGDEBUG)
|
_log(f"Stream-Link: {link}", xbmc.LOGDEBUG)
|
||||||
resolved_link = plugin.resolve_stream_link(link)
|
resolved_link = plugin.resolve_stream_link(link)
|
||||||
if not resolved_link:
|
|
||||||
err = _resolveurl_last_error()
|
err = _resolveurl_last_error()
|
||||||
|
if resolved_link and _looks_like_embed_page_url(resolved_link) and _is_resolveurl_soft_error(err):
|
||||||
|
_log("Unaufgeloester Hoster-Link erkannt: versuche ResolveURL-Reparatur.", xbmc.LOGWARNING)
|
||||||
|
_ensure_resolveurl_installed(force=True, silent=True)
|
||||||
|
resolved_link = plugin.resolve_stream_link(link)
|
||||||
|
err = _resolveurl_last_error()
|
||||||
|
if not resolved_link:
|
||||||
if _is_resolveurl_missing_error(err):
|
if _is_resolveurl_missing_error(err):
|
||||||
_log("ResolveURL fehlt: versuche Auto-Installation.", xbmc.LOGWARNING)
|
_log("ResolveURL fehlt: versuche Auto-Installation.", xbmc.LOGWARNING)
|
||||||
_ensure_resolveurl_installed(force=True, silent=True)
|
_ensure_resolveurl_installed(force=True, silent=True)
|
||||||
@@ -3828,6 +3864,15 @@ def _play_episode(
|
|||||||
final_link = resolved_link or link
|
final_link = resolved_link or link
|
||||||
final_link = normalize_resolved_stream_url(final_link, source_url=link)
|
final_link = normalize_resolved_stream_url(final_link, source_url=link)
|
||||||
err = _resolveurl_last_error()
|
err = _resolveurl_last_error()
|
||||||
|
if _looks_like_embed_page_url(final_link):
|
||||||
|
_log(f"Hoster-Link nicht aufgeloest: {final_link}", xbmc.LOGWARNING)
|
||||||
|
xbmcgui.Dialog().notification(
|
||||||
|
"Wiedergabe",
|
||||||
|
"Hoster-Link konnte nicht aufgeloest werden. ResolveURL pruefen.",
|
||||||
|
xbmcgui.NOTIFICATION_INFO,
|
||||||
|
5000,
|
||||||
|
)
|
||||||
|
return
|
||||||
if _is_cloudflare_challenge_error(err) and final_link.strip() == link.strip():
|
if _is_cloudflare_challenge_error(err) and final_link.strip() == link.strip():
|
||||||
_log(f"ResolveURL Cloudflare-Challenge (unresolved): {err}", xbmc.LOGWARNING)
|
_log(f"ResolveURL Cloudflare-Challenge (unresolved): {err}", xbmc.LOGWARNING)
|
||||||
xbmcgui.Dialog().notification(
|
xbmcgui.Dialog().notification(
|
||||||
@@ -3924,8 +3969,13 @@ def _play_episode_url(
|
|||||||
return
|
return
|
||||||
_log(f"Stream-Link: {link}", xbmc.LOGDEBUG)
|
_log(f"Stream-Link: {link}", xbmc.LOGDEBUG)
|
||||||
resolved_link = plugin.resolve_stream_link(link)
|
resolved_link = plugin.resolve_stream_link(link)
|
||||||
if not resolved_link:
|
|
||||||
err = _resolveurl_last_error()
|
err = _resolveurl_last_error()
|
||||||
|
if resolved_link and _looks_like_embed_page_url(resolved_link) and _is_resolveurl_soft_error(err):
|
||||||
|
_log("Unaufgeloester Hoster-Link erkannt: versuche ResolveURL-Reparatur.", xbmc.LOGWARNING)
|
||||||
|
_ensure_resolveurl_installed(force=True, silent=True)
|
||||||
|
resolved_link = plugin.resolve_stream_link(link)
|
||||||
|
err = _resolveurl_last_error()
|
||||||
|
if not resolved_link:
|
||||||
if _is_resolveurl_missing_error(err):
|
if _is_resolveurl_missing_error(err):
|
||||||
_log("ResolveURL fehlt: versuche Auto-Installation.", xbmc.LOGWARNING)
|
_log("ResolveURL fehlt: versuche Auto-Installation.", xbmc.LOGWARNING)
|
||||||
_ensure_resolveurl_installed(force=True, silent=True)
|
_ensure_resolveurl_installed(force=True, silent=True)
|
||||||
@@ -3943,6 +3993,15 @@ def _play_episode_url(
|
|||||||
final_link = resolved_link or link
|
final_link = resolved_link or link
|
||||||
final_link = normalize_resolved_stream_url(final_link, source_url=link)
|
final_link = normalize_resolved_stream_url(final_link, source_url=link)
|
||||||
err = _resolveurl_last_error()
|
err = _resolveurl_last_error()
|
||||||
|
if _looks_like_embed_page_url(final_link):
|
||||||
|
_log(f"Hoster-Link nicht aufgeloest: {final_link}", xbmc.LOGWARNING)
|
||||||
|
xbmcgui.Dialog().notification(
|
||||||
|
"Wiedergabe",
|
||||||
|
"Hoster-Link konnte nicht aufgeloest werden. ResolveURL pruefen.",
|
||||||
|
xbmcgui.NOTIFICATION_INFO,
|
||||||
|
5000,
|
||||||
|
)
|
||||||
|
return
|
||||||
if _is_cloudflare_challenge_error(err) and final_link.strip() == link.strip():
|
if _is_cloudflare_challenge_error(err) and final_link.strip() == link.strip():
|
||||||
_log(f"ResolveURL Cloudflare-Challenge (unresolved): {err}", xbmc.LOGWARNING)
|
_log(f"ResolveURL Cloudflare-Challenge (unresolved): {err}", xbmc.LOGWARNING)
|
||||||
xbmcgui.Dialog().notification(
|
xbmcgui.Dialog().notification(
|
||||||
|
|||||||
Reference in New Issue
Block a user