Subtitles can downloaded
This commit is contained in:
commit
37dbc55a58
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
.vscode/
|
||||
obj/
|
||||
bin/
|
32
Program.cs
Normal file
32
Program.cs
Normal file
@ -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");
|
||||
}
|
||||
}
|
18
subtitle-downloader.csproj
Normal file
18
subtitle-downloader.csproj
Normal file
@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<RootNamespace>subtitle_downloader</RootNamespace>
|
||||
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||
<PublishGeckoDriver>true</PublishGeckoDriver>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Selenium.WebDriver" Version="4.8.0" />
|
||||
<PackageReference Include="Selenium.WebDriver.GeckoDriver" Version="0.32.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user