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.
- vega_cli/__init__.py +1 -0
- vega_cli/__main__.py +6 -0
- vega_cli/cli.py +247 -0
- vega_cli/config.py +99 -0
- vega_cli/display.py +138 -0
- vega_cli/html.py +540 -0
- vega_cli/interactive.py +220 -0
- vega_cli/player.py +82 -0
- vega_cli/providers/__init__.py +13 -0
- vega_cli/providers/ani_dream.py +1089 -0
- vega_cli/providers/anikoto.py +820 -0
- vega_cli/providers/animesalt.py +649 -0
- vega_cli/providers/animesub.py +1374 -0
- vega_cli/providers/animeworld.py +504 -0
- vega_cli/providers/auto_embed.py +479 -0
- vega_cli/providers/castle.py +497 -0
- vega_cli/providers/cncverse.py +873 -0
- vega_cli/providers/common/__init__.py +51 -0
- vega_cli/providers/common/aes.py +152 -0
- vega_cli/providers/common/aniskip.py +186 -0
- vega_cli/providers/common/base_url.py +102 -0
- vega_cli/providers/common/cinemeta.py +231 -0
- vega_cli/providers/common/errors.py +25 -0
- vega_cli/providers/common/extractors/__init__.py +23 -0
- vega_cli/providers/common/extractors/abbasy.py +247 -0
- vega_cli/providers/common/extractors/buzzheavier.py +72 -0
- vega_cli/providers/common/extractors/cinejoy.py +33 -0
- vega_cli/providers/common/extractors/gdflix.py +170 -0
- vega_cli/providers/common/extractors/gofile.py +167 -0
- vega_cli/providers/common/extractors/hubcloud.py +277 -0
- vega_cli/providers/common/extractors/movy.py +349 -0
- vega_cli/providers/common/extractors/st111477.py +139 -0
- vega_cli/providers/common/extractors/transferit.py +53 -0
- vega_cli/providers/common/extractors/vegadrive.py +161 -0
- vega_cli/providers/common/extractors/vidstuck.py +379 -0
- vega_cli/providers/common/extractors/zcloud.py +158 -0
- vega_cli/providers/common/extractors/zypter.py +72 -0
- vega_cli/providers/common/headers.py +25 -0
- vega_cli/providers/common/http.py +121 -0
- vega_cli/providers/common/net_mirror.py +1494 -0
- vega_cli/providers/common/theintrodb.py +112 -0
- vega_cli/providers/common/unpack.py +54 -0
- vega_cli/providers/disney_mirror.py +31 -0
- vega_cli/providers/dramacool.py +297 -0
- vega_cli/providers/drive.py +695 -0
- vega_cli/providers/durbin_live.py +354 -0
- vega_cli/providers/eon_movies.py +752 -0
- vega_cli/providers/extraflix.py +701 -0
- vega_cli/providers/four_khdhub.py +307 -0
- vega_cli/providers/goku_hd.py +336 -0
- vega_cli/providers/hdhub4u.py +665 -0
- vega_cli/providers/internet_archive.py +552 -0
- vega_cli/providers/kartoons.py +642 -0
- vega_cli/providers/kartoons2.py +395 -0
- vega_cli/providers/katmovies.py +816 -0
- vega_cli/providers/kick_ass_anime.py +445 -0
- vega_cli/providers/kiss_kh.py +490 -0
- vega_cli/providers/live_tg_tv.py +540 -0
- vega_cli/providers/lux_movies.py +650 -0
- vega_cli/providers/mod.py +676 -0
- vega_cli/providers/movie_box_web.py +921 -0
- vega_cli/providers/movielinkdb.py +734 -0
- vega_cli/providers/movies4u.py +580 -0
- vega_cli/providers/moviezwap.py +199 -0
- vega_cli/providers/mxplayer.py +470 -0
- vega_cli/providers/netflix_mirror.py +32 -0
- vega_cli/providers/one_cinevood.py +596 -0
- vega_cli/providers/prime_mirror.py +31 -0
- vega_cli/providers/rareanimes.py +676 -0
- vega_cli/providers/registry.py +124 -0
- vega_cli/providers/showbox.py +245 -0
- vega_cli/providers/topmovies.py +707 -0
- vega_cli/providers/torrentio.py +398 -0
- vega_cli/providers/uhd.py +483 -0
- vega_cli/providers/vega.py +891 -0
- vega_cli/providers/youtube.py +566 -0
- vega_cli/providers/zeefliz.py +563 -0
- vega_cli/store.py +45 -0
- vega_cli/utils.py +90 -0
- vega_cli-0.1.0.dist-info/METADATA +8 -0
- vega_cli-0.1.0.dist-info/RECORD +84 -0
- vega_cli-0.1.0.dist-info/WHEEL +5 -0
- vega_cli-0.1.0.dist-info/entry_points.txt +2 -0
- vega_cli-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
"""Pure-Python Vega Kartoons2 (OrangeStream / Toonix) provider."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import re
|
|
6
|
+
from typing import Any
|
|
7
|
+
from urllib.parse import quote
|
|
8
|
+
|
|
9
|
+
from .common import BaseProvider
|
|
10
|
+
|
|
11
|
+
_BASE_URL = "https://cd2735efc006-orangestream.baby-beamup.club"
|
|
12
|
+
_HEADERS = {
|
|
13
|
+
"Accept": "application/json, text/plain, */*",
|
|
14
|
+
"Accept-Language": "en-US,en;q=0.9",
|
|
15
|
+
"User-Agent": (
|
|
16
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
|
|
17
|
+
"(KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0"
|
|
18
|
+
),
|
|
19
|
+
"Referer": f"{_BASE_URL}/",
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
_EMPTY_META: dict[str, Any] = {
|
|
23
|
+
"title": "",
|
|
24
|
+
"synopsis": "",
|
|
25
|
+
"image": "",
|
|
26
|
+
"imdbId": "",
|
|
27
|
+
"type": "movie",
|
|
28
|
+
"linkList": [],
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _map_meta_to_post(meta: dict[str, Any], media_type: str) -> dict[str, str]:
|
|
33
|
+
return {
|
|
34
|
+
"title": meta.get("name") or "Untitled",
|
|
35
|
+
"link": f"{media_type}::{meta.get('id') or ''}",
|
|
36
|
+
"image": meta.get("poster") or meta.get("background") or "",
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _group_by_season(videos: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
|
41
|
+
buckets: dict[int, list[dict[str, Any]]] = {}
|
|
42
|
+
has_season = False
|
|
43
|
+
for v in videos:
|
|
44
|
+
raw_s = v.get("season")
|
|
45
|
+
try:
|
|
46
|
+
s_num = int(raw_s)
|
|
47
|
+
has_season = True
|
|
48
|
+
except (TypeError, ValueError):
|
|
49
|
+
s_num = 0
|
|
50
|
+
buckets.setdefault(s_num, []).append(v)
|
|
51
|
+
|
|
52
|
+
if not has_season:
|
|
53
|
+
return [{"season": 0, "videos": videos}]
|
|
54
|
+
|
|
55
|
+
return [
|
|
56
|
+
{"season": s, "videos": buckets[s]}
|
|
57
|
+
for s in sorted(buckets.keys())
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _detect_stream_type(raw_url: str, is_torrent: bool) -> str:
|
|
62
|
+
if is_torrent:
|
|
63
|
+
return "torrent"
|
|
64
|
+
if re.search(r"\.m3u8(\?|#|$)", raw_url, re.I):
|
|
65
|
+
return "hls"
|
|
66
|
+
if re.search(r"\.mpd(\?|#|$)", raw_url, re.I):
|
|
67
|
+
return "dash"
|
|
68
|
+
if re.search(r"\.(mp4|mkv|webm|mov|m4v)(\?|#|$)", raw_url, re.I):
|
|
69
|
+
return "mp4"
|
|
70
|
+
if re.match(r"^https?://", raw_url, re.I):
|
|
71
|
+
return "mp4"
|
|
72
|
+
return "external"
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _extract_request_headers(s: dict[str, Any]) -> dict[str, str] | None:
|
|
76
|
+
out: dict[str, str] = {}
|
|
77
|
+
|
|
78
|
+
def merge(obj: Any) -> None:
|
|
79
|
+
if not isinstance(obj, dict):
|
|
80
|
+
return
|
|
81
|
+
for k, v in obj.items():
|
|
82
|
+
if isinstance(v, str) and v and k not in out:
|
|
83
|
+
out[k] = v
|
|
84
|
+
|
|
85
|
+
hints = s.get("behaviorHints") if isinstance(s.get("behaviorHints"), dict) else {}
|
|
86
|
+
proxy_hints = hints.get("proxyHeaders") if isinstance(hints.get("proxyHeaders"), dict) else {}
|
|
87
|
+
proxy = s.get("proxyHeaders") if isinstance(s.get("proxyHeaders"), dict) else {}
|
|
88
|
+
|
|
89
|
+
merge(proxy_hints.get("request"))
|
|
90
|
+
merge(proxy_hints)
|
|
91
|
+
merge(hints.get("headers"))
|
|
92
|
+
merge(proxy.get("request"))
|
|
93
|
+
merge(proxy)
|
|
94
|
+
merge(s.get("headers"))
|
|
95
|
+
return out or None
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _extract_quality(s: dict[str, Any]) -> str:
|
|
99
|
+
if isinstance(s.get("quality"), str) and s["quality"]:
|
|
100
|
+
return s["quality"]
|
|
101
|
+
source = f"{s.get('title') or ''} {s.get('name') or ''} {s.get('url') or ''}"
|
|
102
|
+
m = re.search(r"\b(\d{3,4})p\b", source)
|
|
103
|
+
return m.group(1) if m else ""
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def _normalise_subtitles(raw: Any) -> list[dict[str, str]] | None:
|
|
107
|
+
if not isinstance(raw, list):
|
|
108
|
+
return None
|
|
109
|
+
tracks: list[dict[str, str]] = []
|
|
110
|
+
for sub in raw:
|
|
111
|
+
if not isinstance(sub, dict):
|
|
112
|
+
continue
|
|
113
|
+
uri = sub.get("url") or sub.get("uri")
|
|
114
|
+
if not isinstance(uri, str) or not re.match(r"^https?://", uri, re.I):
|
|
115
|
+
continue
|
|
116
|
+
language = sub.get("lang") or sub.get("language") or "und"
|
|
117
|
+
path = re.split(r"[?#]", uri, maxsplit=1)[0].lower()
|
|
118
|
+
if sub.get("type") == "text/vtt" or path.endswith(".vtt"):
|
|
119
|
+
sub_type = "text/vtt"
|
|
120
|
+
elif sub.get("type") == "application/ttml+xml" or re.search(r"\.(ttml|dfxp)$", path):
|
|
121
|
+
sub_type = "application/ttml+xml"
|
|
122
|
+
else:
|
|
123
|
+
sub_type = "application/x-subrip"
|
|
124
|
+
tracks.append(
|
|
125
|
+
{
|
|
126
|
+
"uri": uri,
|
|
127
|
+
"language": language,
|
|
128
|
+
"title": sub.get("title") or sub.get("label") or language,
|
|
129
|
+
"type": sub_type,
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
return tracks or None
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def _raw_to_stream(s: Any) -> dict[str, Any] | None:
|
|
136
|
+
if not isinstance(s, dict):
|
|
137
|
+
return None
|
|
138
|
+
raw_url = s.get("url") or ""
|
|
139
|
+
external_url = s.get("externalUrl") or s.get("external_url") or ""
|
|
140
|
+
info_hash = s.get("infoHash") or s.get("info_hash")
|
|
141
|
+
magnet_from_hash = f"magnet:?xt=urn:btih:{info_hash}" if info_hash else ""
|
|
142
|
+
|
|
143
|
+
is_torrent = (
|
|
144
|
+
bool(info_hash)
|
|
145
|
+
or raw_url.startswith("magnet:")
|
|
146
|
+
or s.get("type") in ("torrent", "Torrent")
|
|
147
|
+
)
|
|
148
|
+
effective_url = raw_url or external_url or magnet_from_hash
|
|
149
|
+
if not effective_url:
|
|
150
|
+
return None
|
|
151
|
+
|
|
152
|
+
is_external_only = not raw_url and bool(external_url)
|
|
153
|
+
detected_type = "external" if is_external_only else _detect_stream_type(effective_url, is_torrent)
|
|
154
|
+
req_headers = _extract_request_headers(s)
|
|
155
|
+
subtitles = _normalise_subtitles(s.get("subtitles"))
|
|
156
|
+
hints = s.get("behaviorHints") if isinstance(s.get("behaviorHints"), dict) else {}
|
|
157
|
+
|
|
158
|
+
stream: dict[str, Any] = {
|
|
159
|
+
"server": s.get("name") or s.get("title") or "Toonix",
|
|
160
|
+
"quality": _extract_quality(s),
|
|
161
|
+
"externalUrl": external_url or None,
|
|
162
|
+
"behaviorHints": s.get("behaviorHints"),
|
|
163
|
+
"filename": hints.get("filename"),
|
|
164
|
+
**s,
|
|
165
|
+
"link": effective_url,
|
|
166
|
+
"type": detected_type,
|
|
167
|
+
"isHls": detected_type == "hls",
|
|
168
|
+
"isDash": detected_type == "dash",
|
|
169
|
+
"isTorrent": is_torrent,
|
|
170
|
+
"external": detected_type == "external",
|
|
171
|
+
"notWebReady": hints.get("notWebReady") is True,
|
|
172
|
+
"infoHash": info_hash,
|
|
173
|
+
}
|
|
174
|
+
if req_headers:
|
|
175
|
+
stream["headers"] = req_headers
|
|
176
|
+
else:
|
|
177
|
+
stream.pop("headers", None)
|
|
178
|
+
if subtitles:
|
|
179
|
+
stream["subtitles"] = subtitles
|
|
180
|
+
else:
|
|
181
|
+
stream.pop("subtitles", None)
|
|
182
|
+
return stream
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
class Kartoons2Client(BaseProvider):
|
|
186
|
+
"""Client for the Kartoons2 (OrangeStream / Toonix) provider."""
|
|
187
|
+
|
|
188
|
+
name: str = "kartoons2"
|
|
189
|
+
catalog: list[dict[str, str]] = [
|
|
190
|
+
{"title": "Trending Shows", "filter": "series|toonix_trending"},
|
|
191
|
+
{"title": "Trending Movies", "filter": "movie|toonix_trending"},
|
|
192
|
+
{"title": "Popular Shows", "filter": "series|toonix_popular_shows"},
|
|
193
|
+
{"title": "All Shows", "filter": "series|toonix_all_shows"},
|
|
194
|
+
{"title": "Popular Movies", "filter": "movie|toonix_popular_movies"},
|
|
195
|
+
{"title": "All Movies", "filter": "movie|toonix_all_movies"},
|
|
196
|
+
]
|
|
197
|
+
genres: list[dict[str, str]] = []
|
|
198
|
+
|
|
199
|
+
def _fetch_search(self, media_type: str, query: str, page: int) -> list[dict[str, str]]:
|
|
200
|
+
try:
|
|
201
|
+
skip = max(0, page - 1) * 100
|
|
202
|
+
extra = [f"search={quote(query)}"]
|
|
203
|
+
if skip > 0:
|
|
204
|
+
extra.append(f"skip={skip}")
|
|
205
|
+
url = f"{_BASE_URL}/catalog/{quote(media_type)}/toonix_search/{'&'.join(extra)}.json"
|
|
206
|
+
data = self.fetch_json(url, headers=_HEADERS, timeout=25)
|
|
207
|
+
metas = data.get("metas") or []
|
|
208
|
+
return [_map_meta_to_post(m, media_type) for m in metas]
|
|
209
|
+
except Exception:
|
|
210
|
+
return []
|
|
211
|
+
|
|
212
|
+
def get_posts(self, filter_path: str = "", page: int = 1) -> list[dict[str, str]]:
|
|
213
|
+
try:
|
|
214
|
+
parts = (filter_path or "").split("|", 1)
|
|
215
|
+
if len(parts) != 2 or not parts[0] or not parts[1]:
|
|
216
|
+
return []
|
|
217
|
+
media_type, catalog_id = parts
|
|
218
|
+
skip = max(0, page - 1) * 100
|
|
219
|
+
suffix = f"/skip={skip}" if skip > 0 else ""
|
|
220
|
+
url = f"{_BASE_URL}/catalog/{quote(media_type)}/{quote(catalog_id)}{suffix}.json"
|
|
221
|
+
data = self.fetch_json(url, headers=_HEADERS, timeout=25)
|
|
222
|
+
metas = data.get("metas") or []
|
|
223
|
+
return [_map_meta_to_post(m, media_type) for m in metas]
|
|
224
|
+
except Exception:
|
|
225
|
+
return []
|
|
226
|
+
|
|
227
|
+
def get_search_posts(self, query: str, page: int = 1) -> list[dict[str, str]]:
|
|
228
|
+
if not query.strip():
|
|
229
|
+
return []
|
|
230
|
+
series_posts = self._fetch_search("series", query, page)
|
|
231
|
+
movie_posts = self._fetch_search("movie", query, page)
|
|
232
|
+
seen: set[str] = set()
|
|
233
|
+
merged: list[dict[str, str]] = []
|
|
234
|
+
for post in [*series_posts, *movie_posts]:
|
|
235
|
+
key = post.get("link")
|
|
236
|
+
if key and key not in seen:
|
|
237
|
+
seen.add(key)
|
|
238
|
+
merged.append(post)
|
|
239
|
+
return merged
|
|
240
|
+
|
|
241
|
+
def get_meta(self, link: str) -> dict[str, Any]:
|
|
242
|
+
try:
|
|
243
|
+
sep_idx = link.find("::")
|
|
244
|
+
if sep_idx < 0:
|
|
245
|
+
return dict(_EMPTY_META)
|
|
246
|
+
media_type = link[:sep_idx]
|
|
247
|
+
content_id = re.sub(r"^v\d+:", "", link[sep_idx + 2 :])
|
|
248
|
+
|
|
249
|
+
url = f"{_BASE_URL}/meta/{quote(media_type)}/{quote(content_id)}.json"
|
|
250
|
+
data = self.fetch_json(url, headers=_HEADERS, timeout=30)
|
|
251
|
+
meta = data.get("meta")
|
|
252
|
+
if not meta:
|
|
253
|
+
return dict(_EMPTY_META)
|
|
254
|
+
|
|
255
|
+
videos = meta.get("videos") if isinstance(meta.get("videos"), list) else []
|
|
256
|
+
is_series = media_type == "series" or len(videos) > 0
|
|
257
|
+
imdb_raw = meta.get("imdb_id") or ""
|
|
258
|
+
imdb_id = imdb_raw if re.fullmatch(r"tt\d+", imdb_raw, re.I) else ""
|
|
259
|
+
image = meta.get("poster") or meta.get("background") or ""
|
|
260
|
+
|
|
261
|
+
if not is_series:
|
|
262
|
+
return {
|
|
263
|
+
"title": meta.get("name") or "",
|
|
264
|
+
"synopsis": meta.get("description") or "",
|
|
265
|
+
"image": image,
|
|
266
|
+
"imdbId": imdb_id,
|
|
267
|
+
"type": "movie",
|
|
268
|
+
"linkList": [
|
|
269
|
+
{
|
|
270
|
+
"title": meta.get("name") or "Movie",
|
|
271
|
+
"quality": "",
|
|
272
|
+
"directLinks": [
|
|
273
|
+
{"title": "▶ Play", "link": f"{media_type}::{content_id}", "type": "movie"}
|
|
274
|
+
],
|
|
275
|
+
}
|
|
276
|
+
],
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
buckets = _group_by_season(videos)
|
|
280
|
+
if len(buckets) <= 1:
|
|
281
|
+
first = buckets[0] if buckets else {"season": 0, "videos": []}
|
|
282
|
+
title = (
|
|
283
|
+
f"Season {first['season']} · {len(first['videos'])} eps"
|
|
284
|
+
if first["season"] > 0
|
|
285
|
+
else f"{meta.get('name') or 'All'} · {len(videos)} eps"
|
|
286
|
+
)
|
|
287
|
+
link_list = [
|
|
288
|
+
{
|
|
289
|
+
"title": title,
|
|
290
|
+
"quality": "",
|
|
291
|
+
"episodesLink": f"{media_type}::{content_id}::t=all",
|
|
292
|
+
}
|
|
293
|
+
]
|
|
294
|
+
else:
|
|
295
|
+
link_list = [
|
|
296
|
+
{
|
|
297
|
+
"title": f"Season {b['season']} · {len(b['videos'])} eps",
|
|
298
|
+
"quality": "",
|
|
299
|
+
"episodesLink": f"{media_type}::{content_id}::s={b['season']}",
|
|
300
|
+
}
|
|
301
|
+
for b in buckets
|
|
302
|
+
]
|
|
303
|
+
|
|
304
|
+
return {
|
|
305
|
+
"title": meta.get("name") or "",
|
|
306
|
+
"synopsis": meta.get("description") or "",
|
|
307
|
+
"image": image,
|
|
308
|
+
"imdbId": imdb_id,
|
|
309
|
+
"type": "series",
|
|
310
|
+
"linkList": link_list,
|
|
311
|
+
"videos": videos,
|
|
312
|
+
}
|
|
313
|
+
except Exception:
|
|
314
|
+
return dict(_EMPTY_META)
|
|
315
|
+
|
|
316
|
+
def get_episodes(
|
|
317
|
+
self,
|
|
318
|
+
url: str,
|
|
319
|
+
imdb_id: str = "",
|
|
320
|
+
season: int | None = None,
|
|
321
|
+
) -> list[dict[str, Any]]:
|
|
322
|
+
try:
|
|
323
|
+
parts = url.split("::")
|
|
324
|
+
if len(parts) < 2:
|
|
325
|
+
return []
|
|
326
|
+
media_type = parts[0]
|
|
327
|
+
content_id = re.sub(r"^v\d+:", "", parts[1])
|
|
328
|
+
extra = "::".join(parts[2:])
|
|
329
|
+
|
|
330
|
+
season_match = re.search(r"s=(\d+)", extra)
|
|
331
|
+
season_filter = int(season_match.group(1)) if season_match else season
|
|
332
|
+
|
|
333
|
+
meta_url = f"{_BASE_URL}/meta/{quote(media_type)}/{quote(content_id)}.json"
|
|
334
|
+
data = self.fetch_json(meta_url, headers=_HEADERS, timeout=30)
|
|
335
|
+
videos = (data.get("meta") or {}).get("videos") or []
|
|
336
|
+
|
|
337
|
+
if season_filter is not None:
|
|
338
|
+
filtered = []
|
|
339
|
+
for v in videos:
|
|
340
|
+
try:
|
|
341
|
+
if int(v.get("season")) == season_filter:
|
|
342
|
+
filtered.append(v)
|
|
343
|
+
except (TypeError, ValueError):
|
|
344
|
+
pass
|
|
345
|
+
videos = filtered
|
|
346
|
+
|
|
347
|
+
episodes: list[dict[str, Any]] = []
|
|
348
|
+
for v in videos:
|
|
349
|
+
vid = v.get("id") or ""
|
|
350
|
+
if not vid:
|
|
351
|
+
continue
|
|
352
|
+
v_season = v.get("season")
|
|
353
|
+
v_ep = v.get("episode")
|
|
354
|
+
title = v.get("title") or (
|
|
355
|
+
f"S{v_season}E{v_ep}"
|
|
356
|
+
if v_season is not None and v_ep is not None
|
|
357
|
+
else "Episode"
|
|
358
|
+
)
|
|
359
|
+
episodes.append(
|
|
360
|
+
{
|
|
361
|
+
"title": title,
|
|
362
|
+
"link": f"{media_type}::{vid}",
|
|
363
|
+
"season": v_season,
|
|
364
|
+
"episode": v_ep,
|
|
365
|
+
}
|
|
366
|
+
)
|
|
367
|
+
return episodes
|
|
368
|
+
except Exception:
|
|
369
|
+
return []
|
|
370
|
+
|
|
371
|
+
def get_stream(
|
|
372
|
+
self,
|
|
373
|
+
url: str,
|
|
374
|
+
is_download: bool = False,
|
|
375
|
+
media_type: str = "movie",
|
|
376
|
+
) -> list[dict[str, Any]]:
|
|
377
|
+
try:
|
|
378
|
+
sep_idx = url.find("::")
|
|
379
|
+
decoded_type = url[:sep_idx] if sep_idx >= 0 else (media_type or "movie")
|
|
380
|
+
content_id = (
|
|
381
|
+
re.sub(r"^v\d+:", "", url[sep_idx + 2 :]) if sep_idx >= 0 else url
|
|
382
|
+
)
|
|
383
|
+
if not content_id:
|
|
384
|
+
return []
|
|
385
|
+
req_url = f"{_BASE_URL}/stream/{quote(decoded_type)}/{quote(content_id)}.json"
|
|
386
|
+
data = self.fetch_json(req_url, headers=_HEADERS, timeout=30)
|
|
387
|
+
streams = data.get("streams") or []
|
|
388
|
+
result = []
|
|
389
|
+
for raw in streams:
|
|
390
|
+
mapped = _raw_to_stream(raw)
|
|
391
|
+
if mapped and mapped.get("link"):
|
|
392
|
+
result.append(mapped)
|
|
393
|
+
return result
|
|
394
|
+
except Exception:
|
|
395
|
+
return []
|