async fn download_file(&self, dir: &PathBuf, url: &str) -> Result<PathBuf, String> {
        // get the youtubedl task
        let ytd = match YoutubeDL::new(dir, self.args.clone(), url) {
            Ok(ytd) => ytd,
            Err(why) => return Err(why.to_string()),
        };

        let download_dir = self.run_youtubedl(&ytd, url).await?;

        // get the downloaded file
        let file = self.get_file(&download_dir).await?;

        Ok(file)
    }
///  creates the 'YoutubeDL' and runs it, then returns the first file that it finds
creates the 'YoutubeDL' and runs it, then returns the first file that it finds
creates the ' YoutubeDL ' and runs it then returns the first file that it finds
async fn download_file(&self, dir: &PathBuf, url: &str) -> Result<PathBuf, String> {
        // get the youtubedl task
        let ytd = match YoutubeDL::new(dir, self.args.clone(), url) {
            Ok(ytd) => ytd,
            Err(why) => return Err(why.to_string()),
        };
        let download_dir = self.run_youtubedl(&ytd, url).await?;
        // get the downloaded file
        let file = self.get_file(&download_dir).await?;
        Ok(file)
    }
async fn download_file ( & self , dir : & PathBuf , url : & str ) -> Result < PathBuf , String > { // get the youtubedl task let ytd = match YoutubeDL :: new ( dir , self . args . clone ( ) , url ) { Ok ( ytd ) => ytd , Err ( why ) => return Err ( why . to_string ( ) ) , } ; let download_dir = self . run_youtubedl ( & ytd , url ) . await ? ; // get the downloaded file let file = self . get_file ( & download_dir ) . await ? ; Ok ( file ) }
creates the 'YoutubeDL' and runs it, then returns the first file that it finds
creates the ' YoutubeDL ' and runs it then returns the first file that it finds
&self
dir
&PathBuf
url
&str
&self
dir
&PathBuf
url
&str