Giter VIP home page Giter VIP logo

twitch-to-m3u's Introduction

twitch-to-m3u

Pulls the live stream of twitch channels into an m3u

Choose method to run

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

Method 1 Requirements

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

How to run

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 

Method 2 Requirements

Node.js https://nodejs.org/en

How to install

git clone https://github.com/purplescorpion1/twitch-to-m3u.git

cd twitch-to-m3u

npm install puppeteer

npm install -g streamlink

How to configure

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

Optional configure

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)

How to run

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

Optional steps

Create a dummy EPG using a dummy EPG script e.g. from https://github.com/yurividal/dummyepgxml

twitch-to-m3u's People

Contributors

purplescorpion1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.