This is a Twitch data api which will automatically update and cache the streamer data. Check out a live demo on live.ratexindex.com.
The api uses the official Twitch api to get the streamer data. You will have to create a new application in the Twitch developer console.
First you will have to clone the project.
$ git clone https://github.com/Siddhart/Twitch-Streamer-ApiAfter that open the config.json file
{
"twitch_clientID": "TWITCH_CLIENT_ID",
"twitch_secret": "TWITCH_SECRET",
"cron": "*/10 * * * *",
"port": 8088,
"endpoint": "/StreamerData",
"authToken": "",
"channels": []
}- twitch_clientID - Enter the Twitch application client ID here (Twitch Developer Console).
- twitch_secret - Generate a api token on the Twitch application page.
- cron - Enter your Update/check interval here (Cron Guru) (this is also the data cache interval).
- port - Enter the port you want the api to be hosted on.
- endpoint - Enter the endpoint for the api.
NOTE: Do NOT change the authToken field. This value will automatically update.
In the config.json there is a channels array. If you want to add streamers you just add new strings to the array.
"channels": ["streamer1", "streamer2", "streamer3"]In order for the bot to work properly you will have to install express, cron and request. Use the following command to install the dependencies.
$ npm install cron request expressAfter you updated the config.json and installed the dependencies you can run the final command. Use the command in the same directory as the index.js file.
$ node index.jsCongratulations! You have successfully setup the Twitch Streamer Data Api. If there are any errors please send me a dm on Discord Siddhartt#2194