From 37dbc55a58b3350a541ff0e3b9ebfa7e85d46aa1 Mon Sep 17 00:00:00 2001 From: ProfessionalUwU Date: Fri, 10 Feb 2023 22:03:31 +0100 Subject: [PATCH] Subtitles can downloaded --- .gitignore | 3 +++ Program.cs | 32 ++++++++++++++++++++++++++++++++ README.md | 0 subtitle-downloader.csproj | 18 ++++++++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 .gitignore create mode 100644 Program.cs create mode 100644 README.md create mode 100644 subtitle-downloader.csproj diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e68f0aa --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.vscode/ +obj/ +bin/ diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..991de72 --- /dev/null +++ b/Program.cs @@ -0,0 +1,32 @@ +using OpenQA.Selenium; +using OpenQA.Selenium.Firefox; + +public class Program { + static void Main(string[] args) { + + Console.WriteLine("Test started"); + + 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 + driver.Navigate().GoToUrl("https://downsub.com/?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DPQ54uUV41-k"); + Thread.Sleep(5000); + + IWebElement drop = driver.FindElement(By.XPath("//button[@class='v-expansion-panel-header px-4 py-2']")); // Open Dropdown [WORKS] + drop.SendKeys(Keys.Enter); + Thread.Sleep(1000); + + IWebElement check = driver.FindElement(By.Id("input-885")); // Click button to disable tag stripping [WORKS] + check.SendKeys(Keys.Space); + Thread.Sleep(1000); + + IWebElement sub = driver.FindElement(By.XPath("//button[@data-title='[SRT] English']")); // Download subtitle file [WORKS] + sub.Click(); + Thread.Sleep(3000); + + driver.Close(); + + Console.WriteLine("Test ended"); + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/subtitle-downloader.csproj b/subtitle-downloader.csproj new file mode 100644 index 0000000..42222fe --- /dev/null +++ b/subtitle-downloader.csproj @@ -0,0 +1,18 @@ + + + + Exe + net7.0 + subtitle_downloader + linux-x64 + true + enable + enable + + + + + + + +