make your own local api and fetching from Youtube Live chat
use !c to talk with the ai chatbot in the youtube live comments
this is for using my sillytavern ai live chat extension https://github.com/aziib/Extension-LiveChat
if you like my code and used it, please support me on ko-fi https://ko-fi.com/megaaziib
your support help me improved on this project.
☢ You will need to take full responsibility for your action ☢
Python: https://www.python.org/downloads/
i'm using python 3.11, don't know if other version will work
make sure you tick check add to path when installing the python
Git: https://git-scm.com/downloads
- Clone this repository
git clone https://github.com/aziib/YoutubeLiveChatLocalApi
- go to the folder and Setup virtual environment
python -m venv venv- Activate virtual environment
venv\Scripts\activate.bat- Install requirements
pip install -r requirements.txt- Edit fetching.py using notepad or any text editor and change video_id on line 8 to your youtube video id and then save it
chat = pytchat.create(video_id="4xDzrJKXOOY") \\<--- change this to your youtube video link id, it's unique numbers & letters after https://www.youtube.com/watch?v=-
Run fetch.bat, it will fetch the live comments and saved it as json file named chat_saved.json. do not close the bat, don't open the json file or deleted it until you want to end your stream. (only delete the chat_saved.json file if you want to start new live stream)
-
Run api.bat, it will create local api at port 5006 and then you can get the api calls by type http://127.0.0.1:5006/chat
- run install.bat, wait until it finish and then close it
- Edit fetching.py using notepad or any text editor and change video_id on line 8 to your youtube video id and then save it
chat = pytchat.create(video_id="4xDzrJKXOOY") \\<--- change this to your youtube video link id, it's unique numbers & letters after https://www.youtube.com/watch?v=-
Run fetch.bat, it will fetch the live comments and saved it as json file named chat_saved.json. do not close the bat, don't open the json file or deleted it until you want to end your stream. (only delete the chat_saved.json file if you want to start new live stream)
-
Run api.bat, it will create local api at port 5006 and then you can get the api calls by type http://127.0.0.1:5006/chat