This commit is contained in:
parent
bf72e8f89e
commit
15340aab60
Binary file not shown.
|
@ -322,16 +322,28 @@ namespace youtube_downloader.Server.Functions
|
|||
|
||||
private async Task _DownloadChannel(ChannelId id,Resolution res)
|
||||
{
|
||||
var c=await ytc.Channels.GetAsync(id);
|
||||
try
|
||||
{
|
||||
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 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 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);
|
||||
|
|
|
@ -10,9 +10,10 @@ namespace TessesYoutubeDownloader.Server.Models
|
|||
{
|
||||
public static async Task<SavedPlaylist> FromPlaylistId(Resolution res,YoutubeExplode.YoutubeClient ytc,YoutubeExplode.Playlists.PlaylistId id,Action<string,Resolution> addToQueue, Action<int, int, string,string> downloadThumbnail)
|
||||
{
|
||||
|
||||
SavedPlaylist pl2 = new SavedPlaylist();
|
||||
pl2.Videos = new List<string>();
|
||||
|
||||
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)
|
||||
try
|
||||
{
|
||||
addToQueue(v.Id,res);
|
||||
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<string> Videos { get; set; }
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue