로딩
요청 처리 중입니다...

유튜브 라이브 채팅창 내용 가져오기

 유튜브 라이브 채팅창 내용 가져오기

유튜브 라이브 채팅창의 내용을 가져와 가공하고 싶다면 유튜브 데이터 API의 liveChatMessage 앤드포인트를 사용하여 가져오거나 pytchat 라이브러리를 사용해서 가져오면 된다. 물론, pytchat 를 사용하는 것이 간단하기 때문에 이를 이용해서 가져와보겠다.

일단. pytchat 을 설치하고 -> pip install pytchat 아래와 같이 코딩한다. import pytchat video_id = "유튜브 라이브 아이디" chat = pytchat.create(video_id=video_id) while chat.is_alive(): for chat_message in chat.get().sync_items(): print(f"{chat_message.author.name}: {chat_message.message}") 코드를 실행하면 채팅창의 내용을 가져와 화면에 출력한다....