Implement 5-second display for video ID in pytchat_listener.py
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import pytchat
|
||||
import sys
|
||||
import os
|
||||
import time
|
||||
from rich.console import Console
|
||||
from rich.style import Style
|
||||
|
||||
@@ -15,6 +16,14 @@ def main():
|
||||
try:
|
||||
livechat = pytchat.create(video_id=video_id)
|
||||
console.print(f"[green]Listening to live chat for video ID: {video_id}[/green]")
|
||||
# pytchat doesn't directly expose the live_chat_id in the same way as the official API
|
||||
# For now, we'll just display the video_id as confirmation.
|
||||
# If a live_chat_id is needed, further pytchat internal analysis would be required.
|
||||
console.print(f"[green]Video ID accepted: {video_id}[/green]")
|
||||
|
||||
# Wait for 5 seconds, then clear the screen
|
||||
time.sleep(5)
|
||||
os.system('clear')
|
||||
|
||||
message_count = 0
|
||||
while livechat.is_alive():
|
||||
@@ -38,4 +47,4 @@ def main():
|
||||
console.print("[yellow]Live chat listener stopped.[/yellow]")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main()
|
||||
Reference in New Issue
Block a user