using HtmlAgilityPack;

namespace JSMR.Infrastructure.Http;

public class HtmlLoader(IHttpService httpService) : IHtmlLoader
{
    public async Task<HtmlDocument> GetHtmlDocumentAsync(string url, CancellationToken cancellationToken)
    {
        string html = await httpService.GetStringAsync(url, cancellationToken);

        HtmlDocument document = new();
        document.LoadHtml(html);

        return document;
    }
}