diff --git a/.vs/youtube-downloader/v16/.suo b/.vs/youtube-downloader/v16/.suo index 30514f2..fee50f8 100644 Binary files a/.vs/youtube-downloader/v16/.suo and b/.vs/youtube-downloader/v16/.suo differ diff --git a/Server/Functions/Downloader.cs b/Server/Functions/Downloader.cs index 7699e24..e893838 100644 --- a/Server/Functions/Downloader.cs +++ b/Server/Functions/Downloader.cs @@ -322,16 +322,28 @@ namespace youtube_downloader.Server.Functions private async Task _DownloadChannel(ChannelId id,Resolution res) { - var c=await ytc.Channels.GetAsync(id); - SavedChannel c2 = SavedChannel.FromChannel(c, _DownloadThumbnail); - string infpath = GetPath(true, "Channel", id + ".json"); - File.WriteAllText(infpath, JsonConvert.SerializeObject(c2)); - var cvids = await ytc.Channels.GetUploadsAsync(id).ToListAsync(); - foreach(var v in cvids) + try { - await _DownloadVideo(v.Id, res); - } + var c = await ytc.Channels.GetAsync(id); + SavedChannel c2 = SavedChannel.FromChannel(c, _DownloadThumbnail); + string infpath = GetPath(true, "Channel", id + ".json"); + File.WriteAllText(infpath, JsonConvert.SerializeObject(c2)); + try + { + await ytc.Channels.GetUploadsAsync(c.Id).ForEachAsync(async (v) => + { + await _DownloadVideo(v.Id, res); + }); + } + catch (Exception ex) + { + _ = ex; + } + }catch(Exception ex2) + { + _ = ex2; + } } private async Task _DownloadPlaylist(PlaylistId id,Resolution res) { @@ -341,17 +353,26 @@ namespace youtube_downloader.Server.Functions } private async Task _DownloadUser(UserName name, Resolution res) { + try { var c = await ytc.Channels.GetByUserAsync(name); SavedChannel c2 = SavedChannel.FromChannel(c, _DownloadThumbnail); string infpath = GetPath(true, "Channel", c.Id + ".json"); File.WriteAllText(infpath, JsonConvert.SerializeObject(c2)); - var cvids = await ytc.Channels.GetUploadsAsync(c2.Id).ToListAsync(); - foreach (var v in cvids) + try { - await _DownloadVideo(v.Id, res); + await ytc.Channels.GetUploadsAsync(c.Id).ForEachAsync(async(v) => + { + await _DownloadVideo(v.Id, res); + }); + }catch(Exception ex) + { + _ = ex; } - - } + }catch(Exception ex2) + { + _ = ex2; + } +} public static void DownloadVideo(string id,Resolution res) { VideoId? v = VideoId.TryParse(id); diff --git a/Server/Models/SavedPlaylist.cs b/Server/Models/SavedPlaylist.cs index c898740..913b457 100644 --- a/Server/Models/SavedPlaylist.cs +++ b/Server/Models/SavedPlaylist.cs @@ -10,9 +10,10 @@ namespace TessesYoutubeDownloader.Server.Models { public static async Task FromPlaylistId(Resolution res,YoutubeExplode.YoutubeClient ytc,YoutubeExplode.Playlists.PlaylistId id,Action addToQueue, Action downloadThumbnail) { + SavedPlaylist pl2 = new SavedPlaylist(); pl2.Videos = new List(); - + try { var pl=await ytc.Playlists.GetAsync(id); var a = pl.Author; pl2.AuthorChannelId = a.ChannelId; @@ -25,14 +26,23 @@ namespace TessesYoutubeDownloader.Server.Models { downloadThumbnail(thumb.Resolution.Width, thumb.Resolution.Height,id, thumb.Url); } - var cvids = await ytc.Playlists.GetVideosAsync(id).ToListAsync(); - foreach (var v in cvids) - { - addToQueue(v.Id,res); - pl2.Videos.Add(v.Id); + try + { + await ytc.Playlists.GetVideosAsync(id).ForEachAsync((v) => + { + + addToQueue(v.Id, res); + pl2.Videos.Add(v.Id); + + }); + }catch(Exception ex) + { + _ = ex; + } + }catch(Exception ex2) + { + _ = ex2; } - - return pl2; } public List Videos { get; set; } diff --git a/bin/Debug/youtube-downloader.exe b/bin/Debug/youtube-downloader.exe index 0d3cb26..d50e465 100644 Binary files a/bin/Debug/youtube-downloader.exe and b/bin/Debug/youtube-downloader.exe differ diff --git a/bin/Debug/youtube-downloader.pdb b/bin/Debug/youtube-downloader.pdb index b97007c..93316ff 100644 Binary files a/bin/Debug/youtube-downloader.pdb and b/bin/Debug/youtube-downloader.pdb differ diff --git a/obj/Debug/youtube-downloader.exe b/obj/Debug/youtube-downloader.exe index 0d3cb26..d50e465 100644 Binary files a/obj/Debug/youtube-downloader.exe and b/obj/Debug/youtube-downloader.exe differ diff --git a/obj/Debug/youtube-downloader.pdb b/obj/Debug/youtube-downloader.pdb index b97007c..93316ff 100644 Binary files a/obj/Debug/youtube-downloader.pdb and b/obj/Debug/youtube-downloader.pdb differ