Spaces:
Sleeping
Sleeping
Transcript via transcriptapi.com (no proxy) as primary; youtube-transcript-api fallback
Browse files
app.py
CHANGED
|
@@ -129,6 +129,8 @@ def check_access():
|
|
| 129 |
proxy = _resolve_proxy()
|
| 130 |
proxies = {"http": proxy, "https": proxy} if proxy else None
|
| 131 |
lines = [
|
|
|
|
|
|
|
| 132 |
f"- **Proxy** (`YT_PROXY`): {'set ✅' if proxy else 'not set ⚪'}",
|
| 133 |
f"- **Media proxy** (`YT_MEDIA_PROXY`, screenshots): "
|
| 134 |
f"{'set ✅' if _resolve_media_proxy() else 'not set ⚪ (falls back to YT_PROXY)'}",
|
|
@@ -267,9 +269,11 @@ def run_pipeline(topic, hf_token, yt_api_key, llm_model, vlm_model,
|
|
| 267 |
yield (status(f"🏆 Picked **{best.get('title', best['video_id'])}** {picked_msg}."),
|
| 268 |
ranking, gr.update(), gr.update())
|
| 269 |
|
| 270 |
-
# 3. Transcript (youtube-transcript-api) --
|
| 271 |
progress(0.3, desc="Transcript")
|
| 272 |
-
|
|
|
|
|
|
|
| 273 |
segs = transcribe_mod.get_segments(best["video_id"], proxy=proxy)
|
| 274 |
transcript = transcribe_mod.transcript_text(segs)
|
| 275 |
yield (status(f"Transcript ready ({len(segs)} segments)."),
|
|
|
|
| 129 |
proxy = _resolve_proxy()
|
| 130 |
proxies = {"http": proxy, "https": proxy} if proxy else None
|
| 131 |
lines = [
|
| 132 |
+
f"- **Transcript API** (`TRANSCRIPTAPI_KEY`, no proxy needed): "
|
| 133 |
+
f"{'set ✅' if os.environ.get('TRANSCRIPTAPI_KEY') else 'not set ⚪ (falls back to youtube-transcript-api via YT_PROXY)'}",
|
| 134 |
f"- **Proxy** (`YT_PROXY`): {'set ✅' if proxy else 'not set ⚪'}",
|
| 135 |
f"- **Media proxy** (`YT_MEDIA_PROXY`, screenshots): "
|
| 136 |
f"{'set ✅' if _resolve_media_proxy() else 'not set ⚪ (falls back to YT_PROXY)'}",
|
|
|
|
| 269 |
yield (status(f"🏆 Picked **{best.get('title', best['video_id'])}** {picked_msg}."),
|
| 270 |
ranking, gr.update(), gr.update())
|
| 271 |
|
| 272 |
+
# 3. Transcript (transcriptapi.com primary, youtube-transcript-api fallback) --
|
| 273 |
progress(0.3, desc="Transcript")
|
| 274 |
+
tsrc = ("transcriptapi.com (no proxy)" if os.environ.get("TRANSCRIPTAPI_KEY")
|
| 275 |
+
else "youtube-transcript-api via proxy")
|
| 276 |
+
yield status(f"📝 Fetching the timestamped transcript — {tsrc}…"), ranking, gr.update(), gr.update()
|
| 277 |
segs = transcribe_mod.get_segments(best["video_id"], proxy=proxy)
|
| 278 |
transcript = transcribe_mod.transcript_text(segs)
|
| 279 |
yield (status(f"Transcript ready ({len(segs)} segments)."),
|