Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feature yt-dlp to support yt-dlp #19

Merged
merged 1 commit into from
Dec 16, 2021

Conversation

luqmanishere
Copy link
Contributor

This commit adds support for json emitted from yt-dlp, which is only
slightly different from youtube-dl. The changes are gated behind the
yt-dlp feature.

Youtube-dl recently broke again with ytdl-org/youtube-dl#30363 . Since this crate supports specifying youtube-dl's binary name, yt-dlp can be used as an alternative with these changes

This commit adds support for json emitted from `yt-dlp`, which is only
slightly different from `youtube-dl`. The changes are gated behind the
`yt-dlp` feature
@GyrosOfWar
Copy link
Owner

Looks good, thanks!

@GyrosOfWar GyrosOfWar merged commit a76a03c into GyrosOfWar:master Dec 16, 2021
@twiclo
Copy link
Contributor

twiclo commented Jan 4, 2022

This doesn't build for me

$ cargo build --features yt-dlp
   Compiling youtube_dl v0.6.3 (/home/twiclo/Projects/youtube-dl-rs)
error[E0124]: field `filesize_approx` is already declared
  --> src/model.rs:41:5
   |
39 |     pub filesize_approx: Option<String>,
   |     ----------------------------------- `filesize_approx` first declared here
40 |     #[cfg(feature = "yt-dlp")]
41 |     pub filesize_approx: Option<f64>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field already declared

error[E0124]: field `filesize_approx` is already declared
   --> src/model.rs:218:5
    |
216 |     pub filesize_approx: Option<String>,
    |     ----------------------------------- `filesize_approx` first declared here
217 |     #[cfg(feature = "yt-dlp")]
218 |     pub filesize_approx: Option<f64>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field already declared

error[E0025]: field `filesize_approx` bound multiple times in the pattern
  --> src/model.rs:41:5
   |
28 | #[derive(Clone, Serialize, Deserialize, Debug, Default)]
   |          ----- in this derive macro expansion
...
39 |     pub filesize_approx: Option<String>,
   |     ----------------------------------- first use of `filesize_approx`
40 |     #[cfg(feature = "yt-dlp")]
41 |     pub filesize_approx: Option<f64>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ multiple uses of `filesize_approx` in pattern
   |
   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0062]: field `filesize_approx` specified more than once
  --> src/model.rs:41:5
   |
39 |     pub filesize_approx: Option<String>,
   |     ----------------------------------- first use of `filesize_approx`
40 |     #[cfg(feature = "yt-dlp")]
41 |     pub filesize_approx: Option<f64>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ used more than once

error[E0308]: mismatched types
  --> src/model.rs:28:28
   |
28 | #[derive(Clone, Serialize, Deserialize, Debug, Default)]
   |                            ^^^^^^^^^^^ expected `f64`, found struct `std::string::String`
   |
   = note: expected enum `std::option::Option<f64>`
              found enum `std::option::Option<std::string::String>`
   = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0062]: field `filesize_approx` specified more than once
  --> src/model.rs:41:9
   |
28 | #[derive(Clone, Serialize, Deserialize, Debug, Default)]
   |                            ----------- first use of `filesize_approx`
...
41 |     pub filesize_approx: Option<f64>,
   |         ^^^^^^^^^^^^^^^ used more than once

error[E0025]: field `filesize_approx` bound multiple times in the pattern
  --> src/model.rs:41:5
   |
28 | #[derive(Clone, Serialize, Deserialize, Debug, Default)]
   |                                         ----- in this derive macro expansion
...
39 |     pub filesize_approx: Option<String>,
   |     ----------------------------------- first use of `filesize_approx`
40 |     #[cfg(feature = "yt-dlp")]
41 |     pub filesize_approx: Option<f64>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ multiple uses of `filesize_approx` in pattern
   |
   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0025]: field `filesize_approx` bound multiple times in the pattern
   --> src/model.rs:218:5
    |
176 | #[derive(Clone, Serialize, Deserialize, Debug, Default)]
    |          ----- in this derive macro expansion
...
216 |     pub filesize_approx: Option<String>,
    |     ----------------------------------- first use of `filesize_approx`
217 |     #[cfg(feature = "yt-dlp")]
218 |     pub filesize_approx: Option<f64>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ multiple uses of `filesize_approx` in pattern
    |
    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0062]: field `filesize_approx` specified more than once
   --> src/model.rs:218:5
    |
216 |     pub filesize_approx: Option<String>,
    |     ----------------------------------- first use of `filesize_approx`
217 |     #[cfg(feature = "yt-dlp")]
218 |     pub filesize_approx: Option<f64>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ used more than once

error[E0308]: mismatched types
   --> src/model.rs:176:28
    |
176 | #[derive(Clone, Serialize, Deserialize, Debug, Default)]
    |                            ^^^^^^^^^^^ expected `f64`, found struct `std::string::String`
    |
    = note: expected enum `std::option::Option<f64>`
               found enum `std::option::Option<std::string::String>`
    = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0062]: field `filesize_approx` specified more than once
   --> src/model.rs:218:9
    |
176 | #[derive(Clone, Serialize, Deserialize, Debug, Default)]
    |                            ----------- first use of `filesize_approx`
...
218 |     pub filesize_approx: Option<f64>,
    |         ^^^^^^^^^^^^^^^ used more than once

error[E0025]: field `filesize_approx` bound multiple times in the pattern
   --> src/model.rs:218:5
    |
176 | #[derive(Clone, Serialize, Deserialize, Debug, Default)]
    |                                         ----- in this derive macro expansion
...
216 |     pub filesize_approx: Option<String>,
    |     ----------------------------------- first use of `filesize_approx`
217 |     #[cfg(feature = "yt-dlp")]
218 |     pub filesize_approx: Option<f64>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ multiple uses of `filesize_approx` in pattern
    |
    = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)

Some errors have detailed explanations: E0025, E0062, E0124, E0308.
For more information about an error, try `rustc --explain E0025`.
error: could not compile `youtube_dl` due to 14 previous errors

@twiclo
Copy link
Contributor

twiclo commented Jan 4, 2022

Works if you do cargo check --no-default-features --features yt-dlp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants