Add PelixPlay HD 16-thread downloader and auto-metadata
Browse files- _panel_app.py +55 -8
_panel_app.py
CHANGED
|
@@ -398,27 +398,64 @@ def resolve_pelixplay_hls(tmdb_id, media_type="movie", season=1, episode=1, skip
|
|
| 398 |
if l not in lang_order and l in all_embeds and all_embeds[l]:
|
| 399 |
lang_order.append(l)
|
| 400 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
embed_candidates = []
|
|
|
|
| 402 |
for l in lang_order:
|
| 403 |
lang_embeds = all_embeds.get(l) or {}
|
| 404 |
-
for prov_key in ["streamwish", "morencius", "filelions", "vidhide"] + list(lang_embeds.keys()):
|
| 405 |
urls = lang_embeds.get(prov_key) or []
|
| 406 |
if isinstance(urls, str):
|
| 407 |
urls = [urls]
|
| 408 |
for u in urls:
|
| 409 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 410 |
embed_candidates.append(u)
|
|
|
|
|
|
|
|
|
|
| 411 |
|
| 412 |
if not embed_candidates:
|
|
|
|
|
|
|
| 413 |
raise RuntimeError("No se encontraron servidores de video activos en PelixPlay para este título.")
|
| 414 |
|
| 415 |
-
# 1. Intentar desempaquetar directamente desde nuestra IP (HLS4 / HLS3 / HLS2) y verificar segmento 0
|
| 416 |
for emb_url in embed_candidates:
|
| 417 |
try:
|
| 418 |
parsed_emb = urlparse(emb_url)
|
| 419 |
emb_origin = f"{parsed_emb.scheme}://{parsed_emb.netloc}"
|
| 420 |
-
r_emb = cffi_get(emb_url, headers={"User-Agent": ua, "Referer": "https://pelixplay.app/"}, timeout=
|
| 421 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 422 |
if unpacked:
|
| 423 |
for hls_key in ["hls4", "hls3", "hls2"]:
|
| 424 |
m_h = re.search(rf'"{hls_key}"\s*:\s*"([^"]+)"', unpacked)
|
|
@@ -429,16 +466,24 @@ def resolve_pelixplay_hls(tmdb_id, media_type="movie", season=1, episode=1, skip
|
|
| 429 |
if verified:
|
| 430 |
variant_url, seg_urls, res_label = verified
|
| 431 |
return variant_url, seg_urls, res_label, emb_origin + "/", data.get("tmdb_title"), emb_url
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 432 |
except Exception:
|
| 433 |
continue
|
| 434 |
|
| 435 |
-
# 2. Fallback: usar extract.php de PelixPlay
|
| 436 |
for emb_url in embed_candidates:
|
|
|
|
| 437 |
for ext_try in range(2):
|
| 438 |
try:
|
| 439 |
r_ext = requests.post(
|
| 440 |
"https://pelixplay.app/embed/extract.php",
|
| 441 |
-
json={"url":
|
| 442 |
headers=headers,
|
| 443 |
timeout=25
|
| 444 |
)
|
|
@@ -452,9 +497,11 @@ def resolve_pelixplay_hls(tmdb_id, media_type="movie", season=1, episode=1, skip
|
|
| 452 |
return variant_url, seg_urls, res_label, ref, data.get("tmdb_title"), emb_url
|
| 453 |
break
|
| 454 |
except Exception:
|
| 455 |
-
time.sleep(1.
|
| 456 |
continue
|
| 457 |
|
|
|
|
|
|
|
| 458 |
raise RuntimeError("No se pudo extraer un stream HLS directo de los servidores de PelixPlay.")
|
| 459 |
|
| 460 |
|
|
|
|
| 398 |
if l not in lang_order and l in all_embeds and all_embeds[l]:
|
| 399 |
lang_order.append(l)
|
| 400 |
|
| 401 |
+
def _normalize_pelix_embed_url(raw_u):
|
| 402 |
+
try:
|
| 403 |
+
p = urlparse(raw_u)
|
| 404 |
+
h = p.hostname.lower().replace("www.", "") if p.hostname else ""
|
| 405 |
+
if h == "ikhjerbhye3wjkhoduh5xiczuvd.lol":
|
| 406 |
+
return raw_u
|
| 407 |
+
if any(k in h for k in ("filelions", "vidhide", "minochinos", "callistanise")):
|
| 408 |
+
segs = [s for s in p.path.split("/") if s]
|
| 409 |
+
for seg in reversed(segs):
|
| 410 |
+
clean_s = re.sub(r"\.(?:html?|php)$", "", seg, flags=re.I)
|
| 411 |
+
if re.match(r"^[a-zA-Z0-9_-]{4,}$", clean_s):
|
| 412 |
+
return f"https://callistanise.com/v/{clean_s}"
|
| 413 |
+
if h in ("voe.sx", "voe.bar", "voe.cx", "voe.de", "v-o-e.xyz", "vanfmcawtls.com", "robinimages.com", "jessicayeahcatch.com") or "voe" in h:
|
| 414 |
+
return f"https://johnbeyondnation.com{p.path}"
|
| 415 |
+
except Exception:
|
| 416 |
+
pass
|
| 417 |
+
return raw_u
|
| 418 |
+
|
| 419 |
embed_candidates = []
|
| 420 |
+
captcha_only_servers = []
|
| 421 |
for l in lang_order:
|
| 422 |
lang_embeds = all_embeds.get(l) or {}
|
| 423 |
+
for prov_key in ["streamwish", "morencius", "vidmoly", "vidspeed", "filelions", "vidhide", "voe", "doodstream"] + list(lang_embeds.keys()):
|
| 424 |
urls = lang_embeds.get(prov_key) or []
|
| 425 |
if isinstance(urls, str):
|
| 426 |
urls = [urls]
|
| 427 |
for u in urls:
|
| 428 |
+
if not u:
|
| 429 |
+
continue
|
| 430 |
+
ul = u.lower()
|
| 431 |
+
if "powwideo." in ul or "powvideo." in ul or "straemplay." in ul or "streamplay." in ul:
|
| 432 |
+
if u not in captcha_only_servers:
|
| 433 |
+
captcha_only_servers.append(u)
|
| 434 |
+
continue
|
| 435 |
+
if u not in embed_candidates and u not in skip_set:
|
| 436 |
embed_candidates.append(u)
|
| 437 |
+
norm_u = _normalize_pelix_embed_url(u)
|
| 438 |
+
if norm_u != u and norm_u not in embed_candidates and norm_u not in skip_set:
|
| 439 |
+
embed_candidates.append(norm_u)
|
| 440 |
|
| 441 |
if not embed_candidates:
|
| 442 |
+
if captcha_only_servers:
|
| 443 |
+
raise RuntimeError("Esta película en PelixPlay solo tiene servidores con Captcha humano (PowVideo/Streamplay en Castellano) y aún no fue subida en servidor HD descargable.")
|
| 444 |
raise RuntimeError("No se encontraron servidores de video activos en PelixPlay para este título.")
|
| 445 |
|
| 446 |
+
# 1. Intentar desempaquetar directamente desde nuestra IP o vía Worker de Morencius (HLS4 / HLS3 / HLS2) y verificar segmento 0
|
| 447 |
for emb_url in embed_candidates:
|
| 448 |
try:
|
| 449 |
parsed_emb = urlparse(emb_url)
|
| 450 |
emb_origin = f"{parsed_emb.scheme}://{parsed_emb.netloc}"
|
| 451 |
+
r_emb = cffi_get(emb_url, headers={"User-Agent": ua, "Referer": "https://pelixplay.app/"}, timeout=18)
|
| 452 |
+
html_txt = r_emb.text if r_emb.status_code == 200 else ""
|
| 453 |
+
if "eval(function(p,a,c,k,e,d)" not in html_txt and "morencius.com" in emb_url.lower():
|
| 454 |
+
w_url = f"https://billowing-grass-7b5e.carlosjpradofelipe.workers.dev/?url={emb_url}"
|
| 455 |
+
r_w = cffi_get(w_url, headers={"User-Agent": ua, "Accept": "application/json"}, timeout=18)
|
| 456 |
+
if r_w.status_code == 200:
|
| 457 |
+
html_txt = r_w.text
|
| 458 |
+
unpacked = unpack_js_eval(html_txt)
|
| 459 |
if unpacked:
|
| 460 |
for hls_key in ["hls4", "hls3", "hls2"]:
|
| 461 |
m_h = re.search(rf'"{hls_key}"\s*:\s*"([^"]+)"', unpacked)
|
|
|
|
| 466 |
if verified:
|
| 467 |
variant_url, seg_urls, res_label = verified
|
| 468 |
return variant_url, seg_urls, res_label, emb_origin + "/", data.get("tmdb_title"), emb_url
|
| 469 |
+
# También buscar sources:[{file:"...m3u8"}] (usado por Vidmoly / VidSpeed / VOE)
|
| 470 |
+
for m_f in re.finditer(r'["'](https?://[^"']+\.m3u8[^"']*)["']', unpacked + "\n" + html_txt):
|
| 471 |
+
cand_hls = m_f.group(1).replace("\\/", "/")
|
| 472 |
+
verified = _verify_and_extract_hls_segments(cand_hls, emb_origin + "/", ua)
|
| 473 |
+
if verified:
|
| 474 |
+
variant_url, seg_urls, res_label = verified
|
| 475 |
+
return variant_url, seg_urls, res_label, emb_origin + "/", data.get("tmdb_title"), emb_url
|
| 476 |
except Exception:
|
| 477 |
continue
|
| 478 |
|
| 479 |
+
# 2. Fallback: usar extract.php de PelixPlay (con URL normalizada callistanise/johnbeyondnation)
|
| 480 |
for emb_url in embed_candidates:
|
| 481 |
+
norm_emb = _normalize_pelix_embed_url(emb_url)
|
| 482 |
for ext_try in range(2):
|
| 483 |
try:
|
| 484 |
r_ext = requests.post(
|
| 485 |
"https://pelixplay.app/embed/extract.php",
|
| 486 |
+
json={"url": norm_emb},
|
| 487 |
headers=headers,
|
| 488 |
timeout=25
|
| 489 |
)
|
|
|
|
| 497 |
return variant_url, seg_urls, res_label, ref, data.get("tmdb_title"), emb_url
|
| 498 |
break
|
| 499 |
except Exception:
|
| 500 |
+
time.sleep(1.2)
|
| 501 |
continue
|
| 502 |
|
| 503 |
+
if captcha_only_servers:
|
| 504 |
+
raise RuntimeError("Los servidores HD fallaron y el resto (PowVideo/Streamplay) requieren Captcha humano manual.")
|
| 505 |
raise RuntimeError("No se pudo extraer un stream HLS directo de los servidores de PelixPlay.")
|
| 506 |
|
| 507 |
|