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,479 @@
1
+ """Pure-Python Vega AutoEmbed provider (ported from autoEmbed/)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import re
7
+ from concurrent.futures import ThreadPoolExecutor
8
+ from datetime import datetime, timezone
9
+ from typing import Any
10
+ from urllib.parse import quote
11
+
12
+ from .common import (
13
+ BaseProvider,
14
+ apply_cinemeta_meta,
15
+ enrich_cinemeta_episodes,
16
+ enrich_episodes_with_skip_timings,
17
+ fetch_theintrodb_skip_timings,
18
+ format_episode_title,
19
+ get_cinemeta_meta,
20
+ throw_provider_error,
21
+ )
22
+ from .common.extractors.cinejoy import extract_cinejoy_streams
23
+ from .common.extractors.movy import extract_movy_streams
24
+ from .common.extractors.st111477 import extract_st111477_streams
25
+ from .common.extractors.vidstuck import extract_vidstuck_streams
26
+
27
+ POSTERS_PLUS_OPTIONS = (
28
+ "shape=landscape&pc=stremio_tv_nuvio&tg=medium&bp=top_left&_is=1.05&_soo10=1"
29
+ "&fti=1&mw=lb:.5,im:.5&tw=tk:.5,im:.5&amw=mal:.5,al:.5&atw=mal:.5,al:.5"
30
+ "&fbs=photoreal&slr=1.20&shr=0.135&bdm=7&bms=5"
31
+ )
32
+
33
+ _IMDB_RE = re.compile(r"tt\d+")
34
+ _SERIES_RE = re.compile(r"\bseries\b", re.IGNORECASE)
35
+
36
+
37
+ def _parse_iso_timestamp(value: str | None) -> float | None:
38
+ if not value:
39
+ return None
40
+ try:
41
+ dt = datetime.fromisoformat(value.replace("Z", "+00:00"))
42
+ if dt.tzinfo is None:
43
+ dt = dt.replace(tzinfo=timezone.utc)
44
+ return dt.timestamp()
45
+ except ValueError:
46
+ return None
47
+
48
+
49
+ def _get_request(link: str) -> tuple[str, str]:
50
+ match = _IMDB_RE.search(link)
51
+ imdb_id = match.group(0) if match else ""
52
+ media_type = "series" if _SERIES_RE.search(link) else "movie"
53
+ if not imdb_id:
54
+ raise ValueError(f"Missing IMDb ID in metadata link: {link}")
55
+ return imdb_id, media_type
56
+
57
+
58
+ def _create_payload(
59
+ imdb_id: str,
60
+ media_type: str,
61
+ meta: dict[str, Any],
62
+ video: dict[str, Any] | None = None,
63
+ ) -> str:
64
+ video_parts = (video.get("id") or "").split(":") if video else []
65
+ season_val = ""
66
+ episode_val = ""
67
+ if video:
68
+ if video.get("season") is not None:
69
+ season_val = str(video["season"])
70
+ elif len(video_parts) > 1:
71
+ season_val = video_parts[1]
72
+ ep = video.get("episode") if video.get("episode") is not None else video.get("number")
73
+ if ep is not None:
74
+ episode_val = str(ep)
75
+ elif len(video_parts) > 2:
76
+ episode_val = video_parts[2]
77
+
78
+ return json.dumps(
79
+ {
80
+ "title": meta.get("name") or "",
81
+ "imdbId": imdb_id,
82
+ "season": season_val,
83
+ "episode": episode_val,
84
+ "type": media_type,
85
+ "tmdbId": str(meta["moviedb_id"]) if meta.get("moviedb_id") is not None else "",
86
+ "year": meta.get("year"),
87
+ }
88
+ )
89
+
90
+
91
+ class AutoEmbedClient(BaseProvider):
92
+ """Client for the AutoEmbed provider."""
93
+
94
+ name: str = "autoEmbed"
95
+ _skip_timings_key: str = "autoEmbed_skipTimings"
96
+ _error_label: str = "AutoEmbed"
97
+ catalog: list[dict[str, str]] = [
98
+ {"title": "Popular Movies", "filter": "/top/catalog/movie/top.json"},
99
+ {"title": "Popular TV Shows", "filter": "/top/catalog/series/top.json"},
100
+ {"title": "Featured Movies", "filter": "/imdbRating/catalog/movie/imdbRating.json"},
101
+ {"title": "Featured TV Shows", "filter": "/imdbRating/catalog/series/imdbRating.json"},
102
+ ]
103
+ genres: list[dict[str, str]] = []
104
+ settings_schema: list[dict[str, Any]] = [
105
+ {
106
+ "key": "autoEmbed_st111477Enabled",
107
+ "type": "toggle",
108
+ "label": "111477 sources",
109
+ "description": "Include direct video links from the 111477 Stremio add-on.",
110
+ "defaultValue": True,
111
+ },
112
+ {
113
+ "key": "autoEmbed_st111477Manifest",
114
+ "type": "text",
115
+ "label": "111477 manifest URL",
116
+ "description": (
117
+ "Optional. Paste the manifest URL from https://st.111477.xyz/ "
118
+ "to use your own configuration."
119
+ ),
120
+ "placeholder": "https://st.111477.xyz/config/…/manifest.json",
121
+ "defaultValue": "",
122
+ },
123
+ {
124
+ "key": "autoEmbed_skipTimings",
125
+ "type": "toggle",
126
+ "label": "Skip Timings",
127
+ "description": (
128
+ "Automatically fetch intro and recap skip timestamps from "
129
+ "TheIntroDB for verified episodes"
130
+ ),
131
+ "defaultValue": True,
132
+ },
133
+ ]
134
+
135
+ def get_posts(self, filter_path: str = "", page: int = 1) -> list[dict[str, Any]]:
136
+ try:
137
+ url = f"https://cinemeta-catalogs.strem.io{filter_path}"
138
+ data = self.fetch_json(url)
139
+ catalog: list[dict[str, Any]] = []
140
+ for result in data.get("metas") or []:
141
+ title = result.get("name")
142
+ item_id = result.get("imdb_id") or result.get("id")
143
+ media_type = result.get("type")
144
+ image = result.get("poster")
145
+ if not item_id:
146
+ continue
147
+ post: dict[str, Any] = {
148
+ "title": title,
149
+ "link": f"https://v3-cinemeta.strem.io/meta/{media_type}/{item_id}.json",
150
+ }
151
+ if (
152
+ self.name == "autoEmbed"
153
+ and isinstance(item_id, str)
154
+ and _IMDB_RE.fullmatch(item_id)
155
+ and media_type in ("movie", "series")
156
+ ):
157
+ post["image"] = (
158
+ f"https://postersplus.slokker.cc/poster?imdb_id={item_id}"
159
+ f"&stremio_id={item_id}&type={media_type}&{POSTERS_PLUS_OPTIONS}"
160
+ )
161
+ post["aspectRatio"] = 16 / 9
162
+ else:
163
+ post["image"] = image
164
+ catalog.append(post)
165
+ return catalog
166
+ except Exception:
167
+ return []
168
+
169
+ def get_search_posts(self, query: str, page: int = 1) -> list[dict[str, Any]]:
170
+ if page > 1:
171
+ return []
172
+ try:
173
+ encoded = quote(query, safe=":/?#[]@!$&'()*+,;=")
174
+ urls = [
175
+ f"https://v3-cinemeta.strem.io/catalog/series/top/search={encoded}.json",
176
+ f"https://v3-cinemeta.strem.io/catalog/movie/top/search={encoded}.json",
177
+ ]
178
+ catalog: list[dict[str, Any]] = []
179
+ for url in urls:
180
+ data = self.fetch_json(url)
181
+ for result in data.get("metas") or []:
182
+ item_id = result.get("imdb_id") or result.get("id")
183
+ if not item_id:
184
+ continue
185
+ catalog.append(
186
+ {
187
+ "title": result.get("name") or "",
188
+ "link": f"https://v3-cinemeta.strem.io/meta/{result.get('type')}/{item_id}.json",
189
+ "image": result.get("poster"),
190
+ }
191
+ )
192
+ return catalog
193
+ except Exception:
194
+ return []
195
+
196
+ def get_meta(self, link: str) -> dict[str, Any]:
197
+ try:
198
+ imdb_id, media_type = _get_request(link)
199
+ meta = get_cinemeta_meta(imdb_id, media_type, session=self.session)
200
+ if not meta:
201
+ return {
202
+ "title": imdb_id,
203
+ "synopsis": "",
204
+ "image": "",
205
+ "imdbId": imdb_id,
206
+ "type": media_type,
207
+ "linkList": [],
208
+ }
209
+
210
+ link_list: list[dict[str, Any]] = []
211
+ if media_type == "series":
212
+ seasons: dict[int, list[dict[str, Any]]] = {}
213
+ now = datetime.now(timezone.utc).timestamp()
214
+ for video in meta.get("videos") or []:
215
+ season = video.get("season")
216
+ episode = video.get("episode") if video.get("episode") is not None else video.get("number")
217
+ if not season or season <= 0 or not episode:
218
+ continue
219
+
220
+ release_ts = _parse_iso_timestamp(
221
+ video.get("released") or video.get("firstAired")
222
+ )
223
+ if release_ts is not None and release_ts > now:
224
+ continue
225
+
226
+ seasons.setdefault(int(season), []).append(
227
+ {
228
+ "title": format_episode_title(episode, video.get("name")),
229
+ "link": _create_payload(imdb_id, "series", meta, video),
230
+ }
231
+ )
232
+
233
+ skip_timings = self.kv.get(self._skip_timings_key)
234
+ skip_enabled = True if skip_timings is None else bool(skip_timings)
235
+ for season in sorted(seasons.keys()):
236
+ season_episodes = seasons[season]
237
+ if not season_episodes:
238
+ continue
239
+ direct_links = enrich_cinemeta_episodes(
240
+ season_episodes,
241
+ meta.get("videos") or [],
242
+ season,
243
+ )
244
+ if skip_enabled:
245
+ direct_links = enrich_episodes_with_skip_timings(
246
+ direct_links,
247
+ imdb_id,
248
+ season,
249
+ session=self.session,
250
+ )
251
+ link_list.append(
252
+ {
253
+ "title": f"Season {season}",
254
+ "directLinks": direct_links,
255
+ }
256
+ )
257
+ else:
258
+ link_list.append(
259
+ {
260
+ "title": meta.get("name") or "Movie",
261
+ "directLinks": [
262
+ {
263
+ "title": "Movie",
264
+ "type": "movie",
265
+ "link": _create_payload(imdb_id, "movie", meta),
266
+ }
267
+ ],
268
+ }
269
+ )
270
+
271
+ return apply_cinemeta_meta(
272
+ {
273
+ "title": meta.get("name") or "",
274
+ "synopsis": meta.get("description") or "",
275
+ "image": meta.get("background") or meta.get("poster") or "",
276
+ "poster": meta.get("poster") or "",
277
+ "imdbId": imdb_id or meta.get("imdb_id") or "",
278
+ "type": media_type,
279
+ "linkList": link_list,
280
+ },
281
+ meta,
282
+ )
283
+ except Exception as err:
284
+ throw_provider_error(self._error_label, "metadata", err)
285
+
286
+ def get_stream(
287
+ self,
288
+ url: str,
289
+ is_download: bool = False,
290
+ media_type: str = "movie",
291
+ ) -> list[dict[str, Any]]:
292
+ try:
293
+ try:
294
+ payload = json.loads(url)
295
+ if not isinstance(payload, dict):
296
+ payload = {"tmdbId": url}
297
+ except (ValueError, TypeError):
298
+ payload = {"tmdbId": url}
299
+
300
+ tmdb_id = str(payload.get("tmdbId") or payload.get("id") or payload.get("tmdId") or "")
301
+ imdb_id = str(payload.get("imdbId") or "")
302
+ season = int(payload.get("season") or 1)
303
+ episode = int(payload.get("episode") or 1)
304
+ effective_type = str(payload.get("type") or media_type or "movie")
305
+ is_movie = effective_type == "movie"
306
+ title = str(payload.get("title") or "")
307
+ year = str(payload.get("year") or "")[:4]
308
+ release_date = str(payload.get("releaseDate") or payload.get("date") or "")
309
+
310
+ if not tmdb_id and imdb_id:
311
+ try:
312
+ c_url = (
313
+ f"https://v3-cinemeta.strem.io/meta/"
314
+ f"{'movie' if is_movie else 'series'}/{imdb_id}.json"
315
+ )
316
+ c_meta = (self.fetch_json(c_url, timeout=5) or {}).get("meta") or {}
317
+ if c_meta:
318
+ tmdb_id = str(c_meta.get("moviedb_id") or "")
319
+ if not title:
320
+ title = c_meta.get("name") or ""
321
+ if not year:
322
+ year = str(c_meta.get("year") or "")[:4]
323
+ except Exception:
324
+ pass
325
+
326
+ if tmdb_id and (not title or not year):
327
+ try:
328
+ d_url = (
329
+ f"https://db.wecollege.net/3/{'movie' if is_movie else 'tv'}"
330
+ f"/{tmdb_id}?append_to_response=external_ids"
331
+ )
332
+ d_data = self.fetch_json(
333
+ d_url,
334
+ headers={
335
+ "Referer": "https://www.movy.sx/",
336
+ "Origin": "https://www.movy.sx",
337
+ },
338
+ timeout=4,
339
+ )
340
+ if isinstance(d_data, dict):
341
+ if not title:
342
+ title = d_data.get("title") or d_data.get("name") or ""
343
+ if not year:
344
+ year = (
345
+ d_data.get("release_date") or d_data.get("first_air_date") or ""
346
+ )[:4]
347
+ if not imdb_id:
348
+ imdb_id = (d_data.get("external_ids") or {}).get("imdb_id") or ""
349
+ if not release_date:
350
+ release_date = (
351
+ d_data.get("release_date") or d_data.get("first_air_date") or ""
352
+ )
353
+ except Exception:
354
+ pass
355
+
356
+ def _fetch_skip() -> list[dict[str, Any]] | None:
357
+ try:
358
+ skip_timings = self.kv.get(self._skip_timings_key)
359
+ enabled = True if skip_timings is None else bool(skip_timings)
360
+ if enabled and not is_movie and (imdb_id or tmdb_id):
361
+ res = fetch_theintrodb_skip_timings(
362
+ imdb_id=imdb_id or None,
363
+ tmdb_id=tmdb_id or None,
364
+ season=season,
365
+ episode=episode,
366
+ session=self.session,
367
+ )
368
+ return res or None
369
+ except Exception:
370
+ pass
371
+ return None
372
+
373
+ def _safe_st111477() -> list[dict[str, Any]]:
374
+ try:
375
+ return extract_st111477_streams(
376
+ imdb_id=imdb_id,
377
+ tmdb_id=tmdb_id,
378
+ season=season,
379
+ episode=episode,
380
+ is_movie=is_movie,
381
+ session=self.session,
382
+ kv=self.kv,
383
+ )
384
+ except Exception:
385
+ return []
386
+
387
+ if not tmdb_id:
388
+ return _safe_st111477()
389
+
390
+ def _safe_cinejoy() -> list[dict[str, Any]]:
391
+ try:
392
+ return extract_cinejoy_streams(
393
+ tmdb_id=tmdb_id,
394
+ season=season,
395
+ episode=episode,
396
+ type=effective_type,
397
+ session=self.session,
398
+ )
399
+ except Exception:
400
+ return []
401
+
402
+ def _safe_movy() -> list[dict[str, Any]]:
403
+ try:
404
+ return extract_movy_streams(
405
+ tmdb_id=tmdb_id,
406
+ imdb_id=imdb_id,
407
+ title=title,
408
+ year=year,
409
+ season=season,
410
+ episode=episode,
411
+ type=effective_type,
412
+ session=self.session,
413
+ )
414
+ except Exception:
415
+ return []
416
+
417
+ def _safe_vidstuck() -> list[dict[str, Any]]:
418
+ try:
419
+ return extract_vidstuck_streams(
420
+ tmdb_id=tmdb_id,
421
+ imdb_id=imdb_id,
422
+ title=title,
423
+ year=year,
424
+ date=release_date,
425
+ season=season,
426
+ episode=episode,
427
+ type=effective_type,
428
+ session=self.session,
429
+ )
430
+ except Exception:
431
+ return []
432
+
433
+ with ThreadPoolExecutor(max_workers=5) as pool:
434
+ f_skip = pool.submit(_fetch_skip)
435
+ f_cj = pool.submit(_safe_cinejoy)
436
+ f_movy = pool.submit(_safe_movy)
437
+ f_vs = pool.submit(_safe_vidstuck)
438
+ f_st = pool.submit(_safe_st111477)
439
+
440
+ stream_skip = f_skip.result()
441
+ cj_streams = f_cj.result()
442
+ movy_streams = f_movy.result()
443
+ vs_streams = f_vs.result()
444
+ st_streams = f_st.result()
445
+
446
+ streams: list[dict[str, Any]] = []
447
+ for group in (st_streams, cj_streams, vs_streams, movy_streams):
448
+ for s in group or []:
449
+ item = dict(s)
450
+ if stream_skip:
451
+ item["skip"] = stream_skip
452
+ streams.append(item)
453
+
454
+ clean_streams = [
455
+ s
456
+ for s in streams
457
+ if "lisbon" not in str(s.get("server", "")).lower()
458
+ and "cheaptruckrepairs" not in str(s.get("link", ""))
459
+ ]
460
+
461
+ def _qual(s: dict[str, Any]) -> int:
462
+ m = re.match(r"^\d+", str(s.get("quality") or "0"))
463
+ return int(m.group(0)) if m else 0
464
+
465
+ def _sort_key(s: dict[str, Any]) -> tuple[int, int, int]:
466
+ server_l = str(s.get("server", "")).lower()
467
+ stype = s.get("type", "")
468
+ qual = _qual(s)
469
+ if is_download:
470
+ is_dl = 0 if (stype in ("mkv", "mp4") or "download" in server_l) else 1
471
+ return (is_dl, 0, -qual)
472
+ is_stream = 0 if stype in ("m3u8", "dash") else 1
473
+ is_top = 0 if ("Nebula" in str(s.get("server", "")) or "Andromeda" in str(s.get("server", ""))) else 1
474
+ return (is_stream, is_top, -qual)
475
+
476
+ clean_streams.sort(key=_sort_key)
477
+ return clean_streams
478
+ except Exception:
479
+ return []