Crates.io | twitch_archiver |
lib.rs | twitch_archiver |
version | 0.3.3 |
source | src |
created_at | 2023-11-19 02:25:46.430904 |
updated_at | 2023-11-19 14:33:09.008454 |
description | A small library for downloading Twitch VODs. |
homepage | |
repository | https://github.com/F0903/twitch_archiver |
max_upload_size | |
id | 1040870 |
size | 31,956 |
A fast and tiny downloader for Twitch VODs (also sub-only).
Functionality is currently extremely barebones, with only hls stream download and conversion support. No VOD metadata is provided as of yet.
For the CLI program see the twitch_archiver_cli repo.
use twitch_archiver::{
convert::{convert_hls_to_file},
Twitch,
};
let twitch = Twitch::new(**your_client_id**, **auth_token_if_needed**);
let hls = twitch.get_hls_manifest("url")?;
convert_hls_to_file(hls, **your_output_path.mp4**, **optional_ffmpeg_input_args**,**optional_ffmpeg_output_args**)?;
// Done!
To download sub only VODs, you need to provide an OAuth token.
To get your OAuth token, follow the method on getting your client id above, but copy the value of the "Authorization" header instead, without the first "OAuth" part.
For faster conversion, you can use hardware acceleration arguments provided to FFmpeg when using convert_hls_to_file. For Nvidia GPUs, you can use the following arguments:
input_args = "-hwaccel cuda"
output_args = "-c:v h264_nvenc"