DivYonko commited on
Commit Β·
c34e010
1
Parent(s): 146e596
feat: show scraper error in sidebar UI
Browse files
app.py
CHANGED
|
@@ -166,11 +166,14 @@ def _scraper_thread_fn(video_id: str, redis_key: str, stop_event: threading.Even
|
|
| 166 |
return
|
| 167 |
|
| 168 |
logger.info("Scraper thread starting β video=%s key=%s", video_id, redis_key)
|
|
|
|
| 169 |
|
| 170 |
# Step 1: get the live chat ID
|
| 171 |
live_chat_id = _get_live_chat_id(video_id, api_key)
|
| 172 |
if not live_chat_id:
|
| 173 |
-
|
|
|
|
|
|
|
| 174 |
return
|
| 175 |
|
| 176 |
logger.info("Live chat ID obtained: %s", live_chat_id)
|
|
@@ -790,6 +793,10 @@ with st.sidebar:
|
|
| 790 |
status = "running" if running else "stopped"
|
| 791 |
st.markdown(f'<div style="font-size:0.72rem;color:{dot_color};margin-bottom:4px;">β {status}</div>', unsafe_allow_html=True)
|
| 792 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 793 |
st.divider()
|
| 794 |
|
| 795 |
# ββ Add / Remove stream slots ββ
|
|
|
|
| 166 |
return
|
| 167 |
|
| 168 |
logger.info("Scraper thread starting β video=%s key=%s", video_id, redis_key)
|
| 169 |
+
_META.pop("scraper_error", None)
|
| 170 |
|
| 171 |
# Step 1: get the live chat ID
|
| 172 |
live_chat_id = _get_live_chat_id(video_id, api_key)
|
| 173 |
if not live_chat_id:
|
| 174 |
+
msg = f"No active live chat found for video '{video_id}'. Make sure the stream is currently LIVE."
|
| 175 |
+
logger.error(msg)
|
| 176 |
+
_META["scraper_error"] = msg
|
| 177 |
return
|
| 178 |
|
| 179 |
logger.info("Live chat ID obtained: %s", live_chat_id)
|
|
|
|
| 793 |
status = "running" if running else "stopped"
|
| 794 |
st.markdown(f'<div style="font-size:0.72rem;color:{dot_color};margin-bottom:4px;">β {status}</div>', unsafe_allow_html=True)
|
| 795 |
|
| 796 |
+
# Show scraper error if any (only for stream A)
|
| 797 |
+
if idx == 0 and _META.get("scraper_error"):
|
| 798 |
+
st.error(_META["scraper_error"])
|
| 799 |
+
|
| 800 |
st.divider()
|
| 801 |
|
| 802 |
# ββ Add / Remove stream slots ββ
|