This project TwitchDownloader2
is a fork of TwitchDownloader, which only does:
metadata.txt
.index-dvr.m3u8
, inserting a custom tag #CUSTOM-DOWNLOADER:
in second line.See source code only changes from lay295's version to TwitchDownloader2
since last sync, for selected branch:
git diff 4c11919149974182f9a707eefae5dc9526258ff8 HEAD -- . ':(exclude)README.md' ':(exclude)publish-rename-all-cli.sh'
This program is designed to work with the twitch-batch-downloader scripts, when selected as downloader.
The READMEs in other languages than English are not up-to-date with this notice.
The self-contained executables for various architectures are available in the Files/Releases section, renamed to TwitchDownloaderCLI2(.exe)
, so are not mistaken with the original ones from GitHub.
If the binary is for macOS, and has not been compiled on the same machine (for example downloaded from the Releases section), is mandatory to self-sign it and remove it from quarantine. Otherwise it will be killed instantly upon execution (may depend on macOS version or hardware):
$ ./TwitchDownloaderCLI2 help
Killed: 9
Checking the logs to make sure it was blocked and it's not a faulty executable:
$ log show --predicate 'eventMessage contains "TwitchDownloaderCLI2"' --last 1h
Filtering the log data using "composedMessage CONTAINS "TwitchDownloaderCLI2""
Skipping info and debug messages, pass --info and/or --debug to include.
Timestamp Thread Type Activity PID TTL
2024-02-26 10:10:24.823327+0000 0x5cd311 Default 0x0 0 0 kernel: (AppleSystemPolicy) ASP: Security policy would not allow process: 65440, TwitchDownloaderCLI2
2024-02-26 10:10:25.263282+0000 0x5cd316 Default 0x0 260 0 syspolicyd: (Security) [com.apple.securityd:gk] temporarySigning type=1 matchFlags=0x0 path=TwitchDownloaderCLI2
2024-02-26 10:10:46.417458+0000 0x5cd497 Default 0x0 0 0 kernel: (AppleSystemPolicy) ASP: Security policy would not allow process: 65454, TwitchDownloaderCLI2
2024-02-26 10:10:52.887625+0000 0x5cd4ea Default 0x0 0 0 kernel: (AppleSystemPolicy) ASP: Security policy would not allow process: 65462, TwitchDownloaderCLI2
2024-02-26 10:10:53.789344+0000 0x5cd50f Default 0x0 0 0 kernel: (AppleSystemPolicy) ASP: Security policy would not allow process: 65468, TwitchDownloaderCLI2
2024-02-26 10:13:36.478086+0000 0x5cdc83 Default 0x0 0 0 kernel: (AppleSystemPolicy) ASP: Security policy would not allow process: 65568, TwitchDownloaderCLI2
2024-02-26 10:15:03.181237+0000 0x5cdfdc Default 0x0 0 0 kernel: (AppleSystemPolicy) ASP: Security policy would not allow process: 65596, TwitchDownloaderCLI2
2024-02-26 10:16:36.063926+0000 0x5ce61b Default 0x0 0 0 kernel: (AppleSystemPolicy) ASP: Security policy would not allow process: 65870, TwitchDownloaderCLI2
2024-02-26 10:16:38.650626+0000 0x5ce644 Default 0x0 0 0 kernel: (AppleSystemPolicy) ASP: Security policy would not allow process: 65876, TwitchDownloaderCLI2
--------------------------------------------------------------------------------------------------------------------
Log - Default: 9, Info: 0, Debug: 0, Error: 0, Fault: 0
Activity - Create: 0, Transition: 0, Actions: 0
To fix the issue for the local computer:
$ xattr -d com.apple.quarantine TwitchDownloaderCLI2
$ codesign --force --deep --sign - TwitchDownloaderCLI2
1) Clone the project:
git clone git://git.code.sf.net/p/twitchdownloader2/code TwitchDownloader2
2) Change CWD to project's top folder:
cd TwitchDownloader2
3.1) Run the script publish-rename-all-cli.sh
, to compile and rename the executables (bytecode) for all profiles. It can compile for 3 cases:
TwitchDownloader
project: compiles as TwitchDownloaderCLI(.exe)
, as self-contained. The script has to be copied over since it's not included in that project.TwitchDownloader2
project, master
branch: compiles as TwitchDownloaderCLI2(.exe)
, as self-contained.TwitchDownloader2
project, debug
branch: compiles as TwitchDownloaderCLI2(.exe)
, as not self-contained. The important files here are the TwitchDownloaderCLI.dll
(which are not renamed).3.2) or publish manually (only when as self-contained):
Restore all the dependencies and tools for the CLI only:
dotnet restore TwitchDownloaderCLI
Build all the executables for all the currently available architectures:
dotnet publish TwitchDownloaderCLI -p:PublishProfile=Windows
dotnet publish TwitchDownloaderCLI -p:PublishProfile=Linux
dotnet publish TwitchDownloaderCLI -p:PublishProfile=LinuxAlpine
dotnet publish TwitchDownloaderCLI -p:PublishProfile=LinuxArm
dotnet publish TwitchDownloaderCLI -p:PublishProfile=LinuxArm64
dotnet publish TwitchDownloaderCLI -p:PublishProfile=MacOS
dotnet publish TwitchDownloaderCLI -p:PublishProfile=MacOSArm64
Rename them to TwitchDownloaderCLI2
(only if it's this fork):
find TwitchDownloaderCLI/bin/Release/net9.0/publish/ -name 'TwitchDownloaderCLI' -exec mv {} {}2 \;
find TwitchDownloaderCLI/bin/Release/net9.0/publish/ -name 'TwitchDownloaderCLI.exe' -exec sh -c 'mv "$1" "${1%.exe}2.exe"' sh {} \;
They will be located in each subdirectory (the Windows build is the only one that has filename extension):
TwitchDownloaderCLI/bin/Release/net9.0/publish/Windows/TwitchDownloaderCLI2.exe
TwitchDownloaderCLI/bin/Release/net9.0/publish/Linux/TwitchDownloaderCLI2
TwitchDownloaderCLI/bin/Release/net9.0/publish/LinuxAlpine/TwitchDownloaderCLI2
TwitchDownloaderCLI/bin/Release/net9.0/publish/LinuxArm/TwitchDownloaderCLI2
TwitchDownloaderCLI/bin/Release/net9.0/publish/LinuxArm64/TwitchDownloaderCLI2
TwitchDownloaderCLI/bin/Release/net9.0/publish/MacOS/TwitchDownloaderCLI2
TwitchDownloaderCLI/bin/Release/net9.0/publish/MacOSArm64/TwitchDownloaderCLI2
4) Then copy to any system-wide folder in $PATH
as TwitchDownloaderCLI2
, for example the Linux variant:
sudo cp TwitchDownloaderCLI/bin/Release/net9.0/publish/Linux/TwitchDownloaderCLI2 /usr/local/bin/
or just for the current user to local bin path ~/bin/
or ~/.local/bin
:
cp TwitchDownloaderCLI/bin/Release/net9.0/publish/Linux/TwitchDownloaderCLI2 ~/bin/
Mark the file as executable if the operating system is not Windows:
chmod +x TwitchDownloaderCLI2
This project has 2 branches: master
(default) and debug
. The debug branch is exactly the same as master, except that prints some variables and its content to terminal. This was done to help create the script twitch-batch-downloader/twitchdownloader-shell.sh
, and only affects the verb videodownload
.
To switch to this branch, clone the repository as usual then switch:
git clone git://git.code.sf.net/p/twitchdownloader2/code TwitchDownloader2
cd TwitchDownloader2
git checkout debug
The debugging is done usually with Visual Studio Code (VSC), and there's the required file .vscode/launch.json
specific for this.
To debug with VSC, the bytecode must be compiled without being self-contained. The script publish-rename-all-cli.sh
detect this automatically, so can run to build the alternative bytecode if hasn't been done already.
To manually compile for each RuntimeIdentifier
:
dotnet publish TwitchDownloaderCLI -c Debug -r linux-musl-x64 --self-contained false
dotnet publish TwitchDownloaderCLI -c Debug -r linux-arm64 --self-contained false
dotnet publish TwitchDownloaderCLI -c Debug -r linux-arm --self-contained false
dotnet publish TwitchDownloaderCLI -c Debug -r linux-x64 --self-contained false
dotnet publish TwitchDownloaderCLI -c Debug -r osx-arm64 --self-contained false
dotnet publish TwitchDownloaderCLI -c Debug -r osx-x64 --self-contained false
dotnet publish TwitchDownloaderCLI -c Debug -r win-x64 --self-contained false
Optionally TwitchDownloaderCLI
can be renamed to TwitchDownloaderCLI2
, but doesn't matter because the debugging is done by means of the dll (this is what VSC does):
/opt/homebrew/bin/dotnet TwitchDownloaderCLI/bin/Debug/net9.0/osx-arm64/publish/TwitchDownloaderCLI.dll videodownload -u 49711043 --temp-path ./ -o output.mp4 --banner false
This document is also partially available in other languages:
https://user-images.githubusercontent.com/1060681/197653099-c3fd12c2-f03a-4580-84e4-63ce3f36be8d.mp4
The Windows WPF GUI implements all of the main functions of the program along with some extra quality of life functions:
The Windows WPF GUI is available in multiple languages thanks to community translations. See the Localization section of the WPF README for more details.
The Windows WPF GUI comes bundled with both light and dark themes, along with an option to update live according the current Windows theme. It also supports user created themes! See the Theming section of the WPF README for more details.
https://www.youtube.com/watch?v=0W3MhfhnYjk
(older version, same concept)
Check twitch-downloader-gui on github or on the AUR for a Linux GUI wrapper for the CLI.
No GUI is available for MacOS yet :(
The CLI is cross-platform and implements the main functions of the program. It works on Windows, Linux, and MacOS*.
*Only Intel Macs have been tested
With the CLI, it is possible to automate video processing using external scripts. For example, you could copy-paste the following code into a .bat
file on Windows to download a VOD and its chat, and then render the chat, all from a single input.
@echo off
set /p vodid="Enter VOD ID: "
TwitchDownloaderCLI.exe videodownload --id %vodid% --ffmpeg-path "ffmpeg.exe" -o %vodid%.mp4
TwitchDownloaderCLI.exe chatdownload --id %vodid% -o %vodid%_chat.json -E
TwitchDownloaderCLI.exe chatrender -i %vodid%_chat.json -h 1080 -w 422 --framerate 30 --update-rate 0 --font-size 18 -o %vodid%_chat.mp4
TwitchDownloaderCLI.exe
.cd C:\folder\containing\TwitchDownloaderCLI
TwitchDownloaderCLI.exe ffmpeg --download
TwitchDownloaderCLI.exe videodownload --id <vod-id-here> -o out.mp4
You can find more example commands in the CLI README.
fontconfig
and libfontconfig1
are installed. apt-get install fontconfig libfontconfig1
on Ubuntu.TwitchDownloaderCLI
.cd directory/containing/TwitchDownloaderCLI
sudo chmod +x TwitchDownloaderCLI
./TwitchDownloaderCLI ffmpeg --download
sudo chmod +x ffmpeg
./TwitchDownloaderCLI videodownload --id <vod-id-here> -o out.mp4
You can find more example commands in the CLI README.
arch -x86_64 zsh
TwitchDownloaderCLI
.cd directory/containing/TwitchDownloaderCLI
chmod +x TwitchDownloaderCLI
./TwitchDownloaderCLI ffmpeg --download
chmod +x ffmpeg
./TwitchDownloaderCLI videodownload --id <vod-id-here> -o out.mp4
You can find more example commands in the CLI README.
git clone https://github.com/lay295/TwitchDownloader.git
cd TwitchDownloader
dotnet restore
Non-Windows devices may need to explicitly specify a project to restore, i.e. dotnet restore TwitchDownloaderCLI
a) Build the GUI:
dotnet publish TwitchDownloaderWPF -p:PublishProfile=Windows
dotnet publish TwitchDownloaderCLI -p:PublishProfile=<Profile>
Applicable Profiles: Windows
, Linux
, LinuxAlpine
, LinuxArm
, LinuxArm64
, MacOS
, MacOSArm64
a) Navigate to the GUI build folder:
cd TwitchDownloaderWPF/bin/Release/net6.0-windows/publish/win-x64
cd TwitchDownloaderCLI/bin/Release/net6.0/publish
Chat Renders are rendered with SkiaSharp and HarfBuzzSharp © Microsoft Corporation.
Chat Renders are encoded and Video Downloads are finalized with FFmpeg © The FFmpeg developers.
Chat Renders may use Noto Color Emoji © Google and contributors.
Chat Renders may use Twemoji © Twitter and contributors.
Bundled FFmpeg binaries are fetched from gyan.dev © Gyan Doshi.
FFmpeg binaries fetched are runtime are downloaded using Xabe.FFmpeg.Downloader © Xabe.
Chat Html exports utilize the Inter typeface hosted by the Google Fonts API © Google.
For a full list of utilized external libraries, see THIRD-PARTY-LICENSES.txt.
TwitchDownloader is in no way associated with Twitch Interactive, Inc. or its affiliates.