goon/scripts/test_cross_ip.py
goon-foss ad0284585b Initial commit
Goon — self-hosted aggregator for adult-content scene metadata.

Indexes scenes from TPDB, StashDB, and 30+ public adult tube sites.
Cross-source deduplication via perceptual hash + Levenshtein distance.
FastAPI backend + APScheduler worker + React Native (Expo) mobile client.

FOSS, ad-free, donation-funded. See README for details.
2026-05-20 10:10:22 +02:00

48 lines
2.1 KiB
Python

"""Per-CDN cross-IP test: VPS resolve URL → check if works z różnego IP (laptop).
Identifies time-bound (safe for mobile direct) vs IP-bound (requires VPS proxy).
Usage: set GOON_VPS_SSH=root@<your-vps> in env before running.
"""
import os
import subprocess
from app.extractors import try_extract
VPS_SSH = os.environ.get("GOON_VPS_SSH", "root@your-vps.example.com")
TESTS = [
("xvideoscom", "https://www.xvideos.com/video.ulklkike487/i_helped_my_stepbro_to_cum_with_my_hands_boobs_and_mouth_-_julia_goddess"),
("xnxxcom", "https://www.xnxx.com/video-5pc3of3/kimberly_kendall_and_jon_jon"),
("pornhubcom", "https://pornhub.com/view_video.php?viewkey=68597f719a5db"),
("youporncom", "https://www.youporn.com/watch/17136141/matchmaker-bangs-milf-teen-she-matched"),
("redtubecom", "https://redtube.com/43048211"),
("porntrexcom", "https://www.porntrex.com/video/1626524/sidra-sage-viral-video"),
("epornercom", "https://www.eporner.com/video-HPQBR5TeKjv/annie-reiss-5k/"),
("hqpornercom", "https://hqporner.com/hdporn/110000-just_for_test.html"),
("freshpornoorg", "https://freshporno.org/videos/a-caring-step-sister/"),
("sxyprncom", "https://sxyprn.com/post/68adbb3b6bf1b.html"),
]
for sitetag, page in TESTS:
try:
ss = try_extract(sitetag, page)
except Exception as e:
print(f"{sitetag}: extract failed: {e}")
continue
if not ss:
print(f"{sitetag}: no sources")
continue
# Take first non-hoster source (the one that goes through proxy currently)
first = next((s for s in ss if s.type in ("mp4", "m3u8", "hls")), None)
if not first:
print(f"{sitetag}: no mp4/m3u8 source (only hoster)")
continue
url = first.link
# VPS HEAD
vps_res = subprocess.run(
["ssh", VPS_SSH, f"curl -s -A 'Mozilla/5.0' --max-time 8 -o /dev/null -w '%{{http_code}}' '{url}'"],
capture_output=True, text=True, timeout=20,
)
print(f"{sitetag} type={first.type} domain={url.split('/')[2]} vps={vps_res.stdout.strip()}", end=" ", flush=True)
print(f" url-tail={url[-80:]}")