Skip to content

Let the ytdl file QueryType::as_cow_str accept an additional website parameter #284

@ChengCY-2254

Description

@ChengCY-2254

Because I want to obtain audio from other sources, I want to add a web_site parameter.

Just like this:

impl<'a> QueryType<'a> {
    fn as_cow_str(&'a self,web_site:&str, n_results: usize) -> Cow<'a, str> {
        match self {
            Self::Url(Cow::Owned(u)) => Cow::Borrowed(u),
            Self::Url(Cow::Borrowed(u)) => Cow::Borrowed(u),
            Self::Search(s) => Cow::Owned(format!("{web_site}:{n_results}:{s}")),
        }
    }
}

This is the original method

impl<'a> QueryType<'a> {
    fn as_cow_str(&'a self, n_results: usize) -> Cow<'a, str> {
        match self {
            Self::Url(Cow::Owned(u)) => Cow::Borrowed(u),
            Self::Url(Cow::Borrowed(u)) => Cow::Borrowed(u),
            Self::Search(s) => Cow::Owned(format!("ytsearch{n_results}:{s}")),
        }
    }
}

I'm not very good at English, so I'm using a translator to write this issue, hoping to express my meaning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions