Move driver into loop && Remove videoID after download
Fix error that prevented the opening of a second firefox after the first one is finished. Remove videoID after subtitle has been downloaded so that it doesn't get redownloaded next time.
This commit is contained in:
parent
7dd166e52a
commit
299d253579
@ -6,15 +6,15 @@ public class Program {
|
||||
|
||||
Console.WriteLine("Starting");
|
||||
|
||||
IWebDriver driver = new FirefoxDriver();
|
||||
|
||||
// Base url: https://downsub.com/?url=https%253A%252F%252Fwww.youtube.com%252Fwatch%253Fv%253D
|
||||
// Finished url: https://downsub.com/?url=https%253A%252F%252Fwww.youtube.com%252Fwatch%253Fv%253D + video id
|
||||
string[] lines = File.ReadAllLines(@"/nfs/andre/Archive/Vtuber/Hologra/hologra_downloaded.txt");
|
||||
string[] lines = File.ReadAllLines(@"/nfs/andre/Archive/Vtuber/Hologra/archive/hologra_downloaded.txt");
|
||||
foreach (string line in lines) {
|
||||
string videoId = line.Substring(8, 11);
|
||||
string fullUrl = "https://downsub.com/?url=https%253A%252F%252Fwww.youtube.com%252Fwatch%253Fv%253D" + videoId;
|
||||
|
||||
IWebDriver driver = new FirefoxDriver();
|
||||
|
||||
driver.Navigate().GoToUrl(fullUrl);
|
||||
Thread.Sleep(5000);
|
||||
|
||||
@ -30,6 +30,9 @@ public class Program {
|
||||
sub.Click();
|
||||
Thread.Sleep(3000);
|
||||
|
||||
string fileName = "/nfs/andre/Archive/Vtuber/Hologra/archive/hologra_downloaded.txt";
|
||||
File.WriteAllLines(fileName, File.ReadAllLines(fileName).Where(l => l != line).ToList());
|
||||
|
||||
driver.Close();
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user