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,650 @@
1
+ """Pure-Python Vega LuxMovies provider."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import re
6
+ from typing import Any
7
+ from urllib.parse import urljoin, urlparse
8
+
9
+ from ..html import Node, parse_html
10
+ from ..utils import format_season_title
11
+ from .common import (
12
+ BaseProvider,
13
+ add_cinemeta_context,
14
+ apply_cinemeta_meta,
15
+ enrich_cinemeta_episodes,
16
+ enrich_episodes_with_skip_timings,
17
+ get_base_url,
18
+ get_cinemeta_meta,
19
+ get_cinemeta_season,
20
+ read_cinemeta_context,
21
+ throw_provider_error,
22
+ )
23
+ from .common.extractors import hubcloud_extractor
24
+
25
+ _LUX_HEADERS: dict[str, str] = {
26
+ "Accept": (
27
+ "text/html,application/xhtml+xml,application/xml;q=0.9,"
28
+ "image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"
29
+ ),
30
+ "Cache-Control": "no-store",
31
+ "Accept-Language": "en-US,en;q=0.9",
32
+ "DNT": "1",
33
+ "sec-ch-ua": '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"',
34
+ "sec-ch-ua-mobile": "?0",
35
+ "sec-ch-ua-platform": '"Windows"',
36
+ "Sec-Fetch-Dest": "document",
37
+ "Sec-Fetch-Mode": "navigate",
38
+ "Sec-Fetch-Site": "none",
39
+ "Sec-Fetch-User": "?1",
40
+ "Cookie": (
41
+ "_ga=GA1.1.10613951.1756380104; xla=s4t; "
42
+ "_ga_1CG5NQ0F53=GS2.1.s1756380103$o1$g1$t1756380120$j43$l0$h0"
43
+ ),
44
+ "Upgrade-Insecure-Requests": "1",
45
+ "User-Agent": (
46
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
47
+ "AppleWebKit/537.36 (KHTML, like Gecko) "
48
+ "Chrome/138.0.0.0 Safari/537.36 Edg/138.0.0.0"
49
+ ),
50
+ }
51
+
52
+ _EP_COOKIE = (
53
+ "ext_name=ojplmecpdpgccookcobabopnaifgidhf; "
54
+ "cf_clearance=6yZYfXQxBgjaD1eacR5zZCz7njssbxjtSZZCElTOGk0-1764836255-1.2.1.1-"
55
+ "bzHvDcDRLp6AAYo7qvGVzJ6Gk6zaqAepuGiGhAWCGYL.ZDpw5yI4TkUIXDgAnEhGCZ9J5X2_OagzgeMHZrd8rzeyAFQXj0dmY"
56
+ "MErcfII7_Rhq5kZ4kAtS0tl9PtaNKKd2m4taIufySXCCstl3iNLMODTjbsW_KZi8U8DauOdGSAhBd1DCGxvLlAOM.snfkhb0y"
57
+ "QiVJcLW8Bv9IeKQac0ar_TKkV6QexqNZYiyRXnE7E; xla=s4t"
58
+ )
59
+
60
+
61
+ def _relative_link(base_url: str, href: str) -> str:
62
+ full = urljoin(f"{base_url.rstrip('/')}/", href)
63
+ parsed = urlparse(full)
64
+ result = parsed.path or "/"
65
+ if parsed.query:
66
+ result += f"?{parsed.query}"
67
+ if parsed.fragment:
68
+ result += f"#{parsed.fragment}"
69
+ return result
70
+
71
+
72
+ def _find_anchor_by_keywords(container: Node, keywords: tuple[str, ...]) -> Node | None:
73
+ for a in container.select("a"):
74
+ txt = a.text().lower()
75
+ href = a.attr("href").lower()
76
+ if any(kw in txt or kw in href for kw in keywords):
77
+ return a
78
+ return None
79
+
80
+
81
+ class LuxMoviesClient(BaseProvider):
82
+ """Client for the LuxMovies provider."""
83
+
84
+ name: str = "luxMovies"
85
+ catalog: list[dict[str, str]] = [
86
+ {"title": "New", "filter": ""},
87
+ {"title": "Netflix", "filter": "web-series/netflix"},
88
+ {"title": "Amazon Prime", "filter": "web-series/amazon-prime-video"},
89
+ {"title": "4K Movies", "filter": "movies-by-quality/2160p"},
90
+ ]
91
+ genres: list[dict[str, str]] = [
92
+ {"title": "Action", "filter": "category/movies-by-genres/action/"},
93
+ {"title": "Adventure", "filter": "category/movies-by-genres/adventure/"},
94
+ {"title": "Animation", "filter": "category/movies-by-genres/animation/"},
95
+ {"title": "Biography", "filter": "category/movies-by-genres/biography/"},
96
+ {"title": "Comedy", "filter": "category/movies-by-genres/comedy/"},
97
+ {"title": "Crime", "filter": "category/movies-by-genres/crime/"},
98
+ {"title": "Documentary", "filter": "category/movies-by-genres/documentary/"},
99
+ {"title": "Drama", "filter": "category/movies-by-genres/drama/"},
100
+ {"title": "Family", "filter": "category/movies-by-genres/family/"},
101
+ {"title": "Fantasy", "filter": "category/movies-by-genres/fantasy/"},
102
+ {"title": "History", "filter": "category/movies-by-genres/history/"},
103
+ {"title": "Horror", "filter": "category/movies-by-genres/horror/"},
104
+ {"title": "Music", "filter": "category/movies-by-genres/music/"},
105
+ {"title": "Mystery", "filter": "category/movies-by-genres/mystery/"},
106
+ {"title": "Romance", "filter": "category/movies-by-genres/romance/"},
107
+ {"title": "Sci-Fi", "filter": "category/movies-by-genres/sci-fi/"},
108
+ {"title": "Sport", "filter": "category/movies-by-genres/sport/"},
109
+ {"title": "Thriller", "filter": "category/movies-by-genres/thriller/"},
110
+ {"title": "War", "filter": "category/movies-by-genres/war/"},
111
+ {"title": "Western", "filter": "category/movies-by-genres/western/"},
112
+ ]
113
+ settings_schema: list[dict[str, Any]] = [
114
+ {
115
+ "key": "luxMovies_quickDownload",
116
+ "type": "toggle",
117
+ "label": "Quick Download",
118
+ "description": (
119
+ "Automatically download the preferred server in 1-click without showing server selection"
120
+ ),
121
+ "defaultValue": True,
122
+ },
123
+ {
124
+ "key": "luxMovies_preferredDownloadServer",
125
+ "type": "select",
126
+ "label": "Preferred Download Server",
127
+ "description": "Server to prioritize for 1-click quick download",
128
+ "options": [
129
+ {"label": "Auto (Best Available)", "value": "auto"},
130
+ {"label": "CF Worker (Fastest)", "value": "cf worker"},
131
+ {"label": "CF Storage (R2 Direct)", "value": "cf storage"},
132
+ {"label": "GDrive (Google Direct)", "value": "gdrive"},
133
+ {"label": "Pixeldrain", "value": "pixeldrain"},
134
+ {"label": "FastDl", "value": "fastdl"},
135
+ {"label": "HubCdn", "value": "hubcdn"},
136
+ ],
137
+ "defaultValue": "auto",
138
+ },
139
+ {
140
+ "key": "luxMovies_skipTimings",
141
+ "type": "toggle",
142
+ "label": "Skip Timings",
143
+ "description": (
144
+ "Automatically fetch intro and recap skip timestamps from TheIntroDB for verified episodes"
145
+ ),
146
+ "defaultValue": True,
147
+ },
148
+ ]
149
+
150
+ def get_posts(self, filter_path: str = "", page: int = 1) -> list[dict[str, str]]:
151
+ base_url = get_base_url("lux").rstrip("/")
152
+ path_part = f"/{filter_path.strip('/')}" if filter_path.strip("/") else ""
153
+ url = f"{base_url}{path_part}/page/{page}/"
154
+ try:
155
+ html = self.fetch_text(url, headers={**_LUX_HEADERS, "Referer": base_url})
156
+ doc = parse_html(html)
157
+ posts: list[dict[str, str]] = []
158
+ for container in doc.select(".blog-items, .post-list, #archive-container, .movies-grid"):
159
+ for el in container.children_elements():
160
+ if not el.matches("article, .entry-list-item, a"):
161
+ continue
162
+ a_el = el.select_one("a")
163
+ href = (a_el.attr("href") if a_el else "") or el.attr("href")
164
+ if not href:
165
+ continue
166
+
167
+ score_el = el.select_one(".imdb-score, .rating, [class*='score']")
168
+ rating_match = (
169
+ re.search(r"(\d+(?:\.\d+)?)", score_el.text())
170
+ if score_el
171
+ else None
172
+ )
173
+ rating = (
174
+ rating_match.group(1)
175
+ if rating_match
176
+ else (
177
+ el.select_one('meta[itemprop="ratingValue"]').attr("content").strip()
178
+ if el.select_one('meta[itemprop="ratingValue"]')
179
+ else ""
180
+ )
181
+ )
182
+
183
+ entry_title_el = el.select_one(".entry-title, .poster-title")
184
+ post_title_el = el.select_one(".post-title, .poster-title")
185
+ entry_text = (
186
+ entry_title_el.text().replace("Download", "")
187
+ if entry_title_el
188
+ else ""
189
+ )
190
+ title_match = re.match(
191
+ r"^(.*?)\s*\((\d{4})\)|^(.*?)\s*\((Season \d+)\)", entry_text
192
+ )
193
+ title = (
194
+ (title_match.group(0) if title_match else "")
195
+ or (a_el.attr("title").replace("Download", "") if a_el else "")
196
+ or (
197
+ post_title_el.text().replace("Download", "")
198
+ if post_title_el
199
+ else ""
200
+ )
201
+ ).strip()
202
+
203
+ a_img = a_el.select_one("img") if a_el else None
204
+ el_img = el.select_one("img")
205
+ image = ""
206
+ if a_img:
207
+ image = (
208
+ a_img.attr("data-lazy-src")
209
+ or a_img.attr("data-src")
210
+ or a_img.attr("src")
211
+ )
212
+ if not image and el_img:
213
+ image = el_img.attr("data-src") or el_img.attr("src")
214
+ if image.startswith("//"):
215
+ image = f"https:{image}"
216
+
217
+ post: dict[str, str] = {
218
+ "title": title,
219
+ "link": _relative_link(base_url, href),
220
+ "image": image,
221
+ }
222
+ if rating:
223
+ post["tag"] = f"{rating}★"
224
+ posts.append(post)
225
+ return posts
226
+ except Exception as err:
227
+ throw_provider_error("LuxMovies", "posts", err)
228
+ return []
229
+
230
+ def get_search_posts(self, query: str, page: int = 1) -> list[dict[str, str]]:
231
+ base_url = get_base_url("lux").rstrip("/")
232
+ url = f"{base_url}/search.php"
233
+ try:
234
+ data = self.fetch_json(
235
+ url,
236
+ headers={**_LUX_HEADERS, "Referer": base_url},
237
+ params={"q": query, "page": str(page)},
238
+ )
239
+ posts: list[dict[str, str]] = []
240
+ hits = data.get("hits") if isinstance(data, dict) else None
241
+ if isinstance(hits, list):
242
+ for hit in hits:
243
+ doc = hit.get("document") if isinstance(hit, dict) else None
244
+ if not isinstance(doc, dict):
245
+ continue
246
+ permalink = str(doc.get("permalink") or "")
247
+ doc_rating = (
248
+ doc.get("rating") or doc.get("imdbRating") or doc.get("imdb_rating")
249
+ )
250
+ post: dict[str, str] = {
251
+ "title": str(doc.get("post_title") or "").replace("Download", "").strip(),
252
+ "link": _relative_link(base_url, permalink),
253
+ "image": str(doc.get("post_thumbnail") or ""),
254
+ }
255
+ if doc_rating:
256
+ post["tag"] = f"{doc_rating}★"
257
+ posts.append(post)
258
+ return posts
259
+ except Exception as err:
260
+ throw_provider_error("LuxMovies", "search posts", err)
261
+ return []
262
+
263
+ def get_meta(self, link: str) -> dict[str, Any]:
264
+ try:
265
+ current_base_url = get_base_url("lux").rstrip("/")
266
+ url = urljoin(f"{current_base_url}/", link)
267
+ parsed = urlparse(url)
268
+ base_url = f"{parsed.scheme}://{parsed.netloc}"
269
+ html = self.fetch_text(url, headers={**_LUX_HEADERS, "Referer": base_url})
270
+ doc = parse_html(html)
271
+
272
+ info_container = doc.select_one(
273
+ ".entry-content, .post-inner, .post-content, .page-body"
274
+ )
275
+
276
+ title_el = doc.select_one("h1.post-title")
277
+ title = title_el.text().strip() if title_el else ""
278
+ if not title and info_container:
279
+ h3 = info_container.select_one("h3")
280
+ nxt = h3.next_element_sibling("p") if h3 else None
281
+ m = re.search(r"Name: (.+)", nxt.text()) if nxt else None
282
+ title = m.group(1).strip() if m else ""
283
+
284
+ imdb_el = doc.select_one('a[href*="imdb.com"]')
285
+ imdb_match = re.search(r"tt\d+", imdb_el.attr("href")) if imdb_el else None
286
+ imdb_id = imdb_match.group(0) if imdb_match else ""
287
+ if not imdb_id and info_container:
288
+ h3 = info_container.select_one("h3")
289
+ nxt = h3.next_element_sibling("p") if h3 else None
290
+ nxt_a = nxt.select_one("a") if nxt else None
291
+ m = (
292
+ re.search(r"tt\d+", nxt_a.attr("href")) if nxt_a else None
293
+ ) or re.search(r"tt\d+", info_container.text())
294
+ imdb_id = m.group(0) if m else ""
295
+
296
+ media_type = "movie"
297
+ h3 = info_container.select_one("h3") if info_container else None
298
+ nxt = h3.next_element_sibling("p") if h3 else None
299
+ page_text = f"{title} {info_container.text() if info_container else ''}"
300
+ if (nxt and "Series Name" in nxt.text()) or re.search(
301
+ r"\b(?:web\s+series|season\s*\d{1,2}|s\d{1,2}\s*e\d{1,3})\b",
302
+ page_text,
303
+ re.I,
304
+ ):
305
+ media_type = "series"
306
+
307
+ synopsis = ""
308
+ for h in doc.select("h3"):
309
+ t = h.text()
310
+ if "SYNOPSIS/PLOT" in t or "Plot" in t:
311
+ p = h.next_element_sibling("p")
312
+ if p:
313
+ synopsis = p.text().strip()
314
+ break
315
+ if not synopsis and info_container:
316
+ for p in info_container.select("p"):
317
+ nxt_h = p.next_element_sibling()
318
+ if nxt_h and nxt_h.tag in {"h3", "h4"}:
319
+ nxt_p = nxt_h.next_element_sibling("p")
320
+ if nxt_p and nxt_p.text().strip():
321
+ synopsis = nxt_p.text().strip()
322
+ break
323
+
324
+ image = ""
325
+ if info_container:
326
+ lazy_img = info_container.select_one("img[data-lazy-src]")
327
+ if lazy_img:
328
+ image = lazy_img.attr("data-lazy-src")
329
+ if not image:
330
+ for img in info_container.select("img"):
331
+ src = img.attr("src")
332
+ if src and not any(
333
+ bad in src for bad in ("logo", "svg", "placeholder", "icon")
334
+ ):
335
+ image = src
336
+ break
337
+ if image.startswith("//"):
338
+ image = f"https:{image}"
339
+
340
+ hr: Node | None = info_container.select_one("hr") if info_container else None
341
+ first_btn = doc.select_one(
342
+ ".dwd-button, a[href*='nexdrive'], a[href*='vcloud'], a[href*='fastdl'], a[href*='hubcloud']"
343
+ )
344
+ if first_btn:
345
+ container_p = first_btn.closest("p")
346
+ prev = container_p.prev_element_sibling() if container_p else None
347
+ while prev is not None and prev.tag != "hr":
348
+ prev = prev.prev_element_sibling()
349
+ if prev is not None and prev.tag == "hr":
350
+ hr = prev
351
+
352
+ links: list[dict[str, Any]] = []
353
+ seen_hrefs: set[str] = set()
354
+ el = hr.next_element_sibling() if hr else None
355
+ while el is not None:
356
+ if el.tag in {"hr", "style", "script"}:
357
+ el = el.next_element_sibling()
358
+ continue
359
+
360
+ el_text = el.text()
361
+ if el.select("a") and (
362
+ "Instant" in el_text
363
+ or "Resumable" in el_text
364
+ or "Download Now" in el_text
365
+ or "Batch/Zip" in el_text
366
+ or el.select(".dwd-button, .btn-outline")
367
+ ):
368
+ el = el.next_element_sibling()
369
+ continue
370
+
371
+ item_title = re.sub(r"\s+", " ", re.sub(r"[\r\n\t]+", " ", el_text)).strip()
372
+ if not item_title or re.match(r"^[\s\-_=~*•–—:|]+$", item_title):
373
+ el = el.next_element_sibling()
374
+ continue
375
+
376
+ lower = item_title.lower()
377
+ if (
378
+ "winding up" in lower
379
+ or "thank you" in lower
380
+ or "telegram" in lower
381
+ or "how to download" in lower
382
+ or "join our" in lower
383
+ or lower == "download now"
384
+ ):
385
+ el = el.next_element_sibling()
386
+ continue
387
+
388
+ q_match = re.search(r"\d+p\b", item_title, re.I)
389
+ quality = q_match.group(0) if q_match else ""
390
+
391
+ if (
392
+ not quality
393
+ and not re.search(r"episodes?\s*[:\d\-]", item_title, re.I)
394
+ and not re.search(r"\[.*(?:mb|gb|e).*\]", item_title, re.I)
395
+ ):
396
+ nxt_el = el.next_element_sibling()
397
+ if nxt_el and (
398
+ nxt_el.tag in {"h1", "h2", "h3", "h4", "h5", "h6", "strong"}
399
+ or (nxt_el.tag == "p" and nxt_el.select("strong"))
400
+ ):
401
+ el = el.next_element_sibling()
402
+ continue
403
+
404
+ item_title = re.sub(
405
+ r"^[\s•\-*—_:=~|]+|[\s•\-*—_:=~|]+$", "", item_title
406
+ ).strip()
407
+ if not item_title:
408
+ el = el.next_element_sibling()
409
+ continue
410
+
411
+ next_p = el.next_element_sibling()
412
+ while next_p is not None and next_p.tag != "hr" and not next_p.select("a[href]"):
413
+ next_p = next_p.next_element_sibling()
414
+
415
+ if next_p is None or next_p.tag == "hr":
416
+ el = el.next_element_sibling()
417
+ continue
418
+
419
+ btn: Node | None = None
420
+ if media_type == "series":
421
+ btn = _find_anchor_by_keywords(next_p, ("v-cloud", "vcloud"))
422
+ if not btn:
423
+ for a in next_p.select("a"):
424
+ txt = a.text().lower()
425
+ href = a.attr("href").lower()
426
+ if (
427
+ "zip" not in txt
428
+ and "batch" not in txt
429
+ and "zip" not in href
430
+ and "batch" not in href
431
+ ):
432
+ btn = a
433
+ break
434
+ else:
435
+ btn = _find_anchor_by_keywords(next_p, ("v-cloud", "vcloud"))
436
+ if not btn:
437
+ btn = _find_anchor_by_keywords(next_p, ("g-direct", "direct", "fastdl"))
438
+ if not btn:
439
+ dwd = next_p.select_one(".dwd-button, .btn-outline")
440
+ if dwd and dwd.parent and dwd.parent.tag == "a":
441
+ btn = dwd.parent
442
+ if not btn or not btn.attr("href"):
443
+ btn = next_p.select_one("a[href]")
444
+
445
+ btn_href = btn.attr("href") if btn else ""
446
+ if btn_href and btn_href not in {"/", "#"} and btn_href not in seen_hrefs:
447
+ seen_hrefs.add(btn_href)
448
+ if media_type == "series":
449
+ links.append(
450
+ {"title": item_title, "episodesLink": btn_href, "quality": quality}
451
+ )
452
+ else:
453
+ links.append(
454
+ {
455
+ "title": item_title,
456
+ "directLinks": [
457
+ {"title": "Movie", "link": btn_href, "type": "movie"}
458
+ ],
459
+ "quality": quality,
460
+ }
461
+ )
462
+
463
+ el = el.next_element_sibling()
464
+
465
+ quick_download = self.kv.get("luxMovies_quickDownload", True)
466
+ formatted_links = [
467
+ {**item, "title": format_season_title(item["title"])}
468
+ if item.get("title")
469
+ else item
470
+ for item in links
471
+ ]
472
+ website_info: dict[str, Any] = {
473
+ "title": title,
474
+ "synopsis": synopsis,
475
+ "image": image,
476
+ "imdbId": imdb_id,
477
+ "type": media_type,
478
+ "quickDownload": True if quick_download is None else bool(quick_download),
479
+ "linkList": formatted_links,
480
+ "webUrl": url,
481
+ }
482
+ if not imdb_id:
483
+ return website_info
484
+
485
+ try:
486
+ cinemeta = get_cinemeta_meta(imdb_id, media_type, self.session)
487
+ if cinemeta:
488
+ if media_type == "series" and cinemeta.get("type") == "series":
489
+ updated_links: list[dict[str, Any]] = []
490
+ for item in website_info["linkList"]:
491
+ ep_link = item.get("episodesLink")
492
+ if not ep_link:
493
+ updated_links.append(item)
494
+ continue
495
+ season = get_cinemeta_season(item.get("title", ""))
496
+ if not season:
497
+ updated_links.append(item)
498
+ continue
499
+ updated_links.append(
500
+ {
501
+ **item,
502
+ "episodesLink": add_cinemeta_context(
503
+ urljoin(url, ep_link), imdb_id, season
504
+ ),
505
+ }
506
+ )
507
+ website_info["linkList"] = updated_links
508
+ return apply_cinemeta_meta(website_info, cinemeta)
509
+ except Exception:
510
+ pass
511
+
512
+ return website_info
513
+ except Exception as err:
514
+ throw_provider_error("LuxMovies", "metadata", err)
515
+ return {}
516
+
517
+ def get_episodes(
518
+ self,
519
+ url: str,
520
+ imdb_id: str = "",
521
+ season: int | None = None,
522
+ ) -> list[dict[str, Any]]:
523
+ try:
524
+ req_url, ctx_imdb, ctx_season = read_cinemeta_context(url)
525
+ eff_imdb = ctx_imdb or imdb_id
526
+ eff_season = ctx_season or season
527
+
528
+ headers = {
529
+ "Cookie": _EP_COOKIE,
530
+ "User-Agent": (
531
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
532
+ "AppleWebKit/537.36 (KHTML, like Gecko) "
533
+ "Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0"
534
+ ),
535
+ }
536
+ html = self.fetch_text(req_url, headers=headers)
537
+ doc = parse_html(html)
538
+
539
+ episodes: list[dict[str, Any]] = []
540
+ seen_titles: set[str] = set()
541
+ for container in doc.select(".entry-content, .entry-inner"):
542
+ for el in container.select("h3, h4, h5, p"):
543
+ if el.closest(".unili-content, .code-block-1"):
544
+ continue
545
+ text = el.text().strip()
546
+ if (
547
+ re.search(r"episodes?\s*[:\d\-]", text, re.I)
548
+ or re.search(r"e\d{1,3}\b", text, re.I)
549
+ or re.match(r"^episode\s*\d+", text, re.I)
550
+ ):
551
+ title = re.sub(r"\s+", " ", text).strip()
552
+ title = re.sub(r"^[-:\s]+|[-:\s]+$", "", title)
553
+ title = re.sub(r"^episodes?\s*:\s*", "Episode ", title, flags=re.I)
554
+
555
+ next_p = el.next_element_sibling()
556
+ while (
557
+ next_p is not None
558
+ and next_p.tag != "p"
559
+ and not next_p.select("a[href]")
560
+ ):
561
+ next_p = next_p.next_element_sibling()
562
+
563
+ if next_p is None:
564
+ continue
565
+
566
+ link_el = (
567
+ next_p.select_one("a[href*='vcloud']")
568
+ or next_p.select_one("a[href*='hubcloud']")
569
+ or next_p.select_one("a[href*='fastdl']")
570
+ )
571
+ if not link_el:
572
+ outline = next_p.select_one(".btn-outline")
573
+ if outline:
574
+ link_el = (
575
+ outline.parent
576
+ if outline.parent and outline.parent.tag == "a"
577
+ else outline
578
+ )
579
+ if not link_el:
580
+ link_el = next_p.select_one("a[href]")
581
+
582
+ ep_link = link_el.attr("href") if link_el else ""
583
+ if title and ep_link and title not in seen_titles:
584
+ seen_titles.add(title)
585
+ episodes.append({"title": title, "link": ep_link})
586
+
587
+ quick_download = self.kv.get("luxMovies_quickDownload", True)
588
+ qd_val = True if quick_download is None else bool(quick_download)
589
+ if not eff_imdb or not eff_season:
590
+ return [{**e, "quickDownload": qd_val} for e in episodes]
591
+
592
+ enriched = episodes
593
+ try:
594
+ cinemeta = get_cinemeta_meta(eff_imdb, "series", self.session)
595
+ if cinemeta:
596
+ enriched = enrich_cinemeta_episodes(
597
+ episodes, cinemeta.get("videos") or [], eff_season
598
+ )
599
+ except Exception:
600
+ pass
601
+
602
+ skip_timings = self.kv.get("luxMovies_skipTimings", True)
603
+ if skip_timings is None or bool(skip_timings):
604
+ try:
605
+ enriched = enrich_episodes_with_skip_timings(
606
+ enriched, eff_imdb, eff_season, self.session
607
+ )
608
+ except Exception:
609
+ pass
610
+
611
+ return [{**e, "quickDownload": qd_val} for e in enriched]
612
+ except Exception as err:
613
+ throw_provider_error("LuxMovies", "episodes", err)
614
+ return []
615
+
616
+ def get_stream(
617
+ self,
618
+ url: str,
619
+ is_download: bool = False,
620
+ media_type: str = "movie",
621
+ ) -> list[dict[str, Any]]:
622
+ try:
623
+ target = url
624
+ if media_type == "movie" and "cloud" not in target:
625
+ dotlink_text = self.fetch_text(
626
+ target,
627
+ headers={
628
+ **_LUX_HEADERS,
629
+ "Cookie": _EP_COOKIE,
630
+ "User-Agent": (
631
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
632
+ "AppleWebKit/537.36 (KHTML, like Gecko) "
633
+ "Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0"
634
+ ),
635
+ },
636
+ )
637
+ vlink_match = re.search(r'<a\s+href="([^"]*cloud\.[^"]*)"', dotlink_text, re.I)
638
+ if vlink_match:
639
+ target = vlink_match.group(1)
640
+
641
+ return hubcloud_extractor(
642
+ target,
643
+ self.session,
644
+ is_download=is_download,
645
+ provider_value="luxMovies",
646
+ kv_store=self.kv,
647
+ )
648
+ except Exception as err:
649
+ throw_provider_error("LuxMovies", "stream", err)
650
+ return []