add thumbnail download to downloader

This commit is contained in:
Demetria Lovato 2021-06-28 00:38:35 -07:00
parent 6760089173
commit 54f9a14c9a
6 changed files with 24 additions and 3 deletions

Binary file not shown.

View File

@ -502,9 +502,30 @@ namespace youtube_downloader.Server.Functions
List<SavedMedia> media = new List<SavedMedia>(); List<SavedMedia> media = new List<SavedMedia>();
try try
{ {
await DL.ytc.Search.GetVideosAsync(text).ForEachAsync((e) => { media.Add(new SavedMedia() { Title = e.Title, Id = e.Id, Kind = InfoType.Video }); }); await DL.ytc.Search.GetVideosAsync(text).ForEachAsync((e) => {
await DL.ytc.Search.GetPlaylistsAsync(text).ForEachAsync((e) => { media.Add(new SavedMedia() { Title = e.Title, Id = e.Id, Kind = InfoType.Playlist }); }); foreach(var t in e.Thumbnails)
await DL.ytc.Search.GetChannelsAsync(text).ForEachAsync((e) => { media.Add(new SavedMedia() { Title = e.Title, Id = e.Id, Kind = InfoType.Channel }); }); {
DL._DownloadThumbnail(t.Resolution.Width, t.Resolution.Height, e.Id, t.Url);
}
media.Add(new SavedMedia() {Title = e.Title, Id = e.Id, Kind = InfoType.Video });
});
await DL.ytc.Search.GetPlaylistsAsync(text).ForEachAsync((e) => {
foreach (var t in e.Thumbnails)
{
DL._DownloadThumbnail(t.Resolution.Width, t.Resolution.Height, e.Id, t.Url);
}
media.Add(new SavedMedia() { Title = e.Title, Id = e.Id, Kind = InfoType.Playlist });
});
await DL.ytc.Search.GetChannelsAsync(text).ForEachAsync((e) => {
foreach (var t in e.Thumbnails)
{
DL._DownloadThumbnail(t.Resolution.Width, t.Resolution.Height, e.Id, t.Url);
}
media.Add(new SavedMedia() { Title = e.Title, Id = e.Id, Kind = InfoType.Channel });
});
}catch (Exception ex) }catch (Exception ex)
{ {
_ = ex; _ = ex;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.