using HtmlAgilityPack;

namespace MangaReader.Core.Metadata;

public abstract class MangaWebCrawler : IMangaMetadataProvider
{
    public abstract string SourceId { get; }
    public abstract Task<SourceManga?> GetMangaAsync(string url, CancellationToken cancellationToken);

    protected virtual async Task<HtmlDocument> GetHtmlDocumentAsync(string url, CancellationToken cancellationToken)
    {
        HtmlWeb web = new()
        {
            UsingCacheIfExists = false
        };

        //return web.Load(url);

        return await web.LoadFromWebAsync(url, cancellationToken);
    }
}