Newsbot.Collector/Newsbot.Collector.Services/HtmlParser/BrowserClient.cs
James Tombleson adb4799206
Features/missing files (#14)
* Added jobs Controller to trigger collection.

* Added backgroundjobs to move them out of program.cs

* new column to track youtube ID values and adding a sourceid column on the icon for linking

* Added icon table repo

* added interface for IconsRepo

* hey the missing config models

* adding section const keys to pull blocks of configs

* Added youtubewatcher to the code but not ready to enable it in the background.  More testing needed.

* Test... improvements?
2023-03-31 23:00:15 -07:00

30 lines
621 B
C#

using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
namespace Newsbot.Collector.Services.HtmlParser;
public class BrowserClient : IDisposable
{
private readonly IWebDriver _driver;
public BrowserClient()
{
_driver = new FirefoxDriver();
}
public void Dispose()
{
_driver.Close();
_driver.Quit();
_driver.Dispose();
}
public string GetPageSource(string url, int sleep = 5000)
{
_driver.Navigate().GoToUrl(url);
// Give the page some time to finish loading js
Thread.Sleep(sleep);
return _driver.PageSource;
}
}