Twitch.tv playlist parser

VLC Playlist Parsers twitch

Source (required if based on other people's work): https://gist.github.com/stefansundin/c200324149bb00001fef5a252a120fc2

2
Score 70%
Description:

Twitch.tv playlist parser

Install:
1. I have included a client_id in this script. If it gets blocked in the future, you can generate your own client at https://www.twitch.tv/settings/connections and put it in the file.
2. Put the file in the lua/playlist/ directory:
- On Windows: %APPDATA%\vlc\lua\playlist\
- On Mac: $HOME/Library/Application Support/org.videolan.vlc/lua/playlist/
- On Linux: ~/.local/share/vlc/lua/playlist/
- On Linux (snap package): ~/snap/vlc/current/.local/share/vlc/lua/playlist/
To install the addon for all users, put the file here instead:
- On Windows: C:\Program Files\VideoLAN\VLC\lua\playlist\
- On Mac: /Applications/VLC.app/Contents/MacOS/share/lua/playlist/
- On Linux: /usr/lib/vlc/lua/playlist/
- On Linux (snap package): /snap/vlc/current/usr/lib/vlc/lua/playlist/
3. Open a twitch.tv url using "Open Network Stream..."

If you are using a Mac and have Homebrew installed, you can download and install with one Terminal command:
brew install --no-sandbox --HEAD stefansundin/tap/vlc-twitch

If you are using a Mac without Homebrew, you can still install by running:
mkdir -p "$HOME/Library/Application Support/org.videolan.vlc/lua/playlist/twitch.lua"
curl -o "$HOME/Library/Application Support/org.videolan.vlc/lua/playlist/twitch.lua" https://gist.githubusercontent.com/stefansundin/c200324149bb00001fef5a252a120fc2/raw/twitch.lua

On Linux, you can download and install by running:
mkdir -p ~/.local/share/vlc/lua/playlist/
curl -o ~/.local/share/vlc/lua/playlist/twitch.lua https://gist.githubusercontent.com/stefansundin/c200324149bb00001fef5a252a120fc2/raw/twitch.lua

Features:
- Load up a channel and watch live, e.g.: https://www.twitch.tv/speedgaming
- Load an archived video, e.g.: https://www.twitch.tv/gamesdonequick/video/113837699
- Load a collection, e.g.: https://www.twitch.tv/videos/112628247?collection=k2Ou9QRbAhUMPw
- Load a game and get the top streams, e.g.: https://www.twitch.tv/directory/game/Minecraft
- Load a game's archived videos, e.g.: https://www.twitch.tv/directory/game/Minecraft/videos/all
- Load a community and get the top streams, e.g.: https://www.twitch.tv/communities/speedrunning
- Load a channel's most recent videos, e.g.: https://www.twitch.tv/speedgaming/videos/all
- Load a channel's collections, e.g.: https://www.twitch.tv/speedgaming/videos?filter=collections
- Load the homepage and get a list of featured streams: https://www.twitch.tv/
- Load Twitch Clips, e.g.: https://clips.twitch.tv/AmazonianKnottyLapwingSwiftRage
- Load a channel's clips, e.g.: https://www.twitch.tv/speedgaming/videos?filter=clips
- Load a game's clips, e.g.: https://www.twitch.tv/directory/game/Minecraft/clips
- Load the next page.

If you are experiencing issues (e.g. seeking), make sure that you are using VLC 3.0. You can also try nightlies: https://nightlies.videolan.org/

In order to load VODs with a timestamp in the url (e.g. ?t=1h10m10s), then you must also install the Twitch.tv extension from here: https://gist.githubusercontent.com/stefansundin/c200324149bb00001fef5a252a120fc2/raw/twitch-extension.lua
Note that this extension must be activated in the VLC menu each time VLC is started (if you know of a workaround for this, please let me know in the comments below).

If you like this addon, please click the [+] in the top right corner. If you have any issues, please report them in the comments below. Thank you!

Note: I expect this addon to stop working on Dec. 31, 2018. This is because API v3 will be deprecated at that time. I am not sure it will be possible to fix, but I will try my best.

Enjoy!!
Last changelog:

v0.2.0 3 months ago

Support new URLs. Most things seem to be working again. Please write a comment if something is still broken.

barsukdaetpizdi

5 months ago

Good addon, thx

Report

bernicestockstill

11 months ago

Very interesting

Report

mp176

1 year ago

Awesome. Thanks for this addon. I so wanted this one. Thanks again!

Report

lib2k

1 year ago

Works great!
Is it possible to parse a link with start time variable?
If I use https://www.twitch.tv/videos/xxxxxxx?t=02h10m15s it still streams from the very beginning instead of the specified time.
Follow up question: is it possible to display the proper time on the seekbar in VLC or will it always stay at 0=:00 when streaming?

Thanks!

Report

C

stefansundin

1 year ago

It seems like it should be possible, by setting a playlist option called "start-time", but I just tried it and it doesn't seem to work. I think VLC doesn't remember it when it goes out to read the m3u8 playlist file. I can't get it to work, sorry.
If you try one of the recent nightlies for VLC 3.0, you can actually see the time remaining. Seeking is still not that great though. I tried version "vlc-3.0.0-20170426-0444-git" on Mac, and I could see the time there. The nightlies are a bit in flux, some versions work very badly while some work better. You might have to test around a bit. Go to nightlies.videolan.org to find a build.
Thanks for the comment!

Report

lib2k

1 year ago

I tried using the start-time option but had the same result, it would play back from the start.
Streaming an 8h long video and trying to guess where the 6:15 mark is or so, on top of the caching each time you switch the position on the seek bar, is really tedious. At least with the time being displayed it is a huge improvement over vanilla builds. I will definitely give nightlies a try. Thank you!

Report

C

stefansundin

1 year ago

Good news! I got it to work by also making a VLC extension. The extension will be notified when you open an input, and if it's a twitch.tv URL with a timestamp, it will seek to that position for you. Compared to manual seeking it is very precise, almost as good as the web player.
So if you want to use this then you need both this playlist parser installed and the extension. Unfortunately you must activate the extension each time you start VLC (I have not found a workaround for this yet).

Get the extension here: https://gist.github.com/stefansundin/c200324149bb00001fef5a252a120fc2#file-twitch-extension-lua

Let me know what you think. :-)

Report

lib2k

1 year ago

Two things I realized and now kinda feel stupid for requesting it.

1. Most VOD streams don't broadcast the video in one huge chunk but rather a bunch of individual segments (caching - how did I even forget about that?). Twitch.tv in particular has it's own technique, which makes it a bit more complex since the VLC seeker utilizes linear extrapolation of the bandwidth to determine the exact time mark.

2. Due to VLC's implementation it is mostly a guess game. Nightly builds seem to help a bit but more than often it will just glitch and either not display the time properly or not at all.

Really appreciate the effort but I think there is only so much you can do without official support. As far as I can tell it is not very high on the list, been neglected for years and might be a long time until we see these changes in a stable build let alone a proper implementation. Nonetheless thanks a bunch, learned something from this.

Report

C

stefansundin

1 year ago

The extension worked really well for me, and seeked within a few seconds of where the web player started playing. The only annoying part is that I have to activate it each time I start VLC.

Report

markusvermund

1 year ago

this one is perfect!

Report

surajvaidya

1 year ago

Nice

Report

v0.2.0 3 months ago

Support new URLs. Most things seem to be working again. Please write a comment if something is still broken.

v0.1.3 5 months ago

Minor fix that prevented me from running this on Ubuntu 18.04 (snap package).

v0.1.2 7 months ago

Support for /directory/game/[name]/videos/[type].

v0.1.1 9 months ago

Support for /[channel]/clips, /directory/game/[name]/clips. Add ability to load the next page.

v0.1.0 1 year ago

Rewrote almost the whole thing. Support for /communities/[name], /directory/game/[name], /[channel]/videos/, collections.

v0.0.6 1 year ago

Support new go.twitch.tv urls (beta site).

v0.0.5 1 year ago

Fix a couple of minor issues.

v0.0.4 1 year ago

Support new twitch.tv/videos/ urls.

v0.0.3 1 year ago

Support for Twitch Clips.

v0.0.2 1 year ago

You can now pick the stream quality you want. The twitch URL will expand to multiple playlist items.

File (click to download) Version Description Packagetype Architecture Downloads Date Filesize DL OCS-Install
Pling
Details
license
GPLv3
version
v0.2.0
updated Aug 05 2018
added Jan 02 2017
downloads today
0
page views today 4
System Tags addon gplv3