Resource icon

OBS Python Twitch Switcher 0.1

ZiltoidRacer

New Member
i have not installed this so cannot say but the instructions in the code are
# notes : Follow this step for this script to work:
# : Python:
# : 1. Install python (v3.6 and 64 bits, this is important)
# : 2. Install python-twitch-client (python -m pip install python-twitch-client)
# : OBS:
# : 1. Go to Tools › Scripts
# : 2. Click the "Python Settings" tab
# : 3. Select your python install path
# : 4. Click the "Scripts" tab
# : 5. Click the "+" button and add this script
# : 6. Set the Timespan between Scene Checks
# : 7. Modify Scene List
# : 8. Check "Enable"

i would think there is no auth as it's all done on OBS Studio which already has your stream key so has auth by default.
 

Bootscreen

New Member
Sorry, i didn't get any notification from this thread. You need python and python-twitch-client. without python you didn't see any settings.
 

GelmoSan

New Member
Script doesn't work with Python 3.6 x64 on Windows unless you explicitly import importlib.util. I got it working by adding the line in the correct place:

Python:
import obspython as obs
import os, sys, importlib
import importlib.util

I'm not sure if this breaks anything for other OS's/Distros, but if not, you may want to implement that. Thank you for the excellent script!
 

shplack

New Member
Script doesn't work with Python 3.6 x64 on Windows unless you explicitly import importlib.util. I got it working by adding the line in the correct place:

Python:
import obspython as obs
import os, sys, importlib
import importlib.util

I'm not sure if this breaks anything for other OS's/Distros, but if not, you may want to implement that. Thank you for the excellent script!

Doing this broke the script for me.

I am not able to get this script to work. I'm not sure why, but I think it has something to do with creating the client ID and which Redirect URI I am to use. I am not familiar with Twitch API. I tried using http://localhost, but to no avail.
Also, creating the token makes me unsure if I am doing it correctly. I clicked the link, and two tokens were created. An access token and a refresh token. Which am I to use? Does it even matter?

After guessing and trial and error, I am unable to get the script to work. The game title does not update. Nothing happens when I refresh the Live Dashboard on my Twitch page. I don't get any errors with debugging enabled. What am I doing wrong?

Thanks in advance,
shplack
 

GelmoSan

New Member
Doing this broke the script for me.

I am not able to get this script to work. I'm not sure why, but I think it has something to do with creating the client ID and which Redirect URI I am to use. I am not familiar with Twitch API. I tried using http://localhost, but to no avail.
Also, creating the token makes me unsure if I am doing it correctly. I clicked the link, and two tokens were created. An access token and a refresh token. Which am I to use? Does it even matter?

After guessing and trial and error, I am unable to get the script to work. The game title does not update. Nothing happens when I refresh the Live Dashboard on my Twitch page. I don't get any errors with debugging enabled. What am I doing wrong?

We'll need some more info to help you out. What OS are you on, what Python version, and how was Python installed? In OBS, you need to go to Tools > Scripts and then go to the Python Settings tab. You need to select the path where you installed Python. For example, I installed Python 3.6 x64 on Windows 10 using the official installer for 3.6. I installed it for my user only instead of globally, so this is the path I use (which you will need to adjust to your install location; this is just an example):
Code:
C:/Users/Gelmo/AppData/Local/Programs/Python/Python36

Then, for the script settings, you need to have Enabled checked and if you want to test it without going live you need to uncheck Only Live.

The Client ID is the code you get when filling out the forms here:
https://dev.twitch.tv/console/apps/create

The Oauth Token is the Access Token that you get from https://twitchtokengenerator.com/. The Refresh Token is used to get a new token from that site before 60 days have passed. Use the Access Token in the script settings.

This script requires python-twitch-client to be installed, as it says in the script's comments. You need to open a console (Press Windows, type "cmd", select Command Prompt), change directory into where you have installed Python 3.6 x64 (you'll need to adjust the path below accordingly), update pip, and then install python-twitch-client:
Code:
cd C:/Users/Gelmo/AppData/Local/Programs/Python/Python36
python.exe -m pip install --upgrade pip
python.exe -m pip install python-twitch-client

Let me know if the issue persists after you have confirmed that you have done the above and are using the Access Token for the Oauth Token field.
 

shplack

New Member
We'll need some more info to help you out. What OS are you on, what Python version, and how was Python installed? In OBS, you need to go to Tools > Scripts and then go to the Python Settings tab. You need to select the path where you installed Python. For example, I installed Python 3.6 x64 on Windows 10 using the official installer for 3.6. I installed it for my user only instead of globally, so this is the path I use (which you will need to adjust to your install location; this is just an example):
Code:
C:/Users/Gelmo/AppData/Local/Programs/Python/Python36

Then, for the script settings, you need to have Enabled checked and if you want to test it without going live you need to uncheck Only Live.

The Client ID is the code you get when filling out the forms here:
https://dev.twitch.tv/console/apps/create

The Oauth Token is the Access Token that you get from https://twitchtokengenerator.com/. The Refresh Token is used to get a new token from that site before 60 days have passed. Use the Access Token in the script settings.

This script requires python-twitch-client to be installed, as it says in the script's comments. You need to open a console (Press Windows, type "cmd", select Command Prompt), change directory into where you have installed Python 3.6 x64 (you'll need to adjust the path below accordingly), update pip, and then install python-twitch-client:
Code:
cd C:/Users/Gelmo/AppData/Local/Programs/Python/Python36
python.exe -m pip install --upgrade pip
python.exe -m pip install python-twitch-client

Let me know if the issue persists after you have confirmed that you have done the above and are using the Access Token for the Oauth Token field.
I've completed all the required steps. I am on Windows 10 x64 as well, Python 3.6 x64 installed globally with Path created. I even upgraded pip and installed the Twitch package. Still no luck.

I am unsure if http://localhost is the Redirect URI I should be using. I have entered the details that way, using the created access token for my channel. Otherwise, using debug, the script does not detect any errors. It does try to update the game on my Twitch channel as stated in the debugging, but no changes take effect.
 

GelmoSan

New Member
I've completed all the required steps. I am on Windows 10 x64 as well, Python 3.6 x64 installed globally with Path created. I even upgraded pip and installed the Twitch package. Still no luck.

I am unsure if http://localhost is the Redirect URI I should be using. I have entered the details that way, using the created access token for my channel. Otherwise, using debug, the script does not detect any errors. It does try to update the game on my Twitch channel as stated in the debugging, but no changes take effect.

I use https://localhost without issues (notice that I'm using https instead of http).
 

Foofah

New Member
Hi all, I have no knowledge of Pytjon and am currently trying to make this work (if it still does).
I have installed Python 36 64bit. Aaaand... this is where it ends.

What do I do now?

All the explanations above I do not understand. Is there anyone around that can explain to me (in layman's terms) what to do next?

I open the Python console (Python 3.8 64bit).
I c/p "python.exe -m pip install python-twitch-client"
I get
Code:
>>> python.exe -m pip install python-twitch-client
  File "<stdin>", line 1
    python.exe -m pip install python-twitch-client

Why? How? What? .. ;)
 
Top