Crates.io | yaydl |
lib.rs | yaydl |
version | 0.13.0 |
source | src |
created_at | 2020-11-14 01:46:30.395945 |
updated_at | 2023-05-02 17:23:42.968263 |
description | yet another youtube (and more) down loader |
homepage | |
repository | https://code.rosaelefanten.org/yaydl |
max_upload_size | |
id | 312214 |
size | 141,406 |
yet another youtube (and more) down loader
% yaydl "https://www.youtube.com/watch?v=jNQXAC9IVRw"
% yaydl --help
ffmpeg
binary).There is an easy way to add more supported sites, see below for details.
The list of features is deliberately kept short:
yaydl
assumes that you have a large hard drive and your internet connection is good enough, or else you would stream, not download.Install Rust (e.g. with rustup), then:
using Fossil:
% fossil clone https://code.rosaelefanten.org/yaydl
% cd yaydl
% cargo build --release
using Git:
% git clone https://github.com/dertuxmalwieder/yaydl
% cd yaydl
% cargo build --release
% cargo install yaydl
pkgsrc
(with pkg_add
):
% pkg_add yaydl
pkgsrc
(with pkgin
):
% pkgin install yaydl
Other package managers:
yaydl
yet. You can help!For some video sites, yaydl
needs to be able to parse a JavaScript on them. For this, it needs to be able to spawn a headless web browser. It requires Google Chrome, Microsoft Edge or Mozilla Firefox to be installed and running on your system.
yaydl
that you have a web driver running: yaydl --webdriver <port> <video URL>
. (The drivers usually run on port 4444 or 9515, please consult their documentation if you are not sure.)
Hint: If you need this feature regularly, you can also use the environment variable YAYDL_WEBDRIVER_PORT
to set the port number for all further requests.yaydl
now. :-)yaydl at tuxproject dot de
), on the IRC or as a GitHub Pull Request. Note that GitHub only provides a mirror, so you'd double my work if you choose the latter. :-)If you do that well (and regularly) enough, I'll probably grant you commit access to the upstream Fossil repository.
definitions::SiteDefinition
as handlers/<YourSite>.rs
.inventory::submit! { &YourSiteHandler as &dyn SiteDefinition }
handlers.rs
.Cargo.toml
.// handlers/noop.rs
use anyhow::Result;
use crate::definitions::SiteDefinition;
use crate::VIDEO;
struct NoopExampleHandler;
impl SiteDefinition for NoopExampleHandler {
// Parameters sent to the handler by yaydl:
// - url: The video page's URL.
// - webdriver_port: The port that runs the WebDriver client.
// Defaults to 0 if there is no WebDriver configured.
// - onlyaudio: true if only the audio part of the video should be
// kept, else false.
fn can_handle_url<'a>(&'a self, url: &'a str, webdriver_port: u16) -> bool {
// Return true here if <url> can be covered by this handler.
// Note that yaydl will skip all other handlers then.
true
}
fn does_video_exist<'a>(&'a self, video: &'a mut VIDEO, url: &'a str, webdriver_port: u16) -> Result<bool> {
// Return true here, if the video exists.
Ok(false)
}
fn is_playlist<'a>(&'a self, url: &'a str, webdriver_port: u16) -> Result<bool> {
// Return true here, if the download link is a playlist.
Ok(false)
}
fn find_video_title<'a>(&'a self, video: &'a mut VIDEO, url: &'a str, webdriver_port: u16) -> Result<String> {
// Return the video title from <url> here.
Ok("".to_string())
}
fn find_video_direct_url<'a>(&'a self, video: &'a mut VIDEO, url: &'a str, webdriver_port: u16, onlyaudio: bool) -> Result<String> {
// Return the direct download URL of the video (or its audio version) here.
// Exception: If is_playlist() is true, return the playlist URL here instead.
Ok("".to_string())
}
fn find_video_file_extension<'a>(&'a self, video: &'a mut VIDEO, url: &'a str, webdriver_port: u16, onlyaudio: bool) -> Result<String> {
// Return the designated file extension of the video (or audio) file here.
Ok("mp4".to_string())
}
fn display_name<'a>(&'a self) -> String {
// For cosmetics, this is the display name of this handler.
"NoopExample"
}
fn web_driver_required<'a>(&'a self) -> bool {
// Return true here, if the implementation requires a web driver to be running.
false
}
}
// Push the site definition to the list of known handlers:
inventory::submit! {
&NoopExampleHandler as &dyn SiteDefinition
}
Writing this software and keeping it available is eating some of the time which most people would spend with their friends. Naturally, I absolutely accept financial compensation.
Thank you.
irc.oftc.net/yaydl