goon/scripts/check_all_hosters.py
https://github.com/goon-foss/goon 642f1ab8b8 Mobile 0.1.9: OTA enable, WebView cookie-dismiss fix, porndoe connector
Mobile / OTA:
- Enable Expo Updates (app.json + AndroidManifest) → api.goon-foss.org
- Bump 0.1.6 → 0.1.9 (build.gradle, app.json, appVersion.ts, main.py /version)
- backend.ts: default public backend auto-connect (no manual login)

WebView fallback fix (PlayerScreen INJECTED_JS):
- Auto-dismiss cookie/consent gates (hqporner et al. blocked kt_player init)
- Context-scoped: only clicks consent buttons inside cookie/gdpr containers
- Retry window for <source>.src polling raised 5→15 ticks (post-dismiss init)

Resolver:
- Series-position + modifier mismatch detector (Episode 2≠4, BTS/unedited)
  → composite_score hard-reject / cap; wired into scene_score + bulk_dedup
- aggregator-mode candidate query: LIMIT 500 + title-match ordering

Connectors:
- porndoe.com browse scraper (JSON-LD VideoObject) — theporndude audit pilot

landing: APK links → goon-v0.1.9.apk

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 11:20:57 +02:00

50 lines
1.8 KiB
Python

"""Per-origin extractor check: dla 1 sample sceny z każdego tube origin,
wywołaj try_extract i sklasyfikuj wynik (direct mp4/m3u8 vs WebView hoster vs fail).
Uruchamiać na VPS: docker compose exec -T api python scripts/check_all_hosters.py
"""
from app.db import SessionLocal
from sqlalchemy import text
from app.extractors import try_extract
def main():
with SessionLocal() as s:
rows = s.execute(text("""
SELECT DISTINCT ON (ps.origin)
ps.origin, ps.page_url, sc.title
FROM playback_sources ps
JOIN scenes sc ON sc.id = ps.scene_id
WHERE ps.dead_at IS NULL AND ps.origin LIKE 'tube:%'
AND ps.page_url IS NOT NULL
ORDER BY ps.origin, sc.created_at DESC
""")).all()
print(f"{'origin':<26} {'result':<48} verdict")
print("-" * 95)
for r in rows:
sitetag = r.origin.replace("tube:", "")
try:
sources = try_extract(sitetag, r.page_url)
except Exception as e:
print(f"{r.origin:<26} EXC: {str(e)[:42]:<48} ERROR")
continue
if not sources:
print(f"{r.origin:<26} {'None (no sources)':<48} FAIL")
continue
# Klasyfikacja po type pierwszego źródła
types = [getattr(x, "type", "?") for x in sources]
first = sources[0]
t = getattr(first, "type", "?")
link = (getattr(first, "link", "") or "")[:40]
if t == "hoster":
verdict = "WEBVIEW (page → ad risk)"
elif t in ("mp4", "m3u8", "hls", "mpd"):
verdict = "DIRECT (native ExoPlayer)"
else:
verdict = f"OTHER({t})"
n = len(sources)
print(f"{r.origin:<26} {f'{t} x{n} {link}':<48} {verdict}")
if __name__ == "__main__":
main()