fullporner & thepornbunny

This commit is contained in:
Simon
2026-05-21 12:17:43 +00:00
committed by ForgeCode
parent 4ad7672ac9
commit 07154d50de
10 changed files with 1343 additions and 14 deletions

View File

@@ -62,9 +62,12 @@ class Results:
log.info("[%s] %s", channel, msg)
_BROWSER_UA = "Mozilla/5.0 (X11; Linux x86_64; rv:146.0) Gecko/20100101 Firefox/146.0"
def http_ok(url: str, headers: dict | None = None) -> tuple[bool, int]:
"""Return (ok, http_status). Tries HEAD then ranged GET on 405."""
h = headers or {}
h = {"User-Agent": _BROWSER_UA, **(headers or {})}
try:
r = requests.head(url, headers=h, timeout=HTTP_TIMEOUT, allow_redirects=True)
if r.status_code in (200, 206):
@@ -223,14 +226,15 @@ def check_video(video: dict, channel_id: str, results: Results, run_ytdlp: bool)
thumb = video.get("thumb", "")
formats: list[dict] = video.get("formats") or []
# video.url
# video.url must not point to the hottub server itself
if not vurl:
results.err(channel_id, f"{label}: missing url")
elif "127.0.0.1" in vurl or "localhost" in vurl:
results.err(channel_id, f"{label}: url points to hottub server: {vurl}")
else:
resolved = follow_proxy_redirect(vurl)
ok, code = http_ok(resolved)
ok, code = http_ok(vurl)
if not ok:
results.err(channel_id, f"{label}: url unreachable HTTP={code}: {resolved}")
results.err(channel_id, f"{label}: url unreachable HTTP={code}: {vurl}")
else:
results.info(channel_id, f"{label}: url OK (HTTP {code})")
@@ -265,9 +269,9 @@ def check_video(video: dict, channel_id: str, results: Results, run_ytdlp: bool)
if not run_ytdlp:
return
# yt-dlp info extraction on video.url (page URLs only)
ytdlp_url = follow_proxy_redirect(vurl) if vurl else ""
if ytdlp_url and is_page_url(ytdlp_url):
# yt-dlp info extraction on video.url (page URLs only, skipped when formats are provided)
ytdlp_url = vurl if vurl and "127.0.0.1" not in vurl and "localhost" not in vurl else ""
if not formats and ytdlp_url and is_page_url(ytdlp_url):
results.info(channel_id, f"{label}: yt-dlp extract {ytdlp_url}")
yt, stderr = ytdlp_extract(ytdlp_url)
if yt is None:
@@ -279,11 +283,6 @@ def check_video(video: dict, channel_id: str, results: Results, run_ytdlp: bool)
else:
yt_title = (yt.get("title") or "").strip()
api_title = (video.get("title") or "").strip()
if yt_title and api_title and not titles_match(yt_title, api_title):
results.warn(
channel_id,
f"{label}: title mismatch — yt-dlp='{yt_title[:60]}' api='{api_title[:60]}'",
)
yt_dur = yt.get("duration")
api_dur = video.get("duration") or 0