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,445 @@
1
+ """Pure-Python implementation of the Vega 'kickAssAnime' provider."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import base64
6
+ import json
7
+ import re
8
+ from concurrent.futures import ThreadPoolExecutor
9
+ from typing import Any
10
+ from urllib.parse import quote, urlparse
11
+
12
+ from .common import BaseProvider
13
+
14
+ _BASE_URL = "https://kaa.lt"
15
+
16
+ _HEADERS = {
17
+ "User-Agent": (
18
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
19
+ "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"
20
+ ),
21
+ "Accept": "application/json, text/plain, */*",
22
+ }
23
+
24
+
25
+ def _format_poster(poster: dict[str, Any] | None) -> str:
26
+ if not isinstance(poster, dict):
27
+ return ""
28
+ if poster.get("hq"):
29
+ return f"{_BASE_URL}/image/poster/{poster['hq']}.webp"
30
+ if poster.get("sm"):
31
+ return f"{_BASE_URL}/image/poster/{poster['sm']}.webp"
32
+ if poster.get("url"):
33
+ url = str(poster["url"])
34
+ return url if url.startswith("http") else f"{_BASE_URL}/{url.lstrip('/')}"
35
+ return ""
36
+
37
+
38
+ def _format_thumbnail(thumbnail: dict[str, Any] | None) -> str | None:
39
+ if not isinstance(thumbnail, dict):
40
+ return None
41
+ if thumbnail.get("hq"):
42
+ return f"{_BASE_URL}/image/thumbnail/{thumbnail['hq']}.webp"
43
+ if thumbnail.get("sm"):
44
+ return f"{_BASE_URL}/image/thumbnail/{thumbnail['sm']}.webp"
45
+ if thumbnail.get("url"):
46
+ url = str(thumbnail["url"])
47
+ return url if url.startswith("http") else f"{_BASE_URL}/{url.lstrip('/')}"
48
+ return None
49
+
50
+
51
+ def _get_lang_label(lang: str) -> str:
52
+ return {
53
+ "ja-JP": "Sub",
54
+ "en-US": "Dub",
55
+ "es-419": "Spanish",
56
+ "es-ES": "Spanish",
57
+ "ko-KR": "Korean",
58
+ "zh-CN": "Chinese",
59
+ }.get(lang, lang)
60
+
61
+
62
+ def _fix_url(raw_url: str, base_url: str) -> str:
63
+ trimmed = raw_url.strip()
64
+ if trimmed.startswith(("https://", "http://")):
65
+ return re.sub(r"^(https?:)//+", r"\1//", trimmed)
66
+ if trimmed.startswith("//"):
67
+ return f"https:{trimmed}"
68
+ if trimmed.startswith("/"):
69
+ try:
70
+ u = urlparse(base_url)
71
+ if u.scheme and u.netloc:
72
+ return f"{u.scheme}://{u.netloc}{trimmed}"
73
+ except Exception:
74
+ pass
75
+ return f"{_BASE_URL}{trimmed}"
76
+ return trimmed
77
+
78
+
79
+ class KickAssAnimeClient(BaseProvider):
80
+ """Pure-Python implementation of the Vega 'kickAssAnime' provider."""
81
+
82
+ name = "kickAssAnime"
83
+ catalog = [
84
+ {"title": "Trending", "filter": "/api/show/trending"},
85
+ {"title": "Popular", "filter": "/api/show/popular"},
86
+ {"title": "Recent (Sub)", "filter": "/api/show/recent?type=sub"},
87
+ {"title": "Recent (Dub)", "filter": "/api/show/recent?type=dub"},
88
+ {"title": "Recent (Chinese)", "filter": "/api/show/recent?type=chinese"},
89
+ {"title": "All Anime", "filter": "/api/anime"},
90
+ ]
91
+ genres = [
92
+ {"title": "Action", "filter": "Action"},
93
+ {"title": "Adventure", "filter": "Adventure"},
94
+ {"title": "Comedy", "filter": "Comedy"},
95
+ {"title": "Drama", "filter": "Drama"},
96
+ {"title": "Ecchi", "filter": "Ecchi"},
97
+ {"title": "Fantasy", "filter": "Fantasy"},
98
+ {"title": "Horror", "filter": "Horror"},
99
+ {"title": "Mahou Shoujo", "filter": "Mahou Shoujo"},
100
+ {"title": "Mecha", "filter": "Mecha"},
101
+ {"title": "Music", "filter": "Music"},
102
+ {"title": "Mystery", "filter": "Mystery"},
103
+ {"title": "Psychological", "filter": "Psychological"},
104
+ {"title": "Romance", "filter": "Romance"},
105
+ {"title": "Sci-Fi", "filter": "Sci-Fi"},
106
+ {"title": "Slice of Life", "filter": "Slice of Life"},
107
+ {"title": "Sports", "filter": "Sports"},
108
+ {"title": "Supernatural", "filter": "Supernatural"},
109
+ {"title": "Suspense", "filter": "Suspense"},
110
+ {"title": "Thriller", "filter": "Thriller"},
111
+ ]
112
+
113
+ def get_posts(self, filter_path: str = "", page: int = 1) -> list[dict[str, str]]:
114
+ if "/api/show/trending" in filter_path:
115
+ url = f"{_BASE_URL}/api/show/trending?page={page}"
116
+ elif "/api/show/popular" in filter_path:
117
+ url = f"{_BASE_URL}/api/show/popular?page={page}"
118
+ elif "/api/show/recent" in filter_path:
119
+ m_type = re.search(r"type=([a-z]+)", filter_path)
120
+ ep_type = m_type.group(1) if m_type else "all"
121
+ url = f"{_BASE_URL}/api/show/recent?type={ep_type}&page={page}"
122
+ elif filter_path.startswith("/api/anime"):
123
+ url = f"{_BASE_URL}/api/anime?page={page}"
124
+ else:
125
+ encoded = base64.b64encode(json.dumps({"genres": [filter_path]}).encode("utf-8")).decode(
126
+ "ascii"
127
+ )
128
+ url = f"{_BASE_URL}/api/anime?page={page}&filters={encoded}"
129
+
130
+ data = self.fetch_json(url, headers=_HEADERS)
131
+ items = (data or {}).get("result") or []
132
+ return [
133
+ {
134
+ "title": item.get("title_en") or item.get("title") or "",
135
+ "link": f"{_BASE_URL}/{item.get('slug', '')}",
136
+ "image": _format_poster(item.get("poster")),
137
+ }
138
+ for item in items
139
+ ]
140
+
141
+ def get_search_posts(self, query: str, page: int = 1) -> list[dict[str, str]]:
142
+ data = self.fetch_json(
143
+ f"{_BASE_URL}/api/fsearch",
144
+ method="POST",
145
+ json_body={"page": page, "query": query},
146
+ headers={
147
+ **_HEADERS,
148
+ "Content-Type": "application/json",
149
+ "Referer": f"{_BASE_URL}/search?q={quote(query)}",
150
+ },
151
+ )
152
+ items = (data or {}).get("result") or []
153
+ return [
154
+ {
155
+ "title": item.get("title_en") or item.get("title") or "",
156
+ "link": f"{_BASE_URL}/{item.get('slug', '')}",
157
+ "image": _format_poster(item.get("poster")),
158
+ }
159
+ for item in items
160
+ ]
161
+
162
+ def get_meta(self, link: str) -> dict[str, Any]:
163
+ slug = re.sub(r"^https?://[^/]+/", "", link).lstrip("/").split("/")[0]
164
+ data = self.fetch_json(f"{_BASE_URL}/api/show/{slug}", headers=_HEADERS) or {}
165
+
166
+ title = data.get("title_en") or data.get("title") or slug
167
+ synopsis = data.get("synopsis") or ""
168
+ image = _format_poster(data.get("poster"))
169
+ media_type = "movie" if data.get("type") == "movie" else "series"
170
+
171
+ languages = ["ja-JP"]
172
+ try:
173
+ lang_data = self.fetch_json(f"{_BASE_URL}/api/show/{slug}/language", headers=_HEADERS)
174
+ res_langs = (lang_data or {}).get("result")
175
+ if isinstance(res_langs, list) and res_langs:
176
+ languages = res_langs
177
+ except Exception:
178
+ pass
179
+
180
+ link_list: list[dict[str, Any]] = []
181
+ for lang in languages:
182
+ try:
183
+ ep_data = self.fetch_json(
184
+ f"{_BASE_URL}/api/show/{slug}/episodes?page=1&lang={lang}", headers=_HEADERS
185
+ ) or {}
186
+ episodes: list[dict[str, Any]] = list(ep_data.get("result") or [])
187
+ pages = ep_data.get("pages") or []
188
+ if len(pages) > 1:
189
+ def _fetch_ep_page(p_num: int) -> list[dict[str, Any]]:
190
+ try:
191
+ r = self.fetch_json(
192
+ f"{_BASE_URL}/api/show/{slug}/episodes?page={p_num}&lang={lang}",
193
+ headers=_HEADERS,
194
+ )
195
+ return list((r or {}).get("result") or [])
196
+ except Exception:
197
+ return []
198
+
199
+ with ThreadPoolExecutor(max_workers=min(len(pages) - 1, 6)) as pool:
200
+ for batch in pool.map(_fetch_ep_page, range(2, len(pages) + 1)):
201
+ episodes.extend(batch)
202
+
203
+ if episodes:
204
+ if lang != "ja-JP":
205
+ try:
206
+ first_ep = episodes[0]
207
+ chk = self.fetch_json(
208
+ f"{_BASE_URL}/api/show/{slug}/episode/ep-{first_ep.get('episode_string')}-{first_ep.get('slug')}",
209
+ headers=_HEADERS,
210
+ )
211
+ if not (chk or {}).get("servers"):
212
+ continue
213
+ except Exception:
214
+ pass
215
+
216
+ direct_links: list[dict[str, Any]] = []
217
+ for ep in episodes:
218
+ ep_str = ep.get("episode_string", "")
219
+ ep_name = ep.get("title")
220
+ ep_title = f"Episode {ep_str}{f' - {ep_name}' if ep_name else ''}"
221
+ entry: dict[str, Any] = {
222
+ "title": ep_title,
223
+ "link": json.dumps(
224
+ {
225
+ "slug": slug,
226
+ "epSlug": ep.get("slug"),
227
+ "epNum": ep_str,
228
+ "lang": lang,
229
+ }
230
+ ),
231
+ "type": media_type,
232
+ }
233
+ thumb = _format_thumbnail(ep.get("thumbnail"))
234
+ if thumb:
235
+ entry["image"] = thumb
236
+ direct_links.append(entry)
237
+
238
+ lang_label = _get_lang_label(lang)
239
+ link_list.append(
240
+ {
241
+ "title": f"Episodes ({lang_label})" if len(languages) > 1 else "Episodes",
242
+ "directLinks": direct_links,
243
+ }
244
+ )
245
+ except Exception:
246
+ pass
247
+
248
+ return {
249
+ "title": title,
250
+ "synopsis": synopsis,
251
+ "image": image,
252
+ "imdbId": "",
253
+ "type": media_type,
254
+ "linkList": link_list,
255
+ "webUrl": f"{_BASE_URL}/{slug}",
256
+ }
257
+
258
+ def get_stream(
259
+ self,
260
+ url: str,
261
+ is_download: bool = False,
262
+ media_type: str = "movie",
263
+ ) -> list[dict[str, Any]]:
264
+ ep_api_url = url
265
+ ep_parsed: dict[str, Any] | None = None
266
+ if url.startswith("{"):
267
+ try:
268
+ parsed = json.loads(url)
269
+ if isinstance(parsed, dict):
270
+ ep_parsed = parsed
271
+ slug = parsed.get("slug", "")
272
+ ep_num = parsed.get("epNum") or "1"
273
+ ep_slug = parsed.get("epSlug")
274
+ ep_api_url = (
275
+ f"{_BASE_URL}/api/show/{slug}/episode/ep-{ep_num}-{ep_slug}"
276
+ if ep_slug
277
+ else f"{_BASE_URL}/api/show/{slug}/episode/ep-{ep_num}"
278
+ )
279
+ except Exception:
280
+ pass
281
+
282
+ servers: list[dict[str, Any]] = []
283
+ try:
284
+ srv_data = self.fetch_json(ep_api_url, headers=_HEADERS) or {}
285
+ servers = list(srv_data.get("servers") or [])
286
+
287
+ if not servers and ep_parsed and ep_parsed.get("slug") and ep_parsed.get("lang") not in (None, "ja-JP"):
288
+ try:
289
+ num = str(ep_parsed.get("epNum") or "1")
290
+ ja_data = self.fetch_json(
291
+ f"{_BASE_URL}/api/show/{ep_parsed['slug']}/episodes?page=1&lang=ja-JP",
292
+ headers=_HEADERS,
293
+ ) or {}
294
+ ja_eps = ja_data.get("result") or []
295
+ matching = next(
296
+ (
297
+ e
298
+ for e in ja_eps
299
+ if str(e.get("episode_string")) == num
300
+ or str(e.get("episode_number")) == num
301
+ ),
302
+ None,
303
+ )
304
+ if matching and matching.get("slug"):
305
+ fb_data = self.fetch_json(
306
+ f"{_BASE_URL}/api/show/{ep_parsed['slug']}/episode/ep-{num}-{matching['slug']}",
307
+ headers=_HEADERS,
308
+ ) or {}
309
+ servers = list(fb_data.get("servers") or [])
310
+ except Exception:
311
+ pass
312
+ except Exception:
313
+ return []
314
+
315
+ if not servers:
316
+ return []
317
+
318
+ streams: list[dict[str, Any]] = []
319
+ for srv in servers:
320
+ src = srv.get("src")
321
+ if not src:
322
+ continue
323
+ try:
324
+ if "/cat-player/vast" in src:
325
+ src = src.replace("/cat-player/vast", "/cat-player/player")
326
+ player_url = _fix_url(src, _BASE_URL)
327
+ html = self.fetch_text(
328
+ player_url, headers={**_HEADERS, "Referer": f"{_BASE_URL}/"}
329
+ )
330
+ clean_html = html.replace(""", '"')
331
+
332
+ m_manifest = re.search(
333
+ r'manifest":\[\d+,"(?:https?:)?(//[^"]+)"]', clean_html
334
+ ) or re.search(r'manifest":\[\d+,"([^"]+)"]', clean_html)
335
+
336
+ if m_manifest:
337
+ raw_manifest = m_manifest.group(1).replace("\\", "")
338
+ manifest_url = _fix_url(raw_manifest, player_url)
339
+ parsed_p = urlparse(player_url)
340
+ origin = (
341
+ f"{parsed_p.scheme}://{parsed_p.netloc}"
342
+ if parsed_p.scheme and parsed_p.netloc
343
+ else _BASE_URL
344
+ )
345
+ hls_headers = {
346
+ "User-Agent": _HEADERS["User-Agent"],
347
+ "Origin": origin,
348
+ "Referer": player_url,
349
+ }
350
+
351
+ subtitles: list[dict[str, Any]] = []
352
+ for t_match in re.finditer(
353
+ r'"language":\[\d+,"([^"]+)"][^}]+?"name":\[\d+,"([^"]+)"][^}]+?"src":\[\d+,"([^"]+)"]',
354
+ clean_html,
355
+ ):
356
+ lang, sub_name, sub_src = t_match.groups()
357
+ sub_url = _fix_url(sub_src.replace("\\", ""), player_url)
358
+ proxy_url = (
359
+ "https://fetch.1proxy.workers.dev/fetch?url="
360
+ f"{quote(sub_url, safe='')}&headers="
361
+ f"{quote(json.dumps(hls_headers), safe='')}"
362
+ )
363
+ is_srt = ".srt" in sub_url.lower()
364
+ subtitles.append(
365
+ {
366
+ "title": f"{sub_name} ({lang})",
367
+ "language": lang,
368
+ "type": "application/x-subrip" if is_srt else "text/vtt",
369
+ "uri": proxy_url,
370
+ }
371
+ )
372
+
373
+ srv_name = srv.get("name", "Server")
374
+ if ".m3u8" in manifest_url:
375
+ master_entry: dict[str, Any] = {
376
+ "server": f"{srv_name} (Auto)",
377
+ "link": manifest_url,
378
+ "type": "m3u8",
379
+ "quality": "auto",
380
+ "headers": hls_headers,
381
+ }
382
+ if subtitles:
383
+ master_entry["subtitles"] = subtitles
384
+ streams.append(master_entry)
385
+
386
+ try:
387
+ m3u8_text = self.fetch_text(manifest_url, headers=hls_headers)
388
+ lines = m3u8_text.splitlines()
389
+ base_url = manifest_url[: manifest_url.rfind("/") + 1]
390
+ for i, raw in enumerate(lines):
391
+ line = raw.strip()
392
+ if line.startswith("#EXT-X-STREAM-INF") and i + 1 < len(lines):
393
+ m_res = re.search(r"RESOLUTION=\d+x(\d+)", line)
394
+ quality = f"{m_res.group(1)}p" if m_res else "unknown"
395
+ nxt = lines[i + 1].strip()
396
+ if nxt and not nxt.startswith("#"):
397
+ stream_url = nxt if nxt.startswith("http") else f"{base_url}{nxt}"
398
+ sub_entry: dict[str, Any] = {
399
+ "server": f"{srv_name} ({quality})",
400
+ "link": stream_url,
401
+ "type": "m3u8",
402
+ "quality": quality,
403
+ "headers": hls_headers,
404
+ }
405
+ if subtitles:
406
+ sub_entry["subtitles"] = subtitles
407
+ streams.append(sub_entry)
408
+ except Exception:
409
+ pass
410
+ elif ".mpd" in manifest_url or "type=dash" in player_url:
411
+ dash_entry: dict[str, Any] = {
412
+ "server": f"{srv_name} (DASH)",
413
+ "link": manifest_url,
414
+ "type": "dash",
415
+ "quality": "auto",
416
+ "headers": hls_headers,
417
+ }
418
+ if subtitles:
419
+ dash_entry["subtitles"] = subtitles
420
+ streams.append(dash_entry)
421
+ continue
422
+
423
+ m_sources = re.search(r"sources:\s*(\[[^\]]+\])", clean_html)
424
+ if m_sources:
425
+ try:
426
+ sources = json.loads(m_sources.group(1))
427
+ srv_name = srv.get("name", "Server")
428
+ for s in sources:
429
+ if isinstance(s, dict) and s.get("file"):
430
+ stream_url = _fix_url(str(s["file"]), player_url)
431
+ label = s.get("label") or "default"
432
+ streams.append(
433
+ {
434
+ "server": f"{srv_name} ({label})",
435
+ "link": stream_url,
436
+ "type": "m3u8" if ".m3u8" in stream_url else "mp4",
437
+ "quality": s.get("label") or "unknown",
438
+ }
439
+ )
440
+ except Exception:
441
+ pass
442
+ except Exception:
443
+ pass
444
+
445
+ return streams