Spaces:
Running
Running
Z User commited on
Commit ·
d59d8ea
1
Parent(s): 0463ef6
v4.2: Add VidRock scraper (multi-server English), add pycryptodome dep
Browse filesFiles changed (2)
- main.py+69-3
- requirements.txt+1
493 unmodified lines4944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625636 unmodified lines57057157257357457557651157757857958079 unmodified lines660661662597663664599665666667668493 unmodified lines return results, errors
# ===== VidRock Scraper (AES-encrypted API - Multi-server English) =====
async def scrape_vidrock(tmdb_id: int, media_type: str, season: int = None, episode: int = None): results = [] errors = []
try: from Crypto.Cipher import AES as CryptoAES from Crypto.Util.Padding import pad as crypto_pad
passphrase = b"x7k9mPqT2rWvY8zA5bC3nF6hJ2lK4mN9" aes_key = passphrase[:32] aes_iv = passphrase[:16]
# Build item ID if media_type == "tv": s = season or 1 e = episode or 1 item_id = f"{tmdb_id}_{s}_{e}" api_type = "tv" else: item_id = str(tmdb_id) api_type = "movie"
# Encrypt item ID cipher = CryptoAES.new(aes_key, CryptoAES.MODE_CBC, aes_iv) ct = cipher.encrypt(crypto_pad(item_id.encode(), CryptoAES.block_size)) encoded = base64.b64encode(ct).decode().replace("+", "-").replace("/", "_").replace("=", "")
# Fetch servers async with httpx.AsyncClient(timeout=15, follow_redirects=True, headers=HEADERS) as client: resp = await client.get(f"https://vidrock.net/api/{api_type}/{encoded}") if resp.status_code != 200: errors.append(f"VidRock: HTTP {resp.status_code}") return results, errors
data = resp.json() for server_name, server_data in data.items(): if isinstance(server_data, dict) and server_data.get("url"): url = server_data["url"] lang = server_data.get("language", "English") stream_type = server_data.get("type", "hls") s_type = "m3u8" if stream_type == "hls" or ".m3u8" in url else "direct"
results.append({ "source": f"VidRock/{server_name}", "title": f"{server_name} - {lang}", "quality": "Auto", "language": detect_language(lang), "url": url, "type": s_type, })
if not results: errors.append("VidRock: No streams found")
except ImportError: errors.append("VidRock: pycryptodome not installed") except Exception as e: errors.append(f"VidRock: {str(e)}")
return results, errors
# ===== Source Map =====
SOURCE_MAP = {6 unmodified lines "languages": ["French", "English", "Multi"], "reliability": "medium"}, "popr": {"name": "Popr", "fn": lambda tid, mt, s, e: scrape_popr(tid, mt, s, e), "languages": ["Hindi", "Tamil", "Telugu", "English", "French"], "reliability": "high"}, "vidrock": {"name": "VidRock", "fn": lambda tid, mt, s, e: scrape_vidrock(tid, mt, s, e), "languages": ["English"], "reliability": "high"},}
DEFAULT_SOURCES = ["cinesu", "popr", "vidnest"]DEFAULT_SOURCES = ["cinesu", "popr", "vidnest", "vidrock"]
# ===== Helper: Run scrapers =====79 unmodified lines for key, src in SOURCE_MAP.items()}, "default_sources": DEFAULT_SOURCES, "tips": [ "No source = default sources (cinesu, popr, vidnest)", "No source = default sources (cinesu, popr, vidnest, vidrock)", "Best for Hindi: /movie/ID/popr", "Best for English: /movie/ID/cinesu", "Best for English: /movie/ID/cinesu or /movie/ID/vidrock", "Best for French: /movie/ID/vidnest", "VixSrc (Italian) blocked from cloud IPs, works residential only", "m3u8 links work in VLC, mpv, or any HLS player",2 unmodified lines34562 unmodified lineshttpx==0.25.2beautifulsoup4==4.12.2pydantic==2.5.2pycryptodome==3.20.0main.py+69-3
requirements.txt+1