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,483 @@
1
+ """Pure-Python UHDMovies provider."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import re
6
+ from typing import Any
7
+ from urllib.parse import quote, unquote, urljoin, urlparse
8
+
9
+ from ..html import parse_html
10
+ from ..utils import format_season_title, to_relative_path
11
+ from .common import BaseProvider, get_base_url, throw_provider_error
12
+ from .common.extractors import gdflix_extractor, hubcloud_extractor
13
+
14
+
15
+ class UhdClient(BaseProvider):
16
+ """Pure-Python client for the UHDMovies provider."""
17
+
18
+ name: str = "uhd"
19
+ catalog: list[dict[str, str]] = [
20
+ {"title": "Latest", "filter": ""},
21
+ {"title": "Web Series", "filter": "/web-series"},
22
+ {"title": "Movies", "filter": "/movies"},
23
+ {"title": "4K HDR", "filter": "/4k-hdr"},
24
+ ]
25
+ genres: list[dict[str, str]] = [
26
+ {"title": "4K HEVC", "filter": "/2160p-hevc"},
27
+ {"title": "HD 10bit", "filter": "/1080p-10bit"},
28
+ {"title": "English Movies", "filter": "/movies/english-movies"},
29
+ {"title": "Dual Audio", "filter": "/movies/dual-audio-movies"},
30
+ ]
31
+
32
+ def _base_url(self) -> str:
33
+ return get_base_url("UhdMovies").rstrip("/")
34
+
35
+ def _get_with_waf(self, url: str) -> str:
36
+ base = "/".join(url.split("/")[:3])
37
+ return self.fetch_text(url, headers={"Referer": base})
38
+
39
+ def _fetch_posts(self, base_url: str, url: str, operation: str) -> list[dict[str, str]]:
40
+ try:
41
+ html = self._get_with_waf(url)
42
+ doc = parse_html(html)
43
+ catalog: list[dict[str, str]] = []
44
+ for el in doc.select(".gridlove-posts .layout-masonry"):
45
+ a_el = el.select_one("a")
46
+ title = a_el.attr("title") if a_el else ""
47
+ href = a_el.attr("href") if a_el else ""
48
+ img = a_el.select_one("img") if a_el else None
49
+ image = img.attr("src") if img else ""
50
+ if title and href and image:
51
+ catalog.append(
52
+ {
53
+ "title": title.replace("Download", "").strip(),
54
+ "link": to_relative_path(base_url, href),
55
+ "image": image,
56
+ }
57
+ )
58
+ return catalog
59
+ except Exception as err:
60
+ throw_provider_error("UHDMovies", operation, err)
61
+ return []
62
+
63
+ def get_posts(self, filter_path: str = "", page: int = 1) -> list[dict[str, str]]:
64
+ base_url = self._base_url()
65
+ url = (
66
+ f"{base_url}/{filter_path}/"
67
+ if page == 1
68
+ else f"{base_url}{filter_path}/page/{page}/"
69
+ )
70
+ return self._fetch_posts(base_url, url, "posts")
71
+
72
+ def get_search_posts(self, query: str, page: int = 1) -> list[dict[str, str]]:
73
+ base_url = self._base_url()
74
+ url = f"{base_url}/search/{quote(query)}/page/{page}/"
75
+ return self._fetch_posts(base_url, url, "search posts")
76
+
77
+ def get_meta(self, link: str) -> dict[str, Any]:
78
+ try:
79
+ base_url = self._base_url()
80
+ url = urljoin(f"{base_url}/", link)
81
+ html = self._get_with_waf(url)
82
+ doc = parse_html(html)
83
+
84
+ h2_first = doc.select_one("h2")
85
+ h1_entry = doc.select_one("h1.entry-title")
86
+ page_title = doc.select_one("title")
87
+ raw_title = (
88
+ (h2_first.text() if h2_first else "")
89
+ or (h1_entry.text() if h1_entry else "")
90
+ or (page_title.text().split("-")[0].strip() if page_title else "")
91
+ or ""
92
+ )
93
+
94
+ image = ""
95
+ if h2_first is not None and h2_first.parent is not None:
96
+ for sib in h2_first.parent.children_elements():
97
+ if sib is h2_first:
98
+ continue
99
+ img = sib.select_one("img")
100
+ if img and img.attr("src"):
101
+ image = img.attr("src")
102
+ break
103
+ if not image:
104
+ entry_img = doc.select_one(".entry-content img")
105
+ image = entry_img.attr("src") if entry_img else ""
106
+
107
+ def _is_junk_text(t: str) -> bool:
108
+ lower = t.lower().strip()
109
+ return (
110
+ not lower
111
+ or lower == "\u00a0"
112
+ or "here you can download" in lower
113
+ or "we do not host" in lower
114
+ or "join telegram" in lower
115
+ )
116
+
117
+ def _is_junk_link(t: str) -> bool:
118
+ lower = t.lower().strip()
119
+ if "zip" in lower:
120
+ return True
121
+ return lower in {
122
+ "3d movies",
123
+ "4k hdr",
124
+ "4k 2160p",
125
+ "1080p x264 uhd",
126
+ "1080p 60fps",
127
+ "1080p x265 10bit",
128
+ }
129
+
130
+ episodes: list[dict[str, Any]] = []
131
+
132
+ def _collect_sections(separators: list[Any], stop_sel: str) -> None:
133
+ for sep in separators:
134
+ el = sep.next_element_sibling()
135
+ while el is not None and not el.matches(stop_sel):
136
+ section_title = re.sub(r"\s+", " ", el.text()).strip()
137
+ if not _is_junk_text(section_title):
138
+ next_p = el.next_element_sibling("p")
139
+ ep_list: list[dict[str, str]] = []
140
+ if next_p is not None:
141
+ for a_el in next_p.select("a"):
142
+ a_title = re.sub(r"\s+", " ", a_el.text()).strip()
143
+ a_link = a_el.attr("href")
144
+ if a_title and a_link and not _is_junk_link(a_title):
145
+ ep_list.append(
146
+ {"title": a_title, "link": a_link}
147
+ )
148
+ if section_title and ep_list:
149
+ episodes.append(
150
+ {"title": section_title, "directLinks": ep_list}
151
+ )
152
+ el = el.next_element_sibling()
153
+
154
+ _collect_sections(
155
+ doc.select(".mks_separator, p:contains('mks_separator')"),
156
+ ".mks_separator",
157
+ )
158
+ if not episodes:
159
+ _collect_sections(doc.select("hr"), "hr")
160
+
161
+ clean_title = re.sub(r"^Download\s+", "", raw_title, flags=re.I)
162
+ clean_title = re.sub(r"\s+Esubs.*$", "", clean_title, flags=re.I)
163
+ clean_title = re.sub(r"\s+", " ", clean_title).strip()
164
+
165
+ is_series = (
166
+ "season" in raw_title.lower()
167
+ or "series" in raw_title.lower()
168
+ or any(
169
+ any(
170
+ "episode" in d["title"].lower()
171
+ or "ep " in d["title"].lower()
172
+ or bool(re.search(r"e\d+", d["title"], re.I))
173
+ for d in (e.get("directLinks") or [])
174
+ )
175
+ for e in episodes
176
+ )
177
+ )
178
+
179
+ return {
180
+ "title": clean_title or raw_title,
181
+ "image": image,
182
+ "imdbId": "",
183
+ "synopsis": clean_title or raw_title,
184
+ "type": "series" if is_series else "movie",
185
+ "linkList": [
186
+ {**item, "title": format_season_title(item["title"])}
187
+ for item in episodes
188
+ ],
189
+ "webUrl": url,
190
+ }
191
+ except Exception as err:
192
+ throw_provider_error("UHDMovies", "metadata", err)
193
+ return {}
194
+
195
+ def _bypass_thenaukriadda(self, initial_url: str) -> str:
196
+ headers = {"Referer": "https://uhdmovies.my/"}
197
+ res1 = self.session.get(initial_url, headers=headers, timeout=self.timeout)
198
+ res1.raise_for_status()
199
+ html1 = res1.text
200
+
201
+ red1 = re.search(r"""location\.replace\(["']([^"']+)["']\)""", html1)
202
+ if red1 and "thenaukriadda" not in red1.group(1):
203
+ return red1.group(1).replace("\\", "")
204
+
205
+ if not res1.cookies:
206
+ self.session.cookies.set("lp_ck_test", "1")
207
+
208
+ doc1 = parse_html(html1)
209
+ form1 = doc1.select_one("form")
210
+ action1 = (form1.attr("action") if form1 else "") or initial_url.split("?")[0]
211
+ action1 = urljoin(initial_url, action1)
212
+
213
+ lp_in = form1.select_one("input[name='_lp_http']") if form1 else None
214
+ wp_in = form1.select_one("input[name='_wp_http']") if form1 else None
215
+ any_in = form1.select_one("input") if form1 else None
216
+ input1 = (
217
+ (lp_in.attr("value") if lp_in else "")
218
+ or (wp_in.attr("value") if wp_in else "")
219
+ or (any_in.attr("value") if any_in else "")
220
+ or (initial_url.split("sid=", 1)[1] if "sid=" in initial_url else "")
221
+ )
222
+ if not input1:
223
+ return initial_url
224
+
225
+ input_name1 = "_lp_http" if lp_in is not None else "_wp_http"
226
+ parsed1 = urlparse(action1)
227
+ res2 = self.session.post(
228
+ action1,
229
+ data={input_name1: input1},
230
+ headers={
231
+ **headers,
232
+ "Referer": initial_url,
233
+ "Origin": f"{parsed1.scheme}://{parsed1.netloc}",
234
+ },
235
+ timeout=self.timeout,
236
+ )
237
+ res2.raise_for_status()
238
+ html2 = res2.text
239
+ doc2 = parse_html(html2)
240
+ form2 = doc2.select_one("#lp-s1-form, form[id*='lp-'], form[id*='wp-']")
241
+ action2 = form2.attr("action") if form2 else ""
242
+ if not action2:
243
+ m = re.search(r'setAttribute\("href",\s*"(.*?)"', html2)
244
+ return m.group(1) if m else initial_url
245
+ action2 = urljoin(action1, action2)
246
+
247
+ params2: dict[str, str] = {}
248
+ if form2 is not None:
249
+ for inp in form2.select("input"):
250
+ name = inp.attr("name")
251
+ if name:
252
+ params2[name] = inp.attr("value")
253
+
254
+ parsed2 = urlparse(action2)
255
+ res3 = self.session.post(
256
+ action2,
257
+ data=params2,
258
+ headers={
259
+ **headers,
260
+ "Referer": action1,
261
+ "Origin": f"{parsed2.scheme}://{parsed2.netloc}",
262
+ },
263
+ timeout=self.timeout,
264
+ )
265
+ res3.raise_for_status()
266
+ html3 = res3.text
267
+ sc_m = re.search(r"""sc\(["']([^"']+)["'],\s*["']([^"']+)["']""", html3)
268
+ if not sc_m:
269
+ go_m = re.search(r"""href=["'](https?://[^"']+\?lp_go=[^"']+)["']""", html3)
270
+ if go_m:
271
+ return go_m.group(1)
272
+ rep_m = re.search(r"""location\.replace\(["']([^"']+)["']\)""", html3)
273
+ if rep_m:
274
+ return rep_m.group(1).replace("\\", "")
275
+ return action2
276
+
277
+ token_name, token_val = sc_m.group(1), sc_m.group(2)
278
+ origin2 = f"{parsed2.scheme}://{parsed2.netloc}"
279
+ lp_go_url = f"{origin2}/?lp_go={token_name}"
280
+ self.session.cookies.set(token_name, token_val, domain=parsed2.hostname)
281
+
282
+ res4 = self.session.get(
283
+ lp_go_url,
284
+ headers={**headers, "Referer": action2},
285
+ timeout=self.timeout,
286
+ )
287
+ res4.raise_for_status()
288
+ rep_m = re.search(r"""location\.replace\(["']([^"']+)["']\)""", res4.text)
289
+ if rep_m:
290
+ return rep_m.group(1).replace("\\", "")
291
+ return res4.url or lp_go_url
292
+
293
+ def _extract_streams_from_driveseed(self, drive_url: str) -> list[dict[str, Any]]:
294
+ streams: list[dict[str, Any]] = []
295
+ added_urls: set[str] = set()
296
+
297
+ def _add(server: str, link: str) -> None:
298
+ if link and link.startswith("http") and link not in added_urls:
299
+ added_urls.add(link)
300
+ streams.append({"server": server, "link": link, "type": "mkv"})
301
+
302
+ file_url = drive_url
303
+ if "/r?" in drive_url:
304
+ try:
305
+ html = self.fetch_text(
306
+ drive_url, headers={"Referer": "https://en.thenaukriadda.in/"}
307
+ )
308
+ m = re.search(r"""location\.replace\(["']([^"']+)["']\)""", html)
309
+ if m:
310
+ file_url = urljoin(drive_url, m.group(1).replace("\\", ""))
311
+ except Exception:
312
+ pass
313
+
314
+ try:
315
+ file_html = self.fetch_text(file_url, headers={"Referer": drive_url})
316
+ file_doc = parse_html(file_html)
317
+
318
+ # 1. Resume Cloud (/zfile)
319
+ try:
320
+ zfile_url = file_url.replace("/file/", "/zfile/")
321
+ z_doc = self.fetch_html(zfile_url, headers={"Referer": file_url})
322
+ for a_el in z_doc.select("a"):
323
+ href = a_el.attr("href")
324
+ if href and (
325
+ "workers.dev" in href
326
+ or "r2.dev" in href
327
+ or "drive.google.com" in href
328
+ or re.search(r"\.(mp4|mkv|m3u8)($|\?)", href, re.I)
329
+ ):
330
+ srv = (
331
+ "Google Drive"
332
+ if "drive.google.com" in href
333
+ else "Resume Cloud (Fast)"
334
+ )
335
+ _add(srv, href)
336
+ for media_el in z_doc.select("iframe, video, source"):
337
+ src = media_el.attr("src")
338
+ if src:
339
+ m = re.search(r"""link=(https?://[^&"']+)""", src)
340
+ if m:
341
+ _add("Direct Stream", m.group(1))
342
+ except Exception:
343
+ pass
344
+
345
+ for a_el in file_doc.select("a"):
346
+ href = a_el.attr("href")
347
+ if href and (
348
+ "workers.dev" in href
349
+ or "r2.dev" in href
350
+ or "drive.google.com" in href
351
+ or re.search(r"\.(mp4|mkv|m3u8)($|\?)", href, re.I)
352
+ ):
353
+ srv = (
354
+ "Google Drive"
355
+ if "drive.google.com" in href
356
+ else "Direct File Stream"
357
+ )
358
+ _add(srv, href)
359
+
360
+ # 2. Instant Download (.btn-danger)
361
+ try:
362
+ inst_el = file_doc.select_one(".btn-danger, a:contains('Instant Download')")
363
+ inst_href = inst_el.attr("href") if inst_el else ""
364
+ if inst_href and inst_href.startswith("http"):
365
+ added = False
366
+ if "url=" in inst_href:
367
+ direct_part = unquote(inst_href.split("url=", 1)[1])
368
+ if direct_part.startswith("http"):
369
+ _add("Instant Download", direct_part)
370
+ added = True
371
+ if not added:
372
+ v_res = self.session.get(
373
+ inst_href,
374
+ headers={"Referer": file_url},
375
+ allow_redirects=False,
376
+ timeout=self.timeout,
377
+ )
378
+ loc = v_res.headers.get("location", "")
379
+ if loc:
380
+ if "url=" in loc:
381
+ _add("Instant Download", unquote(loc.split("url=", 1)[1]))
382
+ elif "googleusercontent.com" in loc or loc.startswith("http"):
383
+ _add("Instant Download", loc)
384
+ else:
385
+ up_m = re.search(
386
+ r"""window\.location\.href\s*=\s*["']([^"']+)["']""",
387
+ v_res.text,
388
+ )
389
+ if up_m:
390
+ up_url = urljoin(inst_href, up_m.group(1))
391
+ up_res = self.session.get(
392
+ up_url,
393
+ headers={"Referer": inst_href},
394
+ allow_redirects=False,
395
+ timeout=self.timeout,
396
+ )
397
+ loc2 = up_res.headers.get("location", "")
398
+ if loc2 and loc2.startswith("http"):
399
+ _add("Instant Download", loc2)
400
+ else:
401
+ up_doc = parse_html(up_res.text)
402
+ dl_btn = up_doc.select_one(
403
+ "#downloadBtn, a.btn-danger, a.btn-success"
404
+ )
405
+ dl_href = dl_btn.attr("href") if dl_btn else ""
406
+ if dl_href.startswith("http"):
407
+ _add("Instant Download", dl_href)
408
+ except Exception:
409
+ pass
410
+
411
+ # 3. Fallback worker links (/wfile?type=1,2)
412
+ for t in (1, 2):
413
+ try:
414
+ w_url = f"{file_url.replace('/file/', '/wfile/')}?type={t}"
415
+ w_doc = self.fetch_html(w_url, headers={"Referer": file_url})
416
+ for idx, a_el in enumerate(w_doc.select(".btn-success, a.btn")):
417
+ href = a_el.attr("href")
418
+ if href:
419
+ _add(f"Worker {t}.{idx + 1}", href)
420
+ except Exception:
421
+ pass
422
+ except Exception:
423
+ pass
424
+
425
+ if not streams:
426
+ try:
427
+ for s in gdflix_extractor(file_url, self.session):
428
+ _add(s.get("server") or "GDFlix", s.get("link") or "")
429
+ except Exception:
430
+ pass
431
+
432
+ return streams
433
+
434
+ def get_stream(
435
+ self,
436
+ url: str,
437
+ is_download: bool = False,
438
+ media_type: str = "movie",
439
+ ) -> list[dict[str, Any]]:
440
+ try:
441
+ target_url = url
442
+ if "thenaukriadda" in url or "sid=" in url:
443
+ try:
444
+ bypassed = self._bypass_thenaukriadda(url)
445
+ if bypassed:
446
+ target_url = bypassed
447
+ except Exception:
448
+ pass
449
+
450
+ if "hubcloud" in target_url:
451
+ return hubcloud_extractor(
452
+ target_url,
453
+ self.session,
454
+ is_download=is_download,
455
+ provider_value="UHDMovies",
456
+ kv_store=self.kv,
457
+ )
458
+
459
+ if "gdflix" in target_url:
460
+ return gdflix_extractor(target_url, self.session)
461
+
462
+ if (
463
+ "driveseed" in target_url
464
+ or "driveleech" in target_url
465
+ or "appdrive" in target_url
466
+ ):
467
+ drive_streams = self._extract_streams_from_driveseed(target_url)
468
+ if drive_streams:
469
+ return drive_streams
470
+
471
+ if re.search(r"\.(mp4|mkv|m3u8|avi)($|\?)", target_url, re.I):
472
+ return [
473
+ {
474
+ "server": "Direct Stream",
475
+ "link": target_url,
476
+ "type": "m3u8" if ".m3u8" in target_url else "mkv",
477
+ }
478
+ ]
479
+
480
+ return []
481
+ except Exception as err:
482
+ throw_provider_error("UHDMovies", "stream", err)
483
+ return []