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)
|
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);
|
SavedChannel c2 = SavedChannel.FromChannel(c, _DownloadThumbnail);
|
||||||
string infpath = GetPath(true, "Channel", id + ".json");
|
string infpath = GetPath(true, "Channel", id + ".json");
|
||||||
File.WriteAllText(infpath, JsonConvert.SerializeObject(c2));
|
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);
|
await _DownloadVideo(v.Id, res);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_ = ex;
|
||||||
|
}
|
||||||
|
}catch(Exception ex2)
|
||||||
|
{
|
||||||
|
_ = ex2;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
private async Task _DownloadPlaylist(PlaylistId id,Resolution res)
|
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)
|
private async Task _DownloadUser(UserName name, Resolution res)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
var c = await ytc.Channels.GetByUserAsync(name);
|
var c = await ytc.Channels.GetByUserAsync(name);
|
||||||
SavedChannel c2 = SavedChannel.FromChannel(c, _DownloadThumbnail);
|
SavedChannel c2 = SavedChannel.FromChannel(c, _DownloadThumbnail);
|
||||||
string infpath = GetPath(true, "Channel", c.Id + ".json");
|
string infpath = GetPath(true, "Channel", c.Id + ".json");
|
||||||
File.WriteAllText(infpath, JsonConvert.SerializeObject(c2));
|
File.WriteAllText(infpath, JsonConvert.SerializeObject(c2));
|
||||||
var cvids = await ytc.Channels.GetUploadsAsync(c2.Id).ToListAsync();
|
try
|
||||||
foreach (var v in cvids)
|
{
|
||||||
|
await ytc.Channels.GetUploadsAsync(c.Id).ForEachAsync(async(v) =>
|
||||||
{
|
{
|
||||||
await _DownloadVideo(v.Id, res);
|
await _DownloadVideo(v.Id, res);
|
||||||
|
});
|
||||||
|
}catch(Exception ex)
|
||||||
|
{
|
||||||
|
_ = ex;
|
||||||
}
|
}
|
||||||
|
}catch(Exception ex2)
|
||||||
|
{
|
||||||
|
_ = ex2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public static void DownloadVideo(string id,Resolution res)
|
public static void DownloadVideo(string id,Resolution res)
|
||||||
{
|
{
|
||||||
VideoId? v = VideoId.TryParse(id);
|
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)
|
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();
|
SavedPlaylist pl2 = new SavedPlaylist();
|
||||||
pl2.Videos = new List<string>();
|
pl2.Videos = new List<string>();
|
||||||
|
try {
|
||||||
var pl=await ytc.Playlists.GetAsync(id);
|
var pl=await ytc.Playlists.GetAsync(id);
|
||||||
var a = pl.Author;
|
var a = pl.Author;
|
||||||
pl2.AuthorChannelId = a.ChannelId;
|
pl2.AuthorChannelId = a.ChannelId;
|
||||||
|
@ -25,14 +26,23 @@ namespace TessesYoutubeDownloader.Server.Models
|
||||||
{
|
{
|
||||||
downloadThumbnail(thumb.Resolution.Width, thumb.Resolution.Height,id, thumb.Url);
|
downloadThumbnail(thumb.Resolution.Width, thumb.Resolution.Height,id, thumb.Url);
|
||||||
}
|
}
|
||||||
var cvids = await ytc.Playlists.GetVideosAsync(id).ToListAsync();
|
try
|
||||||
foreach (var v in cvids)
|
|
||||||
{
|
{
|
||||||
addToQueue(v.Id,res);
|
await ytc.Playlists.GetVideosAsync(id).ForEachAsync((v) =>
|
||||||
|
{
|
||||||
|
|
||||||
|
addToQueue(v.Id, res);
|
||||||
pl2.Videos.Add(v.Id);
|
pl2.Videos.Add(v.Id);
|
||||||
|
|
||||||
|
});
|
||||||
|
}catch(Exception ex)
|
||||||
|
{
|
||||||
|
_ = ex;
|
||||||
|
}
|
||||||
|
}catch(Exception ex2)
|
||||||
|
{
|
||||||
|
_ = ex2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return pl2;
|
return pl2;
|
||||||
}
|
}
|
||||||
public List<string> Videos { get; set; }
|
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