inventwithdean commited on
Commit
3c22c57
·
1 Parent(s): a99b25c

move pytchat init inside thread

Browse files
Files changed (1) hide show
  1. yt_chat.py +2 -4
yt_chat.py CHANGED
@@ -6,9 +6,7 @@ from guard import Guardian
6
  from tv_crew import TVCrew
7
  import requests
8
  import time
9
- import httpx
10
- res = httpx.get("https://www.youtube.com")
11
- print(res.status_code)
12
  # load_dotenv()
13
  unreal_orchestrator_url = os.getenv("ORCHESTRATOR_URL")
14
  api_key_unreal = os.getenv("API_KEY_UNREAL")
@@ -16,7 +14,6 @@ api_key_unreal = os.getenv("API_KEY_UNREAL")
16
  API_KEY = os.getenv("YOUTUBE_API_KEY")
17
  VIDEO_ID = "xBVJIJQg1FY"
18
  POLL_INTERVAL = 3 # seconds
19
- chat = pytchat.create(video_id=VIDEO_ID)
20
 
21
 
22
  class StreamChatHost:
@@ -36,6 +33,7 @@ Keep your responses short, like two or three sentences, and be witty."""
36
  self.headers = {"Content-Type": "application/json", "x-api-key": api_key_unreal}
37
 
38
  def chat_interaction_loop(self):
 
39
  """Checks if the Host is in lobby, then pulls chat messages from the Live Stream. The Host then replies to the message."""
40
  while chat.is_alive():
41
  for c in chat.get().sync_items():
 
6
  from tv_crew import TVCrew
7
  import requests
8
  import time
9
+
 
 
10
  # load_dotenv()
11
  unreal_orchestrator_url = os.getenv("ORCHESTRATOR_URL")
12
  api_key_unreal = os.getenv("API_KEY_UNREAL")
 
14
  API_KEY = os.getenv("YOUTUBE_API_KEY")
15
  VIDEO_ID = "xBVJIJQg1FY"
16
  POLL_INTERVAL = 3 # seconds
 
17
 
18
 
19
  class StreamChatHost:
 
33
  self.headers = {"Content-Type": "application/json", "x-api-key": api_key_unreal}
34
 
35
  def chat_interaction_loop(self):
36
+ chat = pytchat.create(video_id=VIDEO_ID)
37
  """Checks if the Host is in lobby, then pulls chat messages from the Live Stream. The Host then replies to the message."""
38
  while chat.is_alive():
39
  for c in chat.get().sync_items():