50 lines
1.8 KiB
C#
50 lines
1.8 KiB
C#
using Tesses.YouTubeDownloader;
|
|
string domain = "https://tytdarchive.site.tesses.net/";
|
|
string dir="/mnt/8TBShare/Videos/TYTD/Wii";
|
|
TYTDPathDirectory directory=new TYTDPathDirectory(dir);
|
|
using var removed_have = new StreamWriter("removed_have.txt");
|
|
using var removed_donthave = new StreamWriter("removed_donthave.txt");
|
|
using var available_have = new StreamWriter("available_have.txt");
|
|
using var available_donthave = new StreamWriter("available_donthave.txt");
|
|
using var unknown_have = new StreamWriter("unknown_have.txt");
|
|
using var unknown_donthave = new StreamWriter("unknown_donthave.txt");
|
|
int i =0;
|
|
await foreach(var item in directory.GetVideoIdsAsync())
|
|
{
|
|
i++;
|
|
o:
|
|
bool have=(await directory.HttpClient.GetStringAsync($"{domain}have.php?v={item}"))=="true";
|
|
try{
|
|
await directory.YoutubeClient.Videos.GetAsync(item);
|
|
|
|
if(have)
|
|
available_have.WriteLine($"https://www.youtube.com/watch?v={item}");
|
|
else
|
|
available_donthave.WriteLine($"https://www.youtube.com/watch?v={item}");
|
|
|
|
Console.WriteLine($"[{i}]{ (await directory.GetVideoInfoAsync(item)).Title}");
|
|
}
|
|
catch(YoutubeExplode.Exceptions.RequestLimitExceededException ex)
|
|
{
|
|
_=ex;
|
|
Console.WriteLine("Rate limit exceeded, waiting 5 minutes");
|
|
Thread.Sleep(300000);
|
|
goto o;
|
|
}
|
|
catch(YoutubeExplode.Exceptions.VideoUnavailableException ex)
|
|
{
|
|
_=ex;
|
|
if(have)
|
|
removed_have.WriteLine($"https://www.youtube.com/watch?v={item}");
|
|
else
|
|
removed_donthave.WriteLine($"https://www.youtube.com/watch?v={item}");
|
|
}catch(Exception ex)
|
|
{
|
|
_=ex;
|
|
if(have)
|
|
unknown_have.WriteLine($"https://www.youtube.com/watch?v={item}");
|
|
else
|
|
unknown_donthave.WriteLine($"https://www.youtube.com/watch?v={item}");
|
|
}
|
|
}
|