vega-cli 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. vega_cli/__init__.py +1 -0
  2. vega_cli/__main__.py +6 -0
  3. vega_cli/cli.py +247 -0
  4. vega_cli/config.py +99 -0
  5. vega_cli/display.py +138 -0
  6. vega_cli/html.py +540 -0
  7. vega_cli/interactive.py +220 -0
  8. vega_cli/player.py +82 -0
  9. vega_cli/providers/__init__.py +13 -0
  10. vega_cli/providers/ani_dream.py +1089 -0
  11. vega_cli/providers/anikoto.py +820 -0
  12. vega_cli/providers/animesalt.py +649 -0
  13. vega_cli/providers/animesub.py +1374 -0
  14. vega_cli/providers/animeworld.py +504 -0
  15. vega_cli/providers/auto_embed.py +479 -0
  16. vega_cli/providers/castle.py +497 -0
  17. vega_cli/providers/cncverse.py +873 -0
  18. vega_cli/providers/common/__init__.py +51 -0
  19. vega_cli/providers/common/aes.py +152 -0
  20. vega_cli/providers/common/aniskip.py +186 -0
  21. vega_cli/providers/common/base_url.py +102 -0
  22. vega_cli/providers/common/cinemeta.py +231 -0
  23. vega_cli/providers/common/errors.py +25 -0
  24. vega_cli/providers/common/extractors/__init__.py +23 -0
  25. vega_cli/providers/common/extractors/abbasy.py +247 -0
  26. vega_cli/providers/common/extractors/buzzheavier.py +72 -0
  27. vega_cli/providers/common/extractors/cinejoy.py +33 -0
  28. vega_cli/providers/common/extractors/gdflix.py +170 -0
  29. vega_cli/providers/common/extractors/gofile.py +167 -0
  30. vega_cli/providers/common/extractors/hubcloud.py +277 -0
  31. vega_cli/providers/common/extractors/movy.py +349 -0
  32. vega_cli/providers/common/extractors/st111477.py +139 -0
  33. vega_cli/providers/common/extractors/transferit.py +53 -0
  34. vega_cli/providers/common/extractors/vegadrive.py +161 -0
  35. vega_cli/providers/common/extractors/vidstuck.py +379 -0
  36. vega_cli/providers/common/extractors/zcloud.py +158 -0
  37. vega_cli/providers/common/extractors/zypter.py +72 -0
  38. vega_cli/providers/common/headers.py +25 -0
  39. vega_cli/providers/common/http.py +121 -0
  40. vega_cli/providers/common/net_mirror.py +1494 -0
  41. vega_cli/providers/common/theintrodb.py +112 -0
  42. vega_cli/providers/common/unpack.py +54 -0
  43. vega_cli/providers/disney_mirror.py +31 -0
  44. vega_cli/providers/dramacool.py +297 -0
  45. vega_cli/providers/drive.py +695 -0
  46. vega_cli/providers/durbin_live.py +354 -0
  47. vega_cli/providers/eon_movies.py +752 -0
  48. vega_cli/providers/extraflix.py +701 -0
  49. vega_cli/providers/four_khdhub.py +307 -0
  50. vega_cli/providers/goku_hd.py +336 -0
  51. vega_cli/providers/hdhub4u.py +665 -0
  52. vega_cli/providers/internet_archive.py +552 -0
  53. vega_cli/providers/kartoons.py +642 -0
  54. vega_cli/providers/kartoons2.py +395 -0
  55. vega_cli/providers/katmovies.py +816 -0
  56. vega_cli/providers/kick_ass_anime.py +445 -0
  57. vega_cli/providers/kiss_kh.py +490 -0
  58. vega_cli/providers/live_tg_tv.py +540 -0
  59. vega_cli/providers/lux_movies.py +650 -0
  60. vega_cli/providers/mod.py +676 -0
  61. vega_cli/providers/movie_box_web.py +921 -0
  62. vega_cli/providers/movielinkdb.py +734 -0
  63. vega_cli/providers/movies4u.py +580 -0
  64. vega_cli/providers/moviezwap.py +199 -0
  65. vega_cli/providers/mxplayer.py +470 -0
  66. vega_cli/providers/netflix_mirror.py +32 -0
  67. vega_cli/providers/one_cinevood.py +596 -0
  68. vega_cli/providers/prime_mirror.py +31 -0
  69. vega_cli/providers/rareanimes.py +676 -0
  70. vega_cli/providers/registry.py +124 -0
  71. vega_cli/providers/showbox.py +245 -0
  72. vega_cli/providers/topmovies.py +707 -0
  73. vega_cli/providers/torrentio.py +398 -0
  74. vega_cli/providers/uhd.py +483 -0
  75. vega_cli/providers/vega.py +891 -0
  76. vega_cli/providers/youtube.py +566 -0
  77. vega_cli/providers/zeefliz.py +563 -0
  78. vega_cli/store.py +45 -0
  79. vega_cli/utils.py +90 -0
  80. vega_cli-0.1.0.dist-info/METADATA +8 -0
  81. vega_cli-0.1.0.dist-info/RECORD +84 -0
  82. vega_cli-0.1.0.dist-info/WHEEL +5 -0
  83. vega_cli-0.1.0.dist-info/entry_points.txt +2 -0
  84. vega_cli-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,32 @@
1
+ """Pure-Python Vega Netflix Mirror provider."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from .common.net_mirror import NetMirrorBaseProvider, NetMirrorOtt
6
+
7
+
8
+ class NetflixMirrorClient(NetMirrorBaseProvider):
9
+ """Client for the Netflix Mirror (NetMirror) provider."""
10
+
11
+ name: str = "netflixMirror"
12
+ ott_prefix: NetMirrorOtt = ""
13
+ catalog: list[dict[str, str]] = [
14
+ {
15
+ "title": "Only on Netflix",
16
+ "filter": "Only on Netflix",
17
+ },
18
+ {
19
+ "title": "New on Netflix",
20
+ "filter": "New on Netflix",
21
+ },
22
+ {
23
+ "title": "Blockbuster Movies",
24
+ "filter": "Blockbuster Movies",
25
+ },
26
+ {
27
+ "title": "US TV Shows Dubbed in Hindi",
28
+ "filter": "US TV Shows Dubbed in Hindi",
29
+ },
30
+ ]
31
+ CATALOG = catalog
32
+ genres: list[dict[str, str]] = []
@@ -0,0 +1,596 @@
1
+ """Pure-Python 1CineVood provider."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import re
7
+ from typing import Any
8
+ from urllib.parse import quote, urljoin, urlparse
9
+
10
+ from ..html import parse_html
11
+ from ..utils import to_relative_path
12
+ from .common import (
13
+ BaseProvider,
14
+ ProviderError,
15
+ add_cinemeta_context,
16
+ apply_cinemeta_meta,
17
+ enrich_cinemeta_episodes,
18
+ enrich_episodes_with_skip_timings,
19
+ get_base_url,
20
+ get_cinemeta_meta,
21
+ get_cinemeta_season,
22
+ read_cinemeta_context,
23
+ throw_provider_error,
24
+ )
25
+ from .common.extractors import hubcloud_extractor
26
+
27
+
28
+ def _is_waf_challenge(html: str) -> bool:
29
+ if not html or not isinstance(html, str):
30
+ return False
31
+ return (
32
+ "<title>Just a moment...</title>" in html
33
+ or "challenges.cloudflare.com" in html
34
+ or "cf-mitigated" in html
35
+ or "cf-chl-widget" in html
36
+ or "Attention Required! | Cloudflare" in html
37
+ or ("Cloudflare Ray ID" in html and "Please wait" in html)
38
+ )
39
+
40
+
41
+ def _format_ep_title(file_name: str) -> str:
42
+ m = re.search(r"S(\d+)E(\d+)", file_name, re.I)
43
+ if m:
44
+ return f"S{m.group(1).zfill(2)} E{m.group(2).zfill(2)}"
45
+ return file_name
46
+
47
+
48
+ class OneCinevoodClient(BaseProvider):
49
+ """Pure-Python client for the 1CineVood provider."""
50
+
51
+ name: str = "1cinevood"
52
+ catalog: list[dict[str, str]] = [
53
+ {"title": "Latest", "filter": ""},
54
+ {"title": "Hollywood", "filter": "hollywood/"},
55
+ ]
56
+ genres: list[dict[str, str]] = []
57
+ settings_schema: list[dict[str, Any]] = [
58
+ {
59
+ "key": "1cinevood_quickDownload",
60
+ "type": "toggle",
61
+ "label": "Quick Download",
62
+ "description": (
63
+ "Automatically download the preferred server in 1-click without "
64
+ "showing server selection"
65
+ ),
66
+ "defaultValue": True,
67
+ },
68
+ {
69
+ "key": "1cinevood_preferredDownloadServer",
70
+ "type": "select",
71
+ "label": "Preferred Download Server",
72
+ "description": "Server to prioritize for 1-click quick download",
73
+ "options": [
74
+ {"label": "Auto (Best Available)", "value": "auto"},
75
+ {"label": "CF Worker (Fastest)", "value": "cf worker"},
76
+ {"label": "CF Storage (R2 Direct)", "value": "cf storage"},
77
+ {"label": "GDrive (Google Direct)", "value": "gdrive"},
78
+ {"label": "Pixeldrain", "value": "pixeldrain"},
79
+ {"label": "FastDl", "value": "fastdl"},
80
+ {"label": "HubCdn", "value": "hubcdn"},
81
+ ],
82
+ "defaultValue": "auto",
83
+ },
84
+ {
85
+ "key": "1cinevood_skipTimings",
86
+ "type": "toggle",
87
+ "label": "Skip Timings",
88
+ "description": (
89
+ "Automatically fetch intro and recap skip timestamps from "
90
+ "TheIntroDB for verified episodes"
91
+ ),
92
+ "defaultValue": True,
93
+ },
94
+ ]
95
+
96
+ def __init__(self, *args: Any, **kwargs: Any) -> None:
97
+ super().__init__(*args, **kwargs)
98
+ self._resolved_base_url: str = ""
99
+
100
+ def _base_url(self) -> str:
101
+ if self._resolved_base_url:
102
+ return self._resolved_base_url
103
+ try:
104
+ url = get_base_url("1cinevood")
105
+ if not url or "cinevood.rocks" in url:
106
+ try:
107
+ resp = self.session.head(
108
+ url or "https://cinevood.rocks",
109
+ allow_redirects=True,
110
+ timeout=self.timeout,
111
+ )
112
+ if resp.url:
113
+ parsed = urlparse(resp.url)
114
+ self._resolved_base_url = f"{parsed.scheme}://{parsed.netloc}"
115
+ return self._resolved_base_url
116
+ except Exception:
117
+ pass
118
+ self._resolved_base_url = "https://new1.cinevood.cv"
119
+ return self._resolved_base_url
120
+ self._resolved_base_url = url.rstrip("/")
121
+ return self._resolved_base_url
122
+ except Exception:
123
+ return "https://new1.cinevood.cv"
124
+
125
+ def _get_with_waf(self, url: str) -> str:
126
+ base = "/".join(url.split("/")[:3])
127
+ resp = self.session.get(
128
+ url, headers={"Referer": base}, timeout=self.timeout
129
+ )
130
+ if resp.status_code == 403 or _is_waf_challenge(resp.text):
131
+ resp.raise_for_status()
132
+ raise ProviderError(f"1CineVood WAF challenge blocked {url}")
133
+ resp.raise_for_status()
134
+ return resp.text
135
+
136
+ def _fetch_posts(self, filter_path: str = "", query: str = "", page: int = 1) -> list[dict[str, str]]:
137
+ op = "search posts" if query and query.strip() else "posts"
138
+ try:
139
+ base_url = self._base_url()
140
+ if query and query.strip():
141
+ paged = f"&paged={page}" if page > 1 else ""
142
+ url = f"{base_url}/?s={quote(query)}{paged}"
143
+ elif filter_path:
144
+ clean = filter_path.strip("/")
145
+ suffix = f"/page/{page}" if page > 1 else ""
146
+ url = f"{base_url}/{clean}{suffix}"
147
+ else:
148
+ url = f"{base_url}/page/{page}" if page > 1 else base_url
149
+
150
+ html = self._get_with_waf(url)
151
+ doc = parse_html(html)
152
+ seen: set[str] = set()
153
+ catalog: list[dict[str, str]] = []
154
+ selectors = (
155
+ ".pstr_box, article, .result-item, .post, .item, "
156
+ ".thumbnail, .latest-movies, .movie-item"
157
+ )
158
+ for card in doc.select(selectors):
159
+ a_el = card.select_one("a[href]")
160
+ href = a_el.attr("href") if a_el else ""
161
+ if not href:
162
+ continue
163
+ rel_link = to_relative_path(base_url, href)
164
+ if rel_link in seen:
165
+ continue
166
+
167
+ h2 = card.select_one("h2")
168
+ a_title = card.select_one("a[title]")
169
+ raw_title = (
170
+ (h2.text().strip() if h2 else "")
171
+ or (a_title.attr("title").strip() if a_title else "")
172
+ or card.text().strip()
173
+ )
174
+ title = re.sub(r"\[.*?\]", "", raw_title)
175
+ title = re.sub(r"\(.+?\)", "", title)
176
+ title = re.sub(r"\s{2,}", " ", title).strip()
177
+ if not title:
178
+ continue
179
+
180
+ img_el = card.select_one("img")
181
+ img_src = ""
182
+ if img_el:
183
+ img_src = (
184
+ img_el.attr("src")
185
+ or img_el.attr("data-src")
186
+ or img_el.attr("data-original")
187
+ )
188
+ image = urljoin(url, img_src) if img_src else ""
189
+ seen.add(rel_link)
190
+ catalog.append({"title": title, "link": rel_link, "image": image})
191
+ return catalog[:100]
192
+ except Exception as err:
193
+ throw_provider_error("1CineVood", op, err)
194
+ return []
195
+
196
+ def get_posts(self, filter_path: str = "", page: int = 1) -> list[dict[str, str]]:
197
+ return self._fetch_posts(filter_path=filter_path, query="", page=page)
198
+
199
+ def get_search_posts(self, query: str, page: int = 1) -> list[dict[str, str]]:
200
+ return self._fetch_posts(filter_path="", query=query, page=page)
201
+
202
+ def get_meta(self, link: str) -> dict[str, Any]:
203
+ base_url = self._base_url()
204
+ url = urljoin(f"{base_url}/", link)
205
+ try:
206
+ html = self._get_with_waf(url)
207
+ doc = parse_html(html)
208
+ info_container = doc.select_one(".entry-content, .post-inner")
209
+
210
+ def _clean(value: str | None) -> str:
211
+ if not value:
212
+ return ""
213
+ text = parse_html(value).text()
214
+ return re.sub(r"\s+", " ", text).strip()
215
+
216
+ schema_nodes: list[dict[str, Any]] = []
217
+ for script in doc.select('script[type="application/ld+json"]'):
218
+ try:
219
+ raw_json = script.html()
220
+ if not raw_json:
221
+ continue
222
+ schema = json.loads(raw_json)
223
+ roots = schema if isinstance(schema, list) else [schema]
224
+ for root in roots:
225
+ if isinstance(root, dict):
226
+ schema_nodes.append(root)
227
+ graph = root.get("@graph")
228
+ if isinstance(graph, list):
229
+ schema_nodes.extend(
230
+ g for g in graph if isinstance(g, dict)
231
+ )
232
+ except Exception:
233
+ pass
234
+
235
+ def _has_type(node: dict[str, Any] | None, target: str) -> bool:
236
+ if not node:
237
+ return False
238
+ raw_t = node.get("@type")
239
+ types = raw_t if isinstance(raw_t, list) else [raw_t]
240
+ return any(
241
+ isinstance(v, str) and v.lower() == target for v in types
242
+ )
243
+
244
+ media_schema = (
245
+ next((n for n in schema_nodes if _has_type(n, "movie")), None)
246
+ or next((n for n in schema_nodes if _has_type(n, "tvseries")), None)
247
+ or next((n for n in schema_nodes if _has_type(n, "tvepisode")), None)
248
+ )
249
+
250
+ cv_title = doc.select_one(".cv-movie-title")
251
+ movie_title_a = doc.select_one("#movie_title a")
252
+ og_title = doc.select_one("meta[property='og:title']")
253
+ h1_title = doc.select_one("h1.entry-title, h1.single-title")
254
+ page_title = doc.select_one("title")
255
+ title = (
256
+ _clean(cv_title.text() if cv_title else "")
257
+ or _clean(str(media_schema.get("name", "")) if media_schema else "")
258
+ or _clean(movie_title_a.text() if movie_title_a else "")
259
+ or _clean(og_title.attr("content") if og_title else "")
260
+ or _clean(h1_title.text() if h1_title else "")
261
+ or _clean(page_title.text() if page_title else "")
262
+ or "Unknown Title"
263
+ )
264
+
265
+ first_dl_heading = (
266
+ info_container.select_one("h5, h6") if info_container else None
267
+ )
268
+ first_dl_text = first_dl_heading.text() if first_dl_heading else ""
269
+ dl_info_box = doc.select_one(".cv-card-download-info")
270
+ is_series = (
271
+ bool(re.search(r"\bS\d{1,2}(?:E\d{1,3})?\b", first_dl_text, re.I))
272
+ or bool(re.search(r"\bE\d{1,3}\b", first_dl_text, re.I))
273
+ or "season" in first_dl_text.lower()
274
+ or _has_type(media_schema, "tvseries")
275
+ or _has_type(media_schema, "tvepisode")
276
+ or bool(
277
+ dl_info_box
278
+ and re.search(r"\b(?:series|season)\b", dl_info_box.text(), re.I)
279
+ )
280
+ )
281
+ media_type = "series" if is_series else "movie"
282
+
283
+ imdb_a = doc.select_one("a[href*='imdb.com/title/tt']")
284
+ imdb_m = (
285
+ re.search(r"tt\d+", imdb_a.attr("href")) if imdb_a else None
286
+ ) or re.search(
287
+ r"tt\d+",
288
+ str(
289
+ (media_schema or {}).get("sameAs")
290
+ or (media_schema or {}).get("url")
291
+ or ""
292
+ ),
293
+ )
294
+ imdb_id = imdb_m.group(0) if imdb_m else ""
295
+
296
+ schema_img = ""
297
+ if media_schema:
298
+ raw_img = media_schema.get("image")
299
+ if isinstance(raw_img, str):
300
+ schema_img = raw_img
301
+ elif isinstance(raw_img, dict):
302
+ schema_img = raw_img.get("url") or raw_img.get("contentUrl") or ""
303
+ poster_el = doc.select_one(".cv-movie-poster-img")
304
+ og_img = doc.select_one("meta[property='og:image']")
305
+ async_img = (
306
+ info_container.select_one('img[decoding="async"]')
307
+ if info_container
308
+ else None
309
+ )
310
+ image = (
311
+ (poster_el.attr("src") if poster_el else "")
312
+ or schema_img
313
+ or (og_img.attr("content") if og_img else "")
314
+ or (async_img.attr("src") if async_img else "")
315
+ or ""
316
+ )
317
+ if image.startswith("//"):
318
+ image = "https:" + image
319
+
320
+ ov_box = doc.select_one(".cv-movie-overview-box")
321
+ ov_direct = (
322
+ "".join(c for c in ov_box.children if isinstance(c, str))
323
+ if ov_box
324
+ else ""
325
+ )
326
+ summary_b = (
327
+ info_container.select_one("#summary b:contains('Summary:')")
328
+ if info_container
329
+ else None
330
+ )
331
+ summary_text = ""
332
+ if summary_b is not None and summary_b.parent is not None:
333
+ summary_text = summary_b.parent.text().replace("Summary:", "")
334
+ og_desc = doc.select_one("meta[property='og:description']")
335
+ meta_desc = doc.select_one("meta[name='description']")
336
+ synopsis = (
337
+ _clean(ov_direct)
338
+ or _clean(
339
+ str(media_schema.get("description", "")) if media_schema else ""
340
+ )
341
+ or _clean(summary_text)
342
+ or _clean(og_desc.attr("content") if og_desc else "")
343
+ or _clean(meta_desc.attr("content") if meta_desc else "")
344
+ )
345
+
346
+ links: list[dict[str, Any]] = []
347
+ if info_container is not None:
348
+ for el in info_container.select("h5, h6"):
349
+ full_title = el.text().strip()
350
+ if "Watch Online" in full_title or not re.search(
351
+ r"\b(?:\d{3,4}p|2160p|4k|S\d{1,2}|E\d{1,3})\b",
352
+ full_title,
353
+ re.I,
354
+ ):
355
+ continue
356
+
357
+ q_m = re.search(r"\d{3,4}p\b", full_title)
358
+ quality = q_m.group(0) if q_m else ""
359
+ fs_m = re.search(r"\[([^\]]+)\](?=[^\[]*$)", full_title)
360
+ file_size = fs_m.group(1) if fs_m else ""
361
+
362
+ anchors: list[Any] = []
363
+ sib = el.next_element_sibling()
364
+ while sib is not None and sib.tag not in ("h5", "h6", "hr"):
365
+ if sib.tag == "a":
366
+ anchors.append(sib)
367
+ anchors.extend(sib.select("a"))
368
+ sib = sib.next_element_sibling()
369
+
370
+ for btn in anchors:
371
+ href = btn.attr("href")
372
+ if (
373
+ not href
374
+ or href == "#"
375
+ or href.startswith("javascript:")
376
+ or not re.search(r"(?:oxxfile|hubcloud)", href, re.I)
377
+ ):
378
+ continue
379
+ se_m = re.search(r"(S\d{2}E\d{2}|S\d{2}|E\d{2})", full_title)
380
+ se_prefix = f"{se_m.group(1)} | " if se_m else ""
381
+ item_title = (
382
+ f"{se_prefix}{quality}"
383
+ f"{' | ' + file_size if file_size else ''}"
384
+ ).strip()
385
+ item_title = re.sub(r"\|$", "", item_title).strip()
386
+ entry: dict[str, Any] = {
387
+ "title": item_title,
388
+ "quality": quality,
389
+ "episodesLink": href if media_type == "series" else "",
390
+ }
391
+ if media_type == "movie":
392
+ entry["directLinks"] = [
393
+ {"link": href, "title": "Movie", "type": "movie"}
394
+ ]
395
+ links.append(entry)
396
+
397
+ if media_type == "movie" and not links and info_container is not None:
398
+ for anchor in info_container.select(
399
+ 'a[href*="oxxfile"], a[href*="hubcloud"]'
400
+ ):
401
+ href = anchor.attr("href")
402
+ if not href:
403
+ continue
404
+ links.append(
405
+ {
406
+ "title": anchor.text().strip() or "Movie",
407
+ "directLinks": [
408
+ {"link": href, "title": "Movie", "type": "movie"}
409
+ ],
410
+ }
411
+ )
412
+
413
+ quick_download = self.kv.get("1cinevood_quickDownload", False)
414
+ result: dict[str, Any] = {
415
+ "title": title,
416
+ "synopsis": synopsis,
417
+ "image": image,
418
+ "imdbId": imdb_id,
419
+ "type": media_type,
420
+ "linkList": links,
421
+ "webUrl": url,
422
+ "quickDownload": bool(quick_download),
423
+ }
424
+
425
+ if not imdb_id:
426
+ return result
427
+
428
+ try:
429
+ cinemeta = get_cinemeta_meta(imdb_id, media_type, self.session)
430
+ except Exception:
431
+ return result
432
+
433
+ if cinemeta:
434
+ if media_type == "series" and cinemeta.get("type") == "series":
435
+ updated_list: list[dict[str, Any]] = []
436
+ for item in result["linkList"]:
437
+ ep_link = item.get("episodesLink")
438
+ if not ep_link:
439
+ updated_list.append(item)
440
+ continue
441
+ season_num = get_cinemeta_season(item["title"])
442
+ if not season_num:
443
+ updated_list.append(item)
444
+ continue
445
+ updated_list.append(
446
+ {
447
+ **item,
448
+ "episodesLink": add_cinemeta_context(
449
+ urljoin(url, ep_link), imdb_id, season_num
450
+ ),
451
+ }
452
+ )
453
+ result["linkList"] = updated_list
454
+ return apply_cinemeta_meta(result, cinemeta)
455
+ return result
456
+ except Exception as err:
457
+ throw_provider_error("1CineVood", "metadata", err)
458
+ return {}
459
+
460
+ def get_episodes(
461
+ self,
462
+ url: str,
463
+ imdb_id: str = "",
464
+ season: int | None = None,
465
+ ) -> list[dict[str, Any]]:
466
+ req_url, ctx_imdb, ctx_season = read_cinemeta_context(url)
467
+ eff_imdb = ctx_imdb or imdb_id
468
+ eff_season = ctx_season if ctx_season is not None else season
469
+
470
+ parsed = urlparse(req_url)
471
+ base_url = f"{parsed.scheme}://{parsed.netloc}"
472
+ parts = [p for p in parsed.path.split("/") if p]
473
+ item_id = parts[-1] if parts else ""
474
+ api_url = f"{base_url}/api/packs/{item_id}"
475
+
476
+ def _enrich(eps: list[dict[str, Any]]) -> list[dict[str, Any]]:
477
+ if not eff_imdb or not eff_season:
478
+ return eps
479
+ enriched = eps
480
+ try:
481
+ cinemeta = get_cinemeta_meta(eff_imdb, "series", self.session)
482
+ if cinemeta:
483
+ enriched = enrich_cinemeta_episodes(
484
+ eps, cinemeta.get("videos") or [], eff_season
485
+ )
486
+ except Exception:
487
+ pass
488
+
489
+ skip_timings = self.kv.get("1cinevood_skipTimings", True)
490
+ if True if skip_timings is None else bool(skip_timings):
491
+ try:
492
+ enriched = enrich_episodes_with_skip_timings(
493
+ enriched, eff_imdb, eff_season, self.session
494
+ )
495
+ except Exception:
496
+ pass
497
+ return enriched
498
+
499
+ resp = self.session.get(
500
+ api_url, headers={"Referer": base_url}, timeout=self.timeout
501
+ )
502
+ if resp.status_code == 404:
503
+ alt_url = f"{base_url}/api/s/{item_id}/"
504
+ alt_text = self._get_with_waf(alt_url)
505
+ alt_data: Any = None
506
+ try:
507
+ alt_data = json.loads(re.sub(r"<[^>]+>", "", alt_text).strip())
508
+ except Exception:
509
+ pass
510
+ if isinstance(alt_data, dict) and alt_data.get("hasHubcloud"):
511
+ hubcloud_url = f"{base_url}/api/s/{item_id}/hubcloud"
512
+ return _enrich(
513
+ [
514
+ {
515
+ "title": _format_ep_title(
516
+ str(alt_data.get("fileName") or "Movie")
517
+ ),
518
+ "link": hubcloud_url,
519
+ }
520
+ ]
521
+ )
522
+ return []
523
+
524
+ if resp.status_code == 403 or _is_waf_challenge(resp.text):
525
+ resp.raise_for_status()
526
+ raise ProviderError(f"1CineVood WAF challenge blocked {api_url}")
527
+ resp.raise_for_status()
528
+
529
+ pack_data: Any = None
530
+ try:
531
+ pack_data = resp.json()
532
+ except Exception:
533
+ try:
534
+ pack_data = json.loads(re.sub(r"<[^>]+>", "", resp.text).strip())
535
+ except Exception:
536
+ pass
537
+
538
+ items = (
539
+ ((pack_data or {}).get("pack") or {}).get("items")
540
+ if isinstance(pack_data, dict)
541
+ else []
542
+ ) or []
543
+ episodes: list[dict[str, Any]] = []
544
+ for item in items:
545
+ if isinstance(item, dict) and item.get("file_name") and item.get("hubcloud_link"):
546
+ episodes.append(
547
+ {
548
+ "title": _format_ep_title(str(item["file_name"])),
549
+ "link": str(item["hubcloud_link"]),
550
+ }
551
+ )
552
+
553
+ quick_download = self.kv.get("1cinevood_quickDownload", True)
554
+ qd_val = True if quick_download is None else bool(quick_download)
555
+ return [{**ep, "quickDownload": qd_val} for ep in _enrich(episodes)]
556
+
557
+ def get_stream(
558
+ self,
559
+ url: str,
560
+ is_download: bool = False,
561
+ media_type: str = "movie",
562
+ ) -> list[dict[str, Any]]:
563
+ try:
564
+ process_link = url
565
+ if "oxxfile" in process_link:
566
+ try:
567
+ parsed = urlparse(process_link)
568
+ origin = f"{parsed.scheme}://{parsed.netloc}"
569
+ parts = [p for p in parsed.path.split("/") if p]
570
+ item_id = parts[-1] if parts else ""
571
+ api_url = f"{origin}/api/s/{item_id}/hubcloud"
572
+ resp = self.session.get(
573
+ api_url, allow_redirects=True, timeout=self.timeout
574
+ )
575
+ if resp.url and "hubcloud" in resp.url:
576
+ process_link = resp.url
577
+ else:
578
+ try:
579
+ data = resp.json()
580
+ if isinstance(data, dict) and data.get("link"):
581
+ process_link = str(data["link"])
582
+ except Exception:
583
+ pass
584
+ except Exception:
585
+ pass
586
+
587
+ return hubcloud_extractor(
588
+ process_link,
589
+ self.session,
590
+ is_download=is_download,
591
+ provider_value="1cinevood",
592
+ kv_store=self.kv,
593
+ )
594
+ except Exception as err:
595
+ throw_provider_error("1CineVood", "stream", err)
596
+ return []
@@ -0,0 +1,31 @@
1
+ """Pure-Python Vega Prime Video Mirror provider."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from .common.net_mirror import NetMirrorBaseProvider, NetMirrorOtt
6
+
7
+
8
+ class PrimeMirrorClient(NetMirrorBaseProvider):
9
+ """Client for the Prime Video Mirror (NetMirror) provider."""
10
+
11
+ name: str = "primeMirror"
12
+ ott_prefix: NetMirrorOtt = "pv"
13
+ catalog: list[dict[str, str]] = [
14
+ {
15
+ "title": "Featured Originals: Movies",
16
+ "filter": "Featured Originals: Movies",
17
+ },
18
+ {
19
+ "title": "Featured Originals: Series",
20
+ "filter": "Featured Originals: Series",
21
+ },
22
+ {
23
+ "title": "Drama TV",
24
+ "filter": "Drama TV",
25
+ },
26
+ {
27
+ "title": "Comedy Series",
28
+ "filter": "Comedy Series",
29
+ },
30
+ ]
31
+ genres: list[dict[str, str]] = []