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,220 @@
1
+ """Unified interactive CLI flow for all Vega providers."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Callable
6
+
7
+ from rich.prompt import Confirm, IntPrompt, Prompt
8
+
9
+ from .display import console, print_meta, print_posts, print_providers, print_streams
10
+ from .player import launch_vlc
11
+ from .providers import get_provider, list_providers
12
+
13
+
14
+ def _clamp_choice(index_1_based: int, length: int) -> int:
15
+ return max(0, min(index_1_based - 1, length - 1))
16
+
17
+
18
+ def _configure_settings(client: Any) -> None:
19
+ schema = client.get_settings_schema()
20
+ if not schema:
21
+ console.print("[yellow]This provider has no configurable settings.[/yellow]")
22
+ return
23
+
24
+ for field in schema:
25
+ key = field["key"]
26
+ label = field.get("label", key)
27
+ default = field.get("defaultValue", "")
28
+ cur = client.kv.get(key, default)
29
+ if cur is None:
30
+ cur = default
31
+
32
+ ftype = field.get("type", "text")
33
+ if ftype == "toggle":
34
+ new_val: Any = Confirm.ask(f"{label} ({key})", default=bool(cur))
35
+ elif ftype == "select" and field.get("options"):
36
+ opts = [o["value"] for o in field["options"]]
37
+ default_opt = str(cur) if str(cur) in opts else opts[0]
38
+ new_val = Prompt.ask(f"{label} ({key})", choices=opts, default=default_opt)
39
+ else:
40
+ new_val = Prompt.ask(f"{label} ({key})", default=str(cur)).strip()
41
+ client.kv.set(key, new_val)
42
+ console.print("[green]Settings updated.[/green]")
43
+
44
+
45
+ def _browse_and_play(
46
+ *,
47
+ client: Any,
48
+ fetch_page: Callable[[int], list[dict[str, str]]],
49
+ provider_label: str,
50
+ ) -> None:
51
+ """Shared pagination -> post -> meta -> link/episode -> stream -> VLC flow."""
52
+ page = 1
53
+ while True:
54
+ items = fetch_page(page)
55
+ if not items:
56
+ console.print(f"[yellow]No {provider_label} results found.[/yellow]")
57
+ return
58
+
59
+ print_posts(items, f"{provider_label} Results (page {page})")
60
+ sel = Prompt.ask(
61
+ "Select # (or [n]ext page, [p]rev page, [b]ack)",
62
+ default="1",
63
+ ).strip().lower()
64
+ if sel == "b":
65
+ return
66
+ if sel == "n":
67
+ page += 1
68
+ continue
69
+ if sel == "p":
70
+ page = max(1, page - 1)
71
+ continue
72
+ if not sel.isdigit():
73
+ console.print("[red]Enter a valid number, n, p, or b.[/red]")
74
+ continue
75
+
76
+ post = items[_clamp_choice(int(sel), len(items))]
77
+ info = client.get_meta(post["link"])
78
+ print_meta(info)
79
+ links = info.get("linkList") or []
80
+ if not links:
81
+ console.print("[yellow]No links found.[/yellow]")
82
+ continue
83
+
84
+ link_idx = IntPrompt.ask("Select link # (0 to go back)", default=1)
85
+ if link_idx <= 0:
86
+ continue
87
+ chosen = links[_clamp_choice(link_idx, len(links))]
88
+
89
+ if "directLinks" in chosen and chosen["directLinks"]:
90
+ target_url = chosen["directLinks"][0]["link"]
91
+ media_type = chosen["directLinks"][0].get("type") or info.get("type", "movie")
92
+ elif "episodesLink" in chosen:
93
+ episodes = client.get_episodes(
94
+ chosen["episodesLink"], imdb_id=info.get("imdbId", "")
95
+ )
96
+ if not episodes:
97
+ console.print("[yellow]No episodes found.[/yellow]")
98
+ continue
99
+ for idx, ep in enumerate(episodes, start=1):
100
+ console.print(f" [cyan]{idx}[/cyan]. {ep['title']}")
101
+ ep_idx = IntPrompt.ask("Select episode # (0 to go back)", default=1)
102
+ if ep_idx <= 0:
103
+ continue
104
+ target_url = episodes[_clamp_choice(ep_idx, len(episodes))]["link"]
105
+ media_type = info.get("type", "series")
106
+ else:
107
+ console.print("[yellow]Unsupported link format.[/yellow]")
108
+ continue
109
+
110
+ is_dl = (
111
+ Confirm.ask("Prioritize download servers?", default=False)
112
+ if client.name == "drive"
113
+ else False
114
+ )
115
+ streams = client.get_stream(target_url, is_download=is_dl, media_type=media_type)
116
+ if not streams:
117
+ console.print("[yellow]No streams found.[/yellow]")
118
+ return
119
+
120
+ print_streams(streams, title=f"{provider_label} Streams", include_type=False)
121
+ vlc_idx = IntPrompt.ask("Play in VLC? (stream # or 0 to skip)", default=1)
122
+ if vlc_idx > 0:
123
+ chosen_stream = streams[_clamp_choice(vlc_idx, len(streams))]
124
+ launch_vlc(chosen_stream["link"], title=info.get("title", ""))
125
+ return
126
+
127
+
128
+ def _interactive_provider(client: Any, display_name: str) -> None:
129
+ while True:
130
+ cat_data = client.get_catalog()
131
+ catalog = cat_data.get("catalog") or []
132
+ genres = cat_data.get("genres") or []
133
+ schema = client.get_settings_schema()
134
+
135
+ choices = ["search"]
136
+ if catalog:
137
+ choices.append("catalog")
138
+ if genres:
139
+ choices.append("genres")
140
+ if schema:
141
+ choices.append("settings")
142
+ choices.append("back")
143
+
144
+ mode = Prompt.ask(f"\n[{display_name}] Choose action", choices=choices, default="search")
145
+ if mode == "back":
146
+ return
147
+
148
+ try:
149
+ if mode == "settings":
150
+ _configure_settings(client)
151
+ continue
152
+
153
+ if mode in ("catalog", "genres"):
154
+ source = catalog if mode == "catalog" else genres
155
+ for idx, item in enumerate(source, start=1):
156
+ console.print(f" [cyan]{idx}[/cyan]. {item['title']}")
157
+ label = "genre" if mode == "genres" else "category"
158
+ choice = IntPrompt.ask(f"Select {label}", default=1)
159
+ selected_filter = source[_clamp_choice(choice, len(source))]["filter"]
160
+ fetch_page = lambda page, f=selected_filter: client.get_posts(
161
+ filter_path=f, page=page
162
+ )
163
+ else:
164
+ query = Prompt.ask("Search query").strip()
165
+ if not query:
166
+ continue
167
+ fetch_page = lambda page, q=query: client.get_search_posts(query=q, page=page)
168
+
169
+ _browse_and_play(
170
+ client=client,
171
+ fetch_page=fetch_page,
172
+ provider_label=display_name,
173
+ )
174
+ except Exception as exc:
175
+ console.print(f"[red]Error: {exc}")
176
+
177
+
178
+ def _pick_provider() -> dict[str, Any] | None:
179
+ providers = list_providers(include_disabled=False)
180
+ print_providers(providers)
181
+ by_id = {p["value"]: p for p in providers}
182
+
183
+ while True:
184
+ raw = Prompt.ask(
185
+ "Choose provider # or ID (or [a]ll incl. disabled, [q]uit)",
186
+ default="drive",
187
+ ).strip()
188
+ if raw.lower() in ("q", "quit", "exit"):
189
+ return None
190
+ if raw.lower() in ("a", "all"):
191
+ providers = list_providers(include_disabled=True)
192
+ print_providers(providers)
193
+ by_id = {p["value"]: p for p in providers}
194
+ continue
195
+ if raw.isdigit():
196
+ return providers[_clamp_choice(int(raw), len(providers))]
197
+ if raw in by_id:
198
+ return by_id[raw]
199
+ matches = [p for p in providers if raw.lower() in p["value"].lower()]
200
+ if len(matches) == 1:
201
+ return matches[0]
202
+ if matches:
203
+ print_providers(matches)
204
+ continue
205
+ console.print(f"[red]Unknown provider '{raw}'.[/red]")
206
+
207
+
208
+ def run_interactive(provider_name: str | None = None) -> None:
209
+ """Launch an interactive search/browse/stream session."""
210
+ if provider_name:
211
+ client = get_provider(provider_name)
212
+ _interactive_provider(client, provider_name)
213
+ return
214
+
215
+ while True:
216
+ picked = _pick_provider()
217
+ if not picked:
218
+ break
219
+ client = get_provider(picked["value"])
220
+ _interactive_provider(client, picked.get("display_name") or picked["value"])
vega_cli/player.py ADDED
@@ -0,0 +1,82 @@
1
+ from __future__ import annotations
2
+
3
+ import shutil
4
+ import subprocess
5
+ from pathlib import Path
6
+
7
+ import requests
8
+ from rich.console import Console
9
+
10
+ from .config import DEFAULT_HEADERS
11
+
12
+ console = Console()
13
+
14
+
15
+ def launch_vlc(url: str, title: str = "") -> None:
16
+ """Validate a media URL, then launch it with VLC or macOS LaunchServices."""
17
+ try:
18
+ probe = requests.get(
19
+ url,
20
+ headers={**DEFAULT_HEADERS, "Range": "bytes=0-4095"},
21
+ timeout=5,
22
+ stream=True,
23
+ allow_redirects=True,
24
+ )
25
+ try:
26
+ sample = next(probe.iter_content(chunk_size=4096), b"")
27
+ finally:
28
+ probe.close()
29
+ sample_text = (
30
+ sample.decode("utf-8", errors="ignore")
31
+ if isinstance(sample, bytes)
32
+ else str(sample)
33
+ )
34
+ if "NotEntitled" in sample_text or "Please enable R2" in sample_text:
35
+ console.print("[red]This Cloudflare R2 stream is unavailable.[/red]")
36
+ console.print("Choose another server instead.")
37
+ console.print(f"R2 URL: {url}")
38
+ return
39
+ except requests.RequestException:
40
+ pass
41
+
42
+ vlc_bin = shutil.which("vlc")
43
+ if not vlc_bin:
44
+ candidates = (
45
+ Path("/Applications/VLC.app/Contents/MacOS/VLC"),
46
+ Path.home() / "Applications" / "VLC.app" / "Contents" / "MacOS" / "VLC",
47
+ )
48
+ vlc_bin = next((str(path) for path in candidates if path.is_file()), None)
49
+
50
+ if vlc_bin:
51
+ cmd = [vlc_bin]
52
+ if title:
53
+ cmd.append(f"--meta-title={title}")
54
+ cmd.append(url)
55
+ try:
56
+ subprocess.Popen(
57
+ cmd,
58
+ stdout=subprocess.DEVNULL,
59
+ stderr=subprocess.DEVNULL,
60
+ start_new_session=True,
61
+ )
62
+ console.print(f"[green]Launched VLC:[/green] {url}")
63
+ return
64
+ except OSError as exc:
65
+ console.print(f"[yellow]Could not launch VLC: {exc}[/yellow]")
66
+
67
+ open_bin = shutil.which("open")
68
+ if open_bin:
69
+ try:
70
+ subprocess.Popen(
71
+ [open_bin, "-a", "VLC", url],
72
+ stdout=subprocess.DEVNULL,
73
+ stderr=subprocess.DEVNULL,
74
+ start_new_session=True,
75
+ )
76
+ console.print(f"[green]Launched VLC:[/green] {url}")
77
+ return
78
+ except OSError:
79
+ pass
80
+
81
+ console.print("[red]VLC was not found. Install VLC or open this URL manually:[/red]")
82
+ console.print(url)
@@ -0,0 +1,13 @@
1
+ """Pure-Python provider clients and registry for Vega CLI."""
2
+
3
+ from .drive import DriveClient
4
+ from .netflix_mirror import NetflixMirrorClient
5
+ from .registry import get_provider, list_providers, load_manifest
6
+
7
+ __all__ = [
8
+ "DriveClient",
9
+ "NetflixMirrorClient",
10
+ "get_provider",
11
+ "list_providers",
12
+ "load_manifest",
13
+ ]