Feat: Simplify initial message display and ensure tags are hidden.

This commit is contained in:
2025-10-29 13:03:22 +01:00
parent 81a8e3a56b
commit 0801a3413d

10
main.py
View File

@@ -87,17 +87,19 @@ def main():
console.print("[red]Could not find an active live chat for the given video ID.[/red]") console.print("[red]Could not find an active live chat for the given video ID.[/red]")
return return
console.print(f"[green]Found live chat ID: {live_chat_id}[/green]")
# Setup chat logging # Setup chat logging
log_dir = "chat_logs" log_dir = "chat_logs"
os.makedirs(log_dir, exist_ok=True) os.makedirs(log_dir, exist_ok=True)
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
log_filename = os.path.join(log_dir, f"chat_{video_id}_{timestamp}.log") log_filename = os.path.join(log_dir, f"chat_{video_id}_{timestamp}.log")
log_file = open(log_filename, "w", encoding="utf-8") log_file = open(log_filename, "w", encoding="utf-8")
console.print(f"[green]Chat will be logged to {log_filename}[/green]")
# Display initial messages using rich.Live for a few seconds # Wait for 5 seconds, then clear the screen again
with Live(console=console, screen=True, refresh_per_second=4) as live: time.sleep(5)
live.update(Text(f"[green]Found live chat ID: {live_chat_id}[/green]\n[green]Chat will be logged to {log_filename}[/green]", justify="center")) os.system('clear')
time.sleep(5)
next_page_token = None next_page_token = None
message_count = 0 message_count = 0