Closed Antonako1 closed 8 months ago
i download song from youtube. it takes 100minutes or gives me error: The filename, directory name, or volume label syntax is incorrect
happens here in trycatch. fix private static async Task DownloadYoutubeTrackAsync(string url) { string formattedUrl = FormatUrlForFilename(url);
songPath = Path.Combine( Utils.jammerPath, formattedUrl ); string construction = songPath; string value = ""; (value, pipe) = CheckExistingSong(url); // Message.Data("Value: " + value, "Check Existing Song:" + formattedUrl.Substring(0, formattedUrl.Length - 4)); if (value != "") { songPath = value; return; } pipe = ""; try { var streamManifest = await youtube.Videos.Streams.GetManifestAsync(url); var streamInfo = streamManifest.GetAudioStreams().FirstOrDefault(); var video = await youtube.Videos.GetAsync(url); if (streamInfo != null) { var progress = new Progress<double>(data => { AnsiConsole.Clear(); Console.WriteLine($"{Locale.OutsideItems.Downloading} {url}: {data:P}"); }); // metadata to pipe pipe = video.Title; pipe = Start.Sanitize(pipe); await youtube.Videos.Streams.DownloadAsync(streamInfo, songPath, progress); int pos_dot = songPath.LastIndexOf("."); construction = songPath[..pos_dot] + "^" + pipe + ".mp4"; File.Move(songPath, construction); } else { Message.Data(Locale.OutsideItems.NoAudioStream, Locale.OutsideItems.Error); } songPath = construction; } catch (Exception ex) { Message.Data($"{Locale.OutsideItems.Error}: " + ex.Message, "Error"); songPath = ""; } }
need fix myself no help from no one
i download song from youtube. it takes 100minutes or gives me error: The filename, directory name, or volume label syntax is incorrect
happens here in trycatch. fix private static async Task DownloadYoutubeTrackAsync(string url) { string formattedUrl = FormatUrlForFilename(url);