Last active
August 6, 2023 19:06
-
-
Save schalkburger/d56ac667a54c02b0b0dd75a6987e2298 to your computer and use it in GitHub Desktop.
Watch a Twitch stream using Streamlink
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Watch a Twitch stream using Streamlink | |
.DESCRIPTION | |
This script lets you choose a Twitch stream to watch with Streamlink | |
.EXAMPLE | |
PS> ./streamlink-twitch | |
.LINK | |
https://gist.github.com/schalkburger/d56ac667a54c02b0b0dd75a6987e2298 | |
.NOTES | |
Author: Schalk Burger | |
#> | |
try { | |
clear-host | |
# Prompt the user for input | |
$value = Read-Host "Please enter a Twitch channel name (e.g. bobross)" | |
# Construct the full URL | |
$url = "https://www.twitch.tv/$value" | |
# Build the Streamlink command | |
$streamlinkCommand = "streamlink $url --default-stream 'best,720p60,720p,480p' --twitch-disable-ads --twitch-low-latency" | |
# Execute the Streamlink command | |
Invoke-Expression $streamlinkCommand | |
exit 0 # success | |
} | |
catch { | |
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" | |
exit 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment