Skip to content

Instantly share code, notes, and snippets.

@fourst4r
Created September 8, 2024 12:02
Show Gist options
  • Save fourst4r/69a3b3b699d8e5249b7ea3f8a66c04a8 to your computer and use it in GitHub Desktop.
Save fourst4r/69a3b3b699d8e5249b7ea3f8a66c04a8 to your computer and use it in GitHub Desktop.
Script to record twitch streams with streamlink (neem's movie night)
param (
[string]$username
)
while ($true) {
$timestamp = [DateTimeOffset]::Now.ToUnixTimeSeconds()
$videosDir = "$env:USERPROFILE\Videos\$username"
if (-not (Test-Path -Path $videosDir)) {
New-Item -Path $videosDir -ItemType Directory | Out-Null
Write-Host "Created directory: $videosDir"
}
$command = "streamlink twitch.tv/$username best -o '$videosDir\${username}_$timestamp.mp4' --stream-segment-attempts 1000 --stream-segment-timeout 10"
Write-Host "Running command: $command"
Invoke-Expression $command
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment