Re-checked whether these four KVS tubes could move to server-side resolve like yespornvip/pornditt/porntrex. All four are reachable from the backend, but cross-IP testing showed their final CDN URLs are IP-bound to the resolving host (403 / connection refused from a different IP; fpo.xxx even embeds the resolver IP in its acctoken). Unlike the portable cdn5/twa CDNs, backend resolve cannot produce a mobile-playable URL here without a proxy, which is out of scope for the public app. - porn00: was using force_proxy resolve (violated the no-proxy stance); switched to the WebView fallback like its siblings. The ad exposure that originally motivated the proxy path is mitigated by the recent ad-filter work (AD_HOSTS + cover overlay + injected-JS ad-CDN skipping). - freshporno/pornxp/fpoxxx already on WebView fallback; comments updated with the cross-IP findings so this isn't re-investigated. - Dropped the now-unused tube extractor imports (F401). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
192 lines
9.6 KiB
Python
192 lines
9.6 KiB
Python
"""Stream URL extractors per-tube.
|
|
|
|
Public API:
|
|
- `try_extract(sitetag, page_url) -> list[StreamSource] | None`
|
|
- `StreamSource` (dataclass)
|
|
- `HosterDead` (exception)
|
|
- `extract_stream_from_hoster(iframe_url, *, referer)` — generic packer-based hoster extract
|
|
- `fetch_tube_html(url)` — Chrome TLS fingerprint fetch (curl_cffi)
|
|
- `browser_get(url)` — low-level
|
|
|
|
Architektura: każdy tube ma osobny moduł `app.extractors.tubes.<tube>` który eksportuje
|
|
`extract(page_url) -> list[StreamSource] | None`. Registry niżej mapuje sitetag →
|
|
modułowy extractor. `try_extract()` to thin wrapper z exception handlingiem.
|
|
|
|
Po removalu porn-app dependency, ten moduł jest jedynym mechanizmem rozwiązywania
|
|
streamów — playback.py nie wpada już do porn-app /stream API.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
from collections.abc import Callable
|
|
|
|
from app.extractors._fetch import browser_get, fetch_tube_html
|
|
from app.extractors._models import HosterDead, StreamSource, TubePageError
|
|
from app.extractors.hoster import extract_stream_from_hoster, unpack_packer
|
|
from app.extractors.tubes import (
|
|
_embed_iframe,
|
|
_vps_blocked_fallback,
|
|
_ytdlp,
|
|
eporner,
|
|
hqporner,
|
|
latestpornvideo,
|
|
paradisehill,
|
|
pornditt,
|
|
pornhat,
|
|
porntrex,
|
|
sxyprn,
|
|
yespornvip,
|
|
)
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
# Sitetag → extractor function. Sitetag pasuje do format'u z origin: `pornapp:<sitetag>`
|
|
# (lub po Fazie 2 migracji: `tube:<sitetag>`).
|
|
#
|
|
# Mainstream tubes (pornhub/xvideos/xnxx/xhamster/redtube/youporn/porntrex) używają
|
|
# yt-dlp jako extractor — battle-tested, aktualizowane przez upstream przy zmianach
|
|
# HTML. Aggregator tubes (xmoviesforyou/watchporn/siska/...) używają generic
|
|
# embed-iframe extractor (page → /e/<id> iframe → P.A.C.K.E.R. unpack). Custom kod
|
|
# tylko tam gdzie tube ma niestandardowy schemat (eporner XHR, sxyprn URL transform).
|
|
_REGISTRY: dict[str, Callable[[str], list[StreamSource] | None]] = {
|
|
# hqporner — dedicated extractor zwraca multi-quality `<source>` mp4 URLs
|
|
# (bigcdn.cc / hqwo.cc / flyflv) z `force_proxy=True`. CDN URLs IP-bound do
|
|
# VPS, więc playback.py routuje przez proxy — mobile dostaje quality picker
|
|
# + natywny ExoPlayer, bez WebView.
|
|
# Bug-report e8ddd8d4: WebView fallback (`_vps_blocked_fallback`) ładował
|
|
# hqporner.com scene page w WebView, ale ta strona ma ad-iframes (adtng,
|
|
# goaserv, mavrtracktor) + pop-under-triggery → user klikał i widział
|
|
# reklamę zamiast video. INJECTED_JS w PlayerScreen.tsx nie chwytał
|
|
# popupów dośc szybko. Powrót do natywnego = `<source>` mp4 picker omija
|
|
# tę ścieżkę całkowicie.
|
|
"hqpornercom": hqporner.extract,
|
|
"epornercom": eporner.extract,
|
|
"sxyprncom": sxyprn.extract,
|
|
# Mainstream tubes — yt-dlp
|
|
# NB: 2026-05-18 cross-IP test potwierdził że xvideos/xnxx/pornhub/youporn/redtube
|
|
# CDN URLs są **time-bound** (nie IP-bound) — mobile_direct_ok auto-detect w
|
|
# playback.py daje mobile direct fetch, zero VPS bandwidth.
|
|
"pornhubcom": _ytdlp.extract,
|
|
"redtubecom": _ytdlp.extract,
|
|
"xvideoscom": _ytdlp.extract,
|
|
"xnxxcom": _ytdlp.extract,
|
|
"youporncom": _ytdlp.extract,
|
|
# porntrex KVS — 2026-05-22 VPS znów dociera (HTTP 200). Dedykowany extractor:
|
|
# flashvars `video_url` → `get_file` 302 → CDN time-bound signed URL
|
|
# (`expires`+`md5`, NIE IP-bound) → mobile gra direct, zero VPS bandwidth.
|
|
"porntrexcom": porntrex.extract,
|
|
# VPS-blocked tubes — KVS / Cloudflare blokuje Hetzner IP, ale działają z residential
|
|
# IP (potwierdzone Chrome DevTools MCP 2026-05-15). Mobile WebView + INJECTED_JS
|
|
# (PlayerScreen.tsx:805) skanuje <video>.src + XHR — łapie URL po decode-ie player JS.
|
|
"xhamstercom": _vps_blocked_fallback.extract,
|
|
# pornditt — KVS jak yespornvip (function/0 + license). VPS dociera → resolve
|
|
# server-side (decode + follow 302 → portable twa.tgprn.com CDN). Wcześniej WebView
|
|
# fallback łapał VAST preroll (trafostatic) zamiast contentu. Patrz pornditt.py/_kvs.py.
|
|
"porndittcom": pornditt.extract,
|
|
# fpoxxx — KVS, plain get_file + license. 2026-06-01 (task #20): get_file 302 →
|
|
# `videos3.fpo.xxx/remote_control.php?acctoken=<base64>` — zdekodowany acctoken
|
|
# zawiera WBITY IP serwera-resolvera → definitywnie IP-bound. WebView only.
|
|
"fpoxxx": _vps_blocked_fallback.extract,
|
|
"sxylandcom": _vps_blocked_fallback.extract,
|
|
# Aggregator tubes — generic embed-iframe → hoster unpacker
|
|
"latestpornvideocom": latestpornvideo.extract,
|
|
"xmoviesforyoucom": _embed_iframe.extract,
|
|
"watchporn": _embed_iframe.extract,
|
|
"siskavideo": _embed_iframe.extract,
|
|
"porn4dayspw": _embed_iframe.extract,
|
|
"porndishcom": _embed_iframe.extract,
|
|
# xxxfreewatch — DELISTED 2026-05-18. 790 solo-orphan scen, 0% match, CF-walled z VPS.
|
|
"latestleaksco": _embed_iframe.extract,
|
|
"mypornerleakcom": _embed_iframe.extract,
|
|
# PornHat — dedicated extractor: tylko `<source>` z player area (skip sidebar
|
|
# trailer URLs `_preview*.mp4`), dedupe po filename. Get_file 302 → CDN, proxy
|
|
# follow_redirects=True wymagane (fix w stream_proxy.py).
|
|
"pornhatcom": pornhat.extract,
|
|
# Freshporno KVS — `cv=` HMAC signed token IP-bound do VPS. WebView fallback:
|
|
# mobile fetchuje embed z phone IP, KVS player JS dekoduje video_url, ExoPlayer
|
|
# odtwarza direct z CDN. UX trade-off (page flicker przed video) vs bandwidth/
|
|
# anonimowość — public-app priorytet → WebView wygrywa.
|
|
# (2026-05-28: krótko-żywy switch na freshporno.extract z force_proxy=True
|
|
# cofnięty po feedbacku Jana "video proxy mnie nie interesuje, idziemy
|
|
# publicznie".)
|
|
# 2026-06-01 (task #20): _kvs.resolve_kvs dekoduje function/0 OK, ale finalny
|
|
# cdn2.freshporno.org/remote_control.php?cv=... jest nieosiągalny z residential
|
|
# IP (connect 000) → backend-resolve bezużyteczny. WebView pozostaje.
|
|
"freshpornoorg": _vps_blocked_fallback.extract,
|
|
# porn00 — KVS engine. 2026-06-01 cross-IP re-test (task #20): get_file 302 →
|
|
# `fe.porn00.org/videos/.../<id>.mp4?token=&expires=` zwraca 403 z residential
|
|
# IP → token IP-bound do resolvera (VPS), NIE portable jak yespornvip/pornditt.
|
|
# Backend-resolve nie daje mobile-playable URL bez proxy, a video-proxy odpada
|
|
# (public app, feedback Jana). Per polityka "IP-bound CDN → WebView": switch z
|
|
# porn00.extract (force_proxy=True, łamało no-proxy) na _vps_blocked_fallback.
|
|
# Ad-risk z bug-reportów 5037b3e3/e8e3198b złagodzony przez ad-filter (31d9076:
|
|
# AD_HOSTS + coverOverlay + INJECTED_JS skip ad-CDN).
|
|
"porn00org": _vps_blocked_fallback.extract,
|
|
# pornxp — `<source> //sr.porn-xp.com/<token>/.../720.mp4` (redirect → xpxp.eu).
|
|
# 2026-06-01 (task #20): 403 cross-IP → token w path IP-bound. WebView only.
|
|
"pornxpph": _vps_blocked_fallback.extract,
|
|
# yesporn.vip — KVS engine. VPS znów dociera (HTTP 200, odblokowane jak porntrex),
|
|
# więc resolvujemy SERVER-SIDE: dekoduj flashvars `video_url`/alt/alt2 (function/0/ +
|
|
# license_code, algo kt_player) → follow get_file 302 → portable cdn5 url (time-bound,
|
|
# NIE IP/cookie-bound, zweryfikowane cross-IP 2026-05-31). Mobile gra direct natywnie,
|
|
# multi-quality, ZERO WebView/reklam/preroll. Wcześniej WebView fallback pokazywał
|
|
# ad-heavy stronę a scrape łapał preroll-reklamę (bkcdn) zamiast wideo.
|
|
"yespornvip": yespornvip.extract,
|
|
# Direct-scraping tubes (mają też search scraper w connectors/direct_scrapers/)
|
|
# — używają identycznego embed-iframe pattern dla streamingu.
|
|
# hdporn92com — DELISTED 2026-05-18. Scene pages to SEO shell bez player iframe,
|
|
# JS hijackuje kliki na popunder. Wszystkie playback_sources mass-marked dead.
|
|
# 0dayxx wraps watchporn.to embed. watchporn.to/get_file/ token IP-bound (302→410
|
|
# cross-IP). Switch na WebView fallback. ~5k scen.
|
|
"0dayxxcom": _vps_blocked_fallback.extract,
|
|
# CF-protected tube — curl_cffi w fetch_tube_html bypassa JA3, embed-iframe pattern.
|
|
"perverzijacom": _embed_iframe.extract,
|
|
# Special: WebView-only (Yii2 session-bound player).
|
|
"paradisehillcc": paradisehill.extract,
|
|
# PornDoe — dołączony 2026-05-21 (theporndude audit). Stream URL nie inline w
|
|
# SSR HTML (player JS init po Play click), więc WebView fallback: mobile pobiera
|
|
# /watch/<id> z phone IP, player JS dekoduje video.src, INJECTED_JS scrape.
|
|
# 0 VPS bandwidth — zgodne z pre-public bandwidth/anonimowość priorytet.
|
|
"porndoecom": _vps_blocked_fallback.extract,
|
|
}
|
|
|
|
|
|
def try_extract(sitetag: str, page_url: str) -> list[StreamSource] | None:
|
|
"""Próbuje rozwiązać stream URL dla danego tube'a + page_url.
|
|
|
|
Zwraca listę StreamSource (różne quality/kontener) lub None gdy:
|
|
- brak extractora dla tego sitetag
|
|
- extractor zwrócił None / nie znalazł URL'a
|
|
|
|
Raises HosterDead gdy embed page wprost mówi że video deleted/not found —
|
|
caller (playback.py) łapie i oznacza playback_source.dead_at.
|
|
"""
|
|
extractor = _REGISTRY.get(sitetag)
|
|
if extractor is None:
|
|
return None
|
|
try:
|
|
return extractor(page_url)
|
|
except (HosterDead, TubePageError):
|
|
raise
|
|
except Exception as e:
|
|
log.warning("extractor for %s failed on %s: %s", sitetag, page_url, e)
|
|
return None
|
|
|
|
|
|
def supported_sitetags() -> tuple[str, ...]:
|
|
"""Zwraca listę sitetag-ów które mają zarejestrowany extractor."""
|
|
return tuple(_REGISTRY.keys())
|
|
|
|
|
|
__all__ = [
|
|
"try_extract",
|
|
"supported_sitetags",
|
|
"StreamSource",
|
|
"HosterDead",
|
|
"TubePageError",
|
|
"extract_stream_from_hoster",
|
|
"unpack_packer",
|
|
"fetch_tube_html",
|
|
"browser_get",
|
|
]
|