Pulls the live stream of twitch channels into an m3u
Method 1 - Automatic on windows via the twitch API using python - Will pull live streams of the people you follow
Method 2 - Manual on any opperating system using node - Will pull live streams of the URLs you add to script
Download the exe from the releases section https://github.com/purplescorpion1/twitch-to-m3u/releases
python with pip only if you get errors about dependencies so you can manually install them
Note if you used a previous version you may have to rename config.ini to anything else so you can recreate it. You can copy and paste existing details from it into the cmd window when asked and then add anything additional
Run Twitch_Followed.exe
It will ask for the
Access token
Client ID
User ID
Twitch OAuth
Go to https://twitchtokengenerator.com/
Under available token scopes set user:read:follows to Yes
Scroll down and click generate token - sign in/authorize twitch to use
Verify captcha
Under generated tokens
Copy access token to Twitch_Followed to cmd window
Copy client id to Twitch_Followed cmd window
Go to https://www.streamweasels.com/tools/convert-twitch-username-to-user-id/
Enter your twitch username
Convert twitch username to ID
Copy Twitch ID to Twitch_Followed cmd window
Go to https://www.twitch.tv/ sign in and view a stream
Open the developer tools of web browser (ctrl + shift + I)
Go to the console
Type (you may have to type confirmation to enable pasting of code into console first)
document.cookie.split("; ").find(item=>item.startsWith("auth-token="))?.split("=")[1]
Copy the resulting string consisting of 30 alphanumerical characters without any quotations
Copy TwitchOAuth to Twitch_Followed cmd window
It will then output twitch_followed.m3u
If you need to change your token details etc you can by either editing config.ini or delete config.ini and start again
If any errors in running the exe you can manually install the dependencies
pip install requests
pip install configparser
pip install streamlink
Node.js https://nodejs.org/en
git clone https://github.com/purplescorpion1/twitch-to-m3u.git
cd twitch-to-m3u
npm install puppeteer
npm install -g streamlink
Open twitch.js with notepad++
Change
'https://www.twitch.tv/stream1',
'https://www.twitch.tv/stream2',
to the actual URLs of the stream (change stream1 and stream2 to the username of the streamers at the end of the URL)
Add additional URLs as required
You can leave URLs of channels that are not currently live in the script as it will only pull the channels that it finds an active live stream
You can add your twitch0auth in to remove the commercial break in progress screen from the channels you subscribe to
Go to https://www.twitch.tv/ sign in and view a stream
Open the developer tools of web browser (ctrl + shift + I)
Go to the console
Type (you may have to type confirmation to enable pasting of code into console first)
document.cookie.split("; ").find(item=>item.startsWith("auth-token="))?.split("=")[1]
Copy the resulting string consisting of 30 alphanumerical characters without any quotations
Open live.py with notepad++ (or any coding text editor)
Change
streamlink_process = subprocess.Popen(['streamlink', url, 'best', '--json', '--twitch-disable-ads', '--twitch-low-latency'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
To
streamlink_process = subprocess.Popen(['streamlink', '--twitch-api-header=Authorization=OAuth abcdefghigklmnop', 'twitch.tv/' + channelName, 'best', '--json', '--twitch-disable-ads', '--twitch-low-latency'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Changing abcdefghigklmnop to your twitchOauth (there is space between OAuth and your token code)
node twitch.js
Output will be twitch.m3u containing available live streams
Run script each time the streamer you want to watch goes live
Add/remove urls as required
Create a dummy EPG using a dummy EPG script e.g. from https://github.com/yurividal/dummyepgxml