using HtmlAgilityPack;

namespace MangaReader.Core.Http;

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

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

        return doc;
    }
}