Spaces:
Running
Running
Add @duongdenworldcup_2026 shorts (30 videos) + /api/shorts/worldcup endpoint
Browse files
main.py
CHANGED
|
@@ -187,6 +187,9 @@ def scrape_shorts():
|
|
| 187 |
except:pass
|
| 188 |
vids.sort(key=lambda x:x.get("id",""),reverse=True)
|
| 189 |
return vids[:20]
|
|
|
|
|
|
|
|
|
|
| 190 |
|
| 191 |
# ===== LIVESCORE =====
|
| 192 |
@app.get("/api/livescore/live")
|
|
@@ -232,6 +235,8 @@ def api_livescore_featured():
|
|
| 232 |
# ===== VIDEO APIs =====
|
| 233 |
@app.get("/api/shorts")
|
| 234 |
def api_shorts():return JSONResponse(_cached("yt_shorts",scrape_shorts,ttl=_cache_ttl_yt))
|
|
|
|
|
|
|
| 235 |
@app.get("/api/highlights")
|
| 236 |
def api_highlights():return JSONResponse(_cached("xemlaibongda_hl",scrape_xemlaibongda,ttl=_cache_ttl))
|
| 237 |
@app.get("/api/highlights/leagues")
|
|
|
|
| 187 |
except:pass
|
| 188 |
vids.sort(key=lambda x:x.get("id",""),reverse=True)
|
| 189 |
return vids[:20]
|
| 190 |
+
def scrape_worldcup_shorts():
|
| 191 |
+
"""Fetch all shorts from @duongdenworldcup_2026"""
|
| 192 |
+
return _yt_channel_shorts("duongdenworldcup_2026",30)
|
| 193 |
|
| 194 |
# ===== LIVESCORE =====
|
| 195 |
@app.get("/api/livescore/live")
|
|
|
|
| 235 |
# ===== VIDEO APIs =====
|
| 236 |
@app.get("/api/shorts")
|
| 237 |
def api_shorts():return JSONResponse(_cached("yt_shorts",scrape_shorts,ttl=_cache_ttl_yt))
|
| 238 |
+
@app.get("/api/shorts/worldcup")
|
| 239 |
+
def api_shorts_worldcup():return JSONResponse(_cached("wc_shorts",scrape_worldcup_shorts,ttl=_cache_ttl_yt))
|
| 240 |
@app.get("/api/highlights")
|
| 241 |
def api_highlights():return JSONResponse(_cached("xemlaibongda_hl",scrape_xemlaibongda,ttl=_cache_ttl))
|
| 242 |
@app.get("/api/highlights/leagues")
|