lljz66 commited on
Commit
ca80cc7
·
verified ·
1 Parent(s): 268f256

Put core/app.py

Browse files
Files changed (1) hide show
  1. core/app.py +23 -5
core/app.py CHANGED
@@ -161,7 +161,7 @@ def browser_bin() -> str | None:
161
  return shutil.which("lightpanda") or None
162
 
163
 
164
- @app.get("/health")
165
  def health():
166
  try:
167
  version_info = versions()
@@ -172,24 +172,42 @@ def health():
172
  "tools": {
173
  "ffmpeg": shutil.which(FFMPEG) or None,
174
  "streamlink": shutil.which("streamlink") or None,
175
- "yt-dlp": shutil.which("yt-dlp") or None,
176
- "any-dl": shutil.which("any-dl") or None,
177
- "node": shutil.which("node") or None,
178
  "lightpanda": shutil.which("lightpanda") or None,
179
  },
180
  "browser": {
181
  "engine": "lightpanda",
182
  "path": browser_bin(),
183
  "binary": "https://github.com/lightpanda-io/browser",
184
- "installed_by": "pip (the lightpanda wheel bundles the binary)",
185
  "needed_by": ["streamlink"],
186
  },
187
  "versions": version_info,
188
  "cookies": os.path.isfile("cookies.txt") or os.path.isfile("/data/cookies.txt"),
189
  "solutions": [s.NAME for s in SOLUTIONS],
 
 
 
 
 
 
 
 
 
 
 
190
  }
191
 
192
 
 
 
 
 
 
 
 
 
 
193
  @app.get("/formats")
194
  async def formats(
195
  url: str = Query(
 
161
  return shutil.which("lightpanda") or None
162
 
163
 
164
+ @app.get("/health", tags=["diagnostics"], summary="What this image actually contains")
165
  def health():
166
  try:
167
  version_info = versions()
 
172
  "tools": {
173
  "ffmpeg": shutil.which(FFMPEG) or None,
174
  "streamlink": shutil.which("streamlink") or None,
175
+ "curl_cffi": _curl_cffi_version(),
 
 
176
  "lightpanda": shutil.which("lightpanda") or None,
177
  },
178
  "browser": {
179
  "engine": "lightpanda",
180
  "path": browser_bin(),
181
  "binary": "https://github.com/lightpanda-io/browser",
182
+ "installed_by": "pip (the lightpanda wheel bundles the browser binary)",
183
  "needed_by": ["streamlink"],
184
  },
185
  "versions": version_info,
186
  "cookies": os.path.isfile("cookies.txt") or os.path.isfile("/data/cookies.txt"),
187
  "solutions": [s.NAME for s in SOLUTIONS],
188
+ "endpoints": {
189
+ "client_side": ["/cdn/formats"],
190
+ "proxy": ["/stream"],
191
+ "diagnostic": ["/formats", "/health"],
192
+ },
193
+ "removed_rungs": {
194
+ "yt-dlp": "no working Kick VOD extractor; resolves as [kick:live] and answers 'channel is not currently live'",
195
+ "streamlink": "rung needed a browser that can clear Kick's JS challenge; this image ships Lightpanda, a different engine",
196
+ "any-dl": "needs a real Chrome on its command line; this image deliberately ships no Chromium",
197
+ "note": "each was removed after being measured to fail on every real url while kick-api returned all five renditions",
198
+ },
199
  }
200
 
201
 
202
+ def _curl_cffi_version() -> str | None:
203
+ try:
204
+ import curl_cffi
205
+
206
+ return getattr(curl_cffi, "__version__", "unknown")
207
+ except Exception: # noqa: BLE001 - reporting only
208
+ return None
209
+
210
+
211
  @app.get("/formats")
212
  async def formats(
213
  url: str = Query(