yaydl is Yet Another Youtube Down Loader, written in Rust.

⌈⌋ ⎇ branch:  Yet Another Youtube (and more) Down Loader


Check-in Differences

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Difference From c6723756b0ba3f63 To c115ce129d7a8a03

2023-05-02
17:22
yaydl 0.13.0: Updated dependencies, fixed YouTube (fixes #17). check-in: fd91b0fd14 user: Cthulhux tags: trunk, release-0.13.0
2023-04-03
14:24
whoopsie check-in: c115ce129d user: Cthulhux tags: trunk
13:58
yaydl 0.12.2: youtube uses the agent as well check-in: ee8bc6c2c1 user: Cthulhux tags: trunk, release-0.12.2
2023-03-23
01:59
unbroke build check-in: c6723756b0 user: Cthulhux tags: trunk
2023-02-27
14:59
yaydl 0.12.1: xhamster uses the agent as well ; simplified code check-in: 1e34f21ef5 user: Cthulhux tags: trunk, release-0.12.1

Changes to Cargo.lock.

1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
name = "windows_x86_64_msvc"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"

[[package]]
name = "yaydl"
version = "0.12.1"
dependencies = [
 "anyhow",
 "cienli",
 "clap",
 "env_proxy",
 "fantoccini",
 "indicatif",







|







1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
name = "windows_x86_64_msvc"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"

[[package]]
name = "yaydl"
version = "0.12.2"
dependencies = [
 "anyhow",
 "cienli",
 "clap",
 "env_proxy",
 "fantoccini",
 "indicatif",

Changes to Cargo.toml.

1
2
3
4
5
6
7
8
9
10
11
[package]
name = "yaydl"
description = "yet another youtube (and more) down loader"
version = "0.12.1"
authors = ["Cthulhux <git@tuxproject.de>"]
edition = "2021"
license = "CDDL-1.0"
repository = "https://code.rosaelefanten.org/yaydl"
categories = ["command-line-utilities"]
keywords = ["youtube", "downloading", "video"]




|







1
2
3
4
5
6
7
8
9
10
11
[package]
name = "yaydl"
description = "yet another youtube (and more) down loader"
version = "0.12.2"
authors = ["Cthulhux <git@tuxproject.de>"]
edition = "2021"
license = "CDDL-1.0"
repository = "https://code.rosaelefanten.org/yaydl"
categories = ["command-line-utilities"]
keywords = ["youtube", "downloading", "video"]

Changes to src/handlers/youtube.rs.

17
18
19
20
21
22
23

24
25
26
27
28
29

30








31
32
33
34
35
36
37
38
// - YouTube handler -

use crate::definitions::SiteDefinition;

use anyhow::Result;
use regex::Regex;
use serde_json::{json, Value};


use crate::VIDEO;

fn get_video_info(video: &mut VIDEO, id: &str) -> Result<Value> {
    if video.info.is_empty() {
        // We need to fetch the video information first.

        let video_url = "https://youtubei.googleapis.com/youtubei/v1/player?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8";








        let req = ureq::post(&video_url).send_json(ureq::json!({
            "videoId": id,
            "context": {
                "client": {
                    "clientName": "ANDROID",
                    "clientVersion": "16.02"
                }
            }







>






>

>
>
>
>
>
>
>
>
|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// - YouTube handler -

use crate::definitions::SiteDefinition;

use anyhow::Result;
use regex::Regex;
use serde_json::{json, Value};
use url::Url;

use crate::VIDEO;

fn get_video_info(video: &mut VIDEO, id: &str) -> Result<Value> {
    if video.info.is_empty() {
        // We need to fetch the video information first.
        let mut agent = ureq::agent();
        let video_url = "https://youtubei.googleapis.com/youtubei/v1/player?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8";
        let url_p = Url::parse(video_url)?;

        if let Some(env_proxy) = env_proxy::for_url(&url_p).host_port() {
            // Use a proxy:
            let proxy = ureq::Proxy::new(format!("{}:{}", env_proxy.0, env_proxy.1));
            agent = ureq::AgentBuilder::new().proxy(proxy.unwrap()).build();
        }
        
        let req = agent.post(&video_url).send_json(ureq::json!({
            "videoId": id,
            "context": {
                "client": {
                    "clientName": "ANDROID",
                    "clientVersion": "16.02"
                }
            }