Ejemplo n.º 1
0
        protected override async Task <IManga> GetMangaFromNode(Uri host, ISiteHttpClient client, HtmlNode manga)
        {
            // Это переводчик, идем дальше.
            if (manga.SelectSingleNode(".//i[@class='fa fa-user text-info']") != null)
            {
                return(null);
            }

            var image    = manga.SelectSingleNode(".//div[@class='img']//a//img");
            var imageUri = image?.Attributes.Single(a => a.Name == "data-original").Value;

            var mangaNode = manga.SelectSingleNode(".//h3//a");
            var mangaUri  = mangaNode.Attributes.Single(a => a.Name == "href").Value;
            var mangaName = mangaNode.Attributes.Single(a => a.Name == "title").Value;

            if (!Uri.TryCreate(mangaUri, UriKind.Relative, out Uri test))
            {
                return(null);
            }

            var result = await Mangas.Create(new Uri(host, mangaUri)).ConfigureAwait(false);

            result.Name = WebUtility.HtmlDecode(mangaName);
            if (!string.IsNullOrWhiteSpace(imageUri))
            {
                result.Cover = await client.GetData(new Uri(host, imageUri)).ConfigureAwait(false);
            }
            return(result);
        }
Ejemplo n.º 2
0
        protected override async Task <IManga> GetMangaFromNode(Uri host, ISiteHttpClient client, HtmlNode manga)
        {
            var image    = manga.SelectSingleNode(".//div[@class='manga_images']//img");
            var imageUri = image?.Attributes.Single(a => a.Name == "src").Value;

            var mangaNode = manga.SelectSingleNode(".//h2//a");
            var mangaUri  = mangaNode.Attributes.Single(a => a.Name == "href").Value;
            var mangaName = mangaNode.InnerText;

            var result = await Mangas.Create(new Uri(mangaUri)).ConfigureAwait(false);

            result.Name = WebUtility.HtmlDecode(mangaName);
            if (!string.IsNullOrWhiteSpace(imageUri))
            {
                result.Cover = await client.GetData(new Uri(host, imageUri)).ConfigureAwait(false);
            }
            return(result);
        }