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,504 @@
1
+ """Pure-Python implementation of the Vega 'animeworld' provider."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import re
6
+ from concurrent.futures import ThreadPoolExecutor
7
+ from typing import Any
8
+ from urllib.parse import parse_qs, quote, unquote, urlencode, urljoin, urlparse
9
+
10
+ from ..html import parse_html
11
+ from .common import COMMON_HEADERS, BaseProvider, get_base_url
12
+ from .common.extractors import abbasy_extractor, zypter_extractor
13
+
14
+ _POST_HEADERS = {
15
+ "Referer": "https://www.google.com",
16
+ "User-Agent": (
17
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
18
+ "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
19
+ ),
20
+ "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
21
+ "Accept-Language": "en-US,en;q=0.9",
22
+ "Pragma": "no-cache",
23
+ "Cache-Control": "no-cache",
24
+ }
25
+
26
+ _META_HEADERS = {
27
+ "Accept": (
28
+ "text/html,application/xhtml+xml,application/xml;q=0.9,"
29
+ "image/avif,image/webp,image/apng,*/*;q=0.8,signed-exchange;v=b3;q=0.7"
30
+ ),
31
+ "Cache-Control": "no-store",
32
+ "Accept-Language": "en-US,en;q=0.9",
33
+ "DNT": "1",
34
+ "Cookie": (
35
+ "xla=s4t; _ga=GA1.1.1081149560.1756378968; "
36
+ "_ga_BLZGKYN5PF=GS2.1.s1756378968$o1$g1$t1756378984$j44$l0$h0"
37
+ ),
38
+ "Upgrade-Insecure-Requests": "1",
39
+ "User-Agent": (
40
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
41
+ "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
42
+ ),
43
+ }
44
+
45
+ _EP_HEADERS = {
46
+ "Accept": (
47
+ "text/html,application/xhtml+xml,application/xml;q=0.9,"
48
+ "image/avif,image/webp,image/apng,*/*;q=0.8"
49
+ ),
50
+ "Accept-Language": "en-US,en;q=0.9",
51
+ "User-Agent": (
52
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
53
+ "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
54
+ ),
55
+ }
56
+
57
+
58
+ def _make_absolute(url: str, base: str) -> str:
59
+ if not url:
60
+ return ""
61
+ if url.startswith(("http://", "https://")):
62
+ return url
63
+ return urljoin(base, url)
64
+
65
+
66
+ class AnimeworldClient(BaseProvider):
67
+ """Pure-Python implementation of the Vega 'animeworld' provider."""
68
+
69
+ name = "animeworld"
70
+ catalog = [
71
+ {"title": "Trending", "filter": ""},
72
+ {"title": "Series", "filter": "series/"},
73
+ ]
74
+ genres: list[dict[str, str]] = []
75
+ settings_schema = [
76
+ {
77
+ "key": "audio",
78
+ "type": "select",
79
+ "label": "Audio Language",
80
+ "description": "Preferred audio track when multiple are available",
81
+ "options": [
82
+ {"label": "Hindi", "value": "hindi"},
83
+ {"label": "English", "value": "english"},
84
+ {"label": "Tamil", "value": "tamil"},
85
+ {"label": "Telugu", "value": "telugu"},
86
+ {"label": "Japanese", "value": "japanese"},
87
+ {"label": "Dual Audio", "value": "dual"},
88
+ ],
89
+ "defaultValue": "hindi",
90
+ },
91
+ {
92
+ "key": "quality",
93
+ "type": "select",
94
+ "label": "Preferred Quality",
95
+ "options": [
96
+ {"label": "1080p", "value": "1080p"},
97
+ {"label": "720p", "value": "720p"},
98
+ {"label": "480p", "value": "480p"},
99
+ ],
100
+ "defaultValue": "1080p",
101
+ },
102
+ {
103
+ "key": "autoPlay",
104
+ "type": "toggle",
105
+ "label": "Auto Play",
106
+ "defaultValue": True,
107
+ },
108
+ {
109
+ "key": "baseUrl",
110
+ "type": "text",
111
+ "label": "Base URL",
112
+ "description": "Override default domain if it changes",
113
+ "defaultValue": "https://watchanimeworld.one",
114
+ "placeholder": "https://watchanimeworld.one",
115
+ },
116
+ {
117
+ "key": "requestTimeout",
118
+ "type": "number",
119
+ "label": "Request Timeout (ms)",
120
+ "defaultValue": 30000,
121
+ "min": 5000,
122
+ "max": 120000,
123
+ },
124
+ ]
125
+
126
+ def _fetch_posts(
127
+ self, filter_path: str = "", query: str = "", page: int = 1
128
+ ) -> list[dict[str, str]]:
129
+ try:
130
+ base_url = (
131
+ get_base_url("animeworld", session=self.session)
132
+ or "https://watchanimeworld.one"
133
+ ).rstrip("/")
134
+
135
+ if query.strip():
136
+ paged = f"&paged={page}" if page > 1 else ""
137
+ url = f"{base_url}/?s={quote(query)}{paged}"
138
+ elif filter_path:
139
+ clean_filter = filter_path.strip("/")
140
+ url = (
141
+ f"{base_url}/{clean_filter}/page/{page}"
142
+ if page > 1
143
+ else f"{base_url}/{clean_filter}"
144
+ )
145
+ else:
146
+ url = f"{base_url}/page/{page}" if page > 1 else base_url
147
+
148
+ doc = self.fetch_html(url, headers=_POST_HEADERS)
149
+ post_selectors = (
150
+ ".anime-blog, article, li.post, .swiper-slide li, "
151
+ ".latest-movies-series-swiper-slide li, ul.post-lst li"
152
+ )
153
+ seen: set[str] = set()
154
+ posts: list[dict[str, str]] = []
155
+
156
+ for card in doc.select(post_selectors):
157
+ raw_link = ""
158
+ for sel in ("a.lnk-blk[href]", ".action-overlay a[href]", "a[href]"):
159
+ el = card.select_one(sel)
160
+ if el and el.attr("href"):
161
+ raw_link = el.attr("href")
162
+ break
163
+ if not raw_link:
164
+ continue
165
+ link = raw_link if raw_link.startswith("http") else urljoin(f"{base_url}/", raw_link)
166
+ if link in seen:
167
+ continue
168
+
169
+ img_el = card.select_one("img")
170
+ a_els = card.select("a[href]")
171
+ h2_t = card.select_one("h2.entry-title")
172
+ et_t = card.select_one(".entry-title")
173
+ p_t = card.select_one("p[style*='medium']")
174
+ raw_title = (
175
+ (h2_t.text().strip() if h2_t else "")
176
+ or (et_t.text().strip() if et_t else "")
177
+ or (img_el.attr("alt").strip() if img_el else "")
178
+ or (p_t.text().strip() if p_t else "")
179
+ or (a_els[-1].text().strip() if a_els else "")
180
+ )
181
+ if not raw_title:
182
+ continue
183
+ title = re.sub(r"^Image\s+", "", raw_title).strip()
184
+ if title.startswith("Image "):
185
+ title = title[6:].strip()
186
+
187
+ raw_img = (img_el.attr("data-src") or img_el.attr("src")) if img_el else ""
188
+ image = (
189
+ (raw_img if raw_img.startswith("http") else urljoin(f"{base_url}/", raw_img))
190
+ if raw_img
191
+ else ""
192
+ )
193
+ seen.add(link)
194
+ posts.append({"title": title, "link": link, "image": image})
195
+
196
+ limit = 20 if page == 1 else 100
197
+ return posts[:limit]
198
+ except Exception:
199
+ return []
200
+
201
+ def get_posts(self, filter_path: str = "", page: int = 1) -> list[dict[str, str]]:
202
+ return self._fetch_posts(filter_path=filter_path, page=page)
203
+
204
+ def get_search_posts(self, query: str, page: int = 1) -> list[dict[str, str]]:
205
+ return self._fetch_posts(query=query, page=page)
206
+
207
+ def get_meta(self, link: str) -> dict[str, Any]:
208
+ empty: dict[str, Any] = {
209
+ "title": "",
210
+ "synopsis": "",
211
+ "image": "",
212
+ "imdbId": "",
213
+ "type": "series",
214
+ "linkList": [],
215
+ }
216
+ try:
217
+ doc = self.fetch_html(link, headers=_META_HEADERS)
218
+ title_el = (
219
+ doc.select_one(".dfxb.alg-cr .entry-title")
220
+ or doc.select_one("h1.entry-title")
221
+ or doc.select_one("h1.post-title")
222
+ or doc.select_one("title")
223
+ )
224
+ title = title_el.text().strip() if title_el else ""
225
+
226
+ img_el = doc.select_one(".dfxb.alg-cr img[alt]") or doc.select_one("figure img")
227
+ image = img_el.attr("src") if img_el else ""
228
+ if image.startswith("//"):
229
+ image = f"https:{image}"
230
+
231
+ syn_el = doc.select_one(".description p") or doc.select_one(".entry-content p")
232
+ synopsis = syn_el.text().strip() if syn_el else ""
233
+
234
+ is_movie = "/movies/" in link or "/movie/" in link
235
+ link_list: list[dict[str, Any]] = []
236
+ if is_movie:
237
+ link_list.append(
238
+ {
239
+ "title": title or "Play Movie",
240
+ "quality": "Movie",
241
+ "episodesLink": link,
242
+ "directLinks": [],
243
+ }
244
+ )
245
+ else:
246
+ seasons: set[int] = set()
247
+ for el in doc.select(".choose-season .aa-cnt li a"):
248
+ ds = el.attr("data-season")
249
+ if ds.isdigit() and int(ds) > 0:
250
+ seasons.add(int(ds))
251
+ for el in doc.select("#episode_by_temp .post.episodes"):
252
+ ne = el.select_one(".num-epi")
253
+ m = re.search(r"(\d+)x(\d+)", ne.text() if ne else "")
254
+ if m:
255
+ seasons.add(int(m.group(1)))
256
+ sorted_seasons = sorted(seasons)
257
+ if sorted_seasons:
258
+ for s in sorted_seasons:
259
+ link_list.append(
260
+ {
261
+ "title": f"Season {s}",
262
+ "quality": f"S{s}",
263
+ "episodesLink": f"watchanimeworld://season?url={quote(link, safe='')}&season={s}",
264
+ "directLinks": [],
265
+ }
266
+ )
267
+ else:
268
+ link_list.append(
269
+ {
270
+ "title": title or "Watch",
271
+ "quality": "Series",
272
+ "episodesLink": link,
273
+ "directLinks": [],
274
+ }
275
+ )
276
+
277
+ return {
278
+ "title": title,
279
+ "synopsis": synopsis,
280
+ "image": image,
281
+ "imdbId": "",
282
+ "type": "movie" if is_movie else "series",
283
+ "linkList": link_list,
284
+ }
285
+ except Exception:
286
+ return empty
287
+
288
+ def get_episodes(
289
+ self,
290
+ url: str,
291
+ imdb_id: str = "",
292
+ season: int | None = None,
293
+ ) -> list[dict[str, Any]]:
294
+ page_url = url
295
+ target_season = 0
296
+ is_movie = False
297
+
298
+ if url.startswith("watchanimeworld://movie"):
299
+ qs = parse_qs(urlparse(url).query)
300
+ page_url = unquote(qs.get("url", [""])[0])
301
+ is_movie = True
302
+ elif url.startswith("watchanimeworld://season"):
303
+ qs = parse_qs(urlparse(url).query)
304
+ page_url = unquote(qs.get("url", [""])[0])
305
+ s_val = qs.get("season", ["0"])[0]
306
+ target_season = int(s_val) if s_val.isdigit() else 0
307
+ elif "/movies/" in url or "/movie/" in url:
308
+ is_movie = True
309
+
310
+ if not page_url:
311
+ return []
312
+
313
+ try:
314
+ doc = self.fetch_html(page_url, headers=_EP_HEADERS)
315
+ parsed_page = urlparse(page_url)
316
+ origin = f"{parsed_page.scheme}://{parsed_page.netloc}"
317
+
318
+ if is_movie:
319
+ movie_links: list[dict[str, Any]] = []
320
+ seen_links: set[str] = set()
321
+ for sel in (
322
+ ".server-list li a",
323
+ ".servers-list li a",
324
+ "ul#player-list li a",
325
+ ".mirror",
326
+ ".play-button a",
327
+ ".player-options li a",
328
+ ".options-list li a",
329
+ ):
330
+ for el in doc.select(sel):
331
+ href = el.attr("href") or el.attr("data-url")
332
+ if not href:
333
+ continue
334
+ full = href if href.startswith("http") else urljoin(page_url, href)
335
+ if full == page_url or full.endswith("#") or full in seen_links:
336
+ continue
337
+ seen_links.add(full)
338
+ label = el.text().strip() or el.attr("title").strip() or "Play Movie"
339
+ movie_links.append({"title": label, "link": full})
340
+ if not movie_links:
341
+ movie_links.append({"title": "Play", "link": page_url})
342
+ return movie_links
343
+
344
+ post_el = doc.select_one(".choose-season .aa-cnt li a[data-post]")
345
+ post_id = post_el.attr("data-post") if post_el else ""
346
+ if not post_id:
347
+ art = doc.select_one("article.post")
348
+ if art and art.attr("id"):
349
+ post_id = art.attr("id").replace("post-", "")
350
+
351
+ episodes: list[dict[str, Any]] = []
352
+
353
+ if post_id and target_season:
354
+ try:
355
+ resp = self.session.post(
356
+ f"{origin}/wp-admin/admin-ajax.php",
357
+ data=urlencode(
358
+ {
359
+ "action": "action_select_season",
360
+ "post": post_id,
361
+ "season": str(target_season),
362
+ }
363
+ ),
364
+ headers={
365
+ **_EP_HEADERS,
366
+ "Content-Type": "application/x-www-form-urlencoded",
367
+ "Referer": page_url,
368
+ "X-Requested-With": "XMLHttpRequest",
369
+ },
370
+ timeout=self.timeout,
371
+ )
372
+ resp.raise_for_status()
373
+ ajax_html = ""
374
+ try:
375
+ j = resp.json()
376
+ if isinstance(j, dict):
377
+ ajax_html = j.get("data") or j.get("html") or j.get("episodes") or ""
378
+ except Exception:
379
+ ajax_html = resp.text
380
+
381
+ if isinstance(ajax_html, str) and ajax_html.strip():
382
+ a_doc = parse_html(ajax_html)
383
+ for li in a_doc.select("li"):
384
+ art = li.select_one("article.episodes") or li
385
+ a_el = art.select_one("a.lnk-blk") or art.select_one("a")
386
+ href = a_el.attr("href") if a_el else ""
387
+ if not href:
388
+ continue
389
+ ne = art.select_one(".num-epi")
390
+ m = re.search(r"(\d+)x(\d+)", ne.text().strip() if ne else "")
391
+ if not m:
392
+ continue
393
+ s_num, ep_num = int(m.group(1)), int(m.group(2))
394
+ if target_season and s_num != target_season:
395
+ continue
396
+ episodes.append(
397
+ {
398
+ "title": f"Episode {ep_num}",
399
+ "link": href if href.startswith("http") else urljoin(page_url, href),
400
+ }
401
+ )
402
+ except Exception:
403
+ pass
404
+
405
+ if not episodes:
406
+ for li in doc.select("#episode_by_temp li"):
407
+ art = li.select_one("article.episodes")
408
+ if not art:
409
+ continue
410
+ a_el = art.select_one("a.lnk-blk")
411
+ href = a_el.attr("href") if a_el else ""
412
+ if not href:
413
+ continue
414
+ ne = art.select_one(".num-epi")
415
+ m = re.search(r"(\d+)x(\d+)", ne.text().strip() if ne else "")
416
+ if not m:
417
+ continue
418
+ s_num, ep_num = int(m.group(1)), int(m.group(2))
419
+ if target_season and s_num != target_season:
420
+ continue
421
+ episodes.append(
422
+ {
423
+ "title": f"Episode {ep_num}",
424
+ "link": href if href.startswith("http") else urljoin(page_url, href),
425
+ }
426
+ )
427
+
428
+ episodes.sort(
429
+ key=lambda e: int(m.group(0)) if (m := re.search(r"\d+", e["title"])) else 0
430
+ )
431
+ return episodes
432
+ except Exception:
433
+ return []
434
+
435
+ def _get_episode_streams(self, url: str) -> list[dict[str, Any]]:
436
+ try:
437
+ doc = self.fetch_html(url, headers=COMMON_HEADERS, timeout=8)
438
+ iframe_urls: list[str] = []
439
+ for sel in ("#options-0 iframe", "#options-1 iframe"):
440
+ f = doc.select_one(sel)
441
+ if f:
442
+ src = f.attr("data-src") or f.attr("src")
443
+ if src:
444
+ iframe_urls.append(_make_absolute(src, url))
445
+
446
+ if not iframe_urls:
447
+ return [
448
+ {
449
+ "server": "Episode",
450
+ "link": url,
451
+ "type": "iframe",
452
+ "headers": {},
453
+ "subtitles": [],
454
+ }
455
+ ]
456
+
457
+ def _extract(u: str) -> list[dict[str, Any]]:
458
+ try:
459
+ if "zephyrix.org" in u or "zephyr" in u:
460
+ return zypter_extractor(u, session=self.session)
461
+ return abbasy_extractor(u, session=self.session)
462
+ except Exception:
463
+ return []
464
+
465
+ merged: list[dict[str, Any]] = []
466
+ with ThreadPoolExecutor(max_workers=min(len(iframe_urls), 6)) as pool:
467
+ for batch in pool.map(_extract, iframe_urls):
468
+ merged.extend(batch)
469
+
470
+ if not merged:
471
+ return [
472
+ {
473
+ "server": "Episode",
474
+ "link": iframe_urls[0] or url,
475
+ "type": "iframe",
476
+ "headers": {},
477
+ "subtitles": [],
478
+ }
479
+ ]
480
+ return merged
481
+ except Exception:
482
+ return [
483
+ {
484
+ "server": "Episode",
485
+ "link": url,
486
+ "type": "iframe",
487
+ "headers": {},
488
+ "subtitles": [],
489
+ }
490
+ ]
491
+
492
+ def get_stream(
493
+ self,
494
+ url: str,
495
+ is_download: bool = False,
496
+ media_type: str = "movie",
497
+ ) -> list[dict[str, Any]]:
498
+ if any(seg in url for seg in ("/episode/", "/movies/", "/movie/")):
499
+ return self._get_episode_streams(url)
500
+ if "zephyrix.org" in url or "zephyr" in url:
501
+ return zypter_extractor(url, session=self.session)
502
+ if any(m in url for m in ("dub-player", "abyssplayer", "watchanimeworld.one/dub-player")):
503
+ return abbasy_extractor(url, session=self.session)
504
+ return zypter_extractor(url, session=self.session)