A user-friendly tool for accessing and watching live streams, videos, and clips from Twitch.
Note
Playback via mpv uses Twitch’s public streams.
Twitch Prime does not guarantee ad-free playback outside the official web player.
pytwitch.mp4
For authentication, you can set environment vars in your shell and export them or use the
.env file and put it in the root of the project.
env-template file
# Twitch credentials
TWITCH_CLIENT_ID="xxxxx"
TWITCH_ACCESS_TOKEN="xxx"
TWITCH_USER_ID="123456"- Twitch token generator
- Scope:
user:read:follows
- Scope:
- Twitch Channel ID and User ID Converter
# Clone repository
$ git clone "https://github.com/mateconpizza/pytwitch.git"
$ cd pytwitch
# Create virtual environment & source
$ python -m venv .venv
$ source .venv/bin/activate
# Install requirements
(.venv) $ pip install -r requirements.txt
# Install
(.venv) $ pip install .Using uv
# Clone repository
git clone https://github.com/mateconpizza/pytwitch.git
cd pytwitch
# Create virtual environment
uv venv .venv
source .venv/bin/activate
# Install
uv pip install .After installation, the command pytwitch is available in your $PATH
You may want to define an alias to always load your environment file:
alias pt='pytwitch -e ~/path/to/.env'- If a
.envfile exists in the projectroot, it is loaded automatically. - You can explicitly specify a file using
--env.
$ pytwtich -h
Simple tool menu for watching streams, videos from Twitch.
arguments:
-m, --menu select menu [rofi|dmenu|fzf] (default: rofi)
-e, --env path to env file
-C, --channel search by channel query
-G, --games search by game or category
-v, --verbose increase verbosity (-v, -vv, or -vvv)
-h, --help show this help
options:
--no-markup disable pango markup (rofi)
--no-ansi disable ANSI color codes (fzf)
--no-conf disable mpv configurationpytwitch --env ~/secrets/twitch.env| Keybind | Usage |
|---|---|
| alt-k | list keybinds |
| alt-s | search by category or game |
| alt-c | search by channel |
| alt-v | list channel's videos |
| alt-t | group by category or game |
| alt-o | open stream chat in browser |
| alt-i | show item information |
| alt-m | show top streams |
| alt-g | show top games with streams |
- Find a better and easy way to get the credentials priority
- Finish tests
- Create/Update requirements/dependencies
- Complete Usage
- Update screenshots
- Better logging
- Update GIFs
- Update
argparsehelp - Display
keybinds