Spaces:
Running
Running
Add /api/vtv/streams endpoint for fetching all VTV channel streams
Browse files- app_main.py +8 -2
app_main.py
CHANGED
|
@@ -251,13 +251,19 @@ def api_match_detail_by_url(url: str = Query(...)):
|
|
| 251 |
return JSONResponse(fetch_match_detail_by_url(url))
|
| 252 |
|
| 253 |
# VTV Channels API
|
| 254 |
-
from vtv_scraper import fetch_vtv_stream,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
|
| 256 |
@app.get('/api/vtv/stream/{channel_name}')
|
| 257 |
def api_vtv_stream(channel_name: str):
|
| 258 |
"""Get stream URL for a specific VTV channel."""
|
| 259 |
stream = fetch_vtv_stream(channel_name)
|
| 260 |
-
return JSONResponse({'stream_url': stream, '
|
| 261 |
|
| 262 |
def _wc2026_bg_refresh():
|
| 263 |
time.sleep(10)
|
|
|
|
| 251 |
return JSONResponse(fetch_match_detail_by_url(url))
|
| 252 |
|
| 253 |
# VTV Channels API
|
| 254 |
+
from vtv_scraper import fetch_vtv_stream, get_all_vtv_streams
|
| 255 |
+
|
| 256 |
+
@app.get('/api/vtv/streams')
|
| 257 |
+
def api_vtv_streams():
|
| 258 |
+
"""Get all VTV channel streams."""
|
| 259 |
+
channels = get_all_vtv_streams()
|
| 260 |
+
return JSONResponse({'channels': channels})
|
| 261 |
|
| 262 |
@app.get('/api/vtv/stream/{channel_name}')
|
| 263 |
def api_vtv_stream(channel_name: str):
|
| 264 |
"""Get stream URL for a specific VTV channel."""
|
| 265 |
stream = fetch_vtv_stream(channel_name)
|
| 266 |
+
return JSONResponse({'stream_url': stream, 'channel': channel_name})
|
| 267 |
|
| 268 |
def _wc2026_bg_refresh():
|
| 269 |
time.sleep(10)
|