Failed to perform Web Scraping to the src attribute in img

1

I'm trying to learn to do Web Scraping, I've already managed to get all the data except one, the src attribute of an image (img), the funny thing is that if I get the alt.

A fragment of the example website:

<li>
<a href="/ver/49688/steinsgate-0-15" class="fa-play">
<span class="Image"><img src="/uploads/animes/thumbs/2950.jpg" alt="Steins;Gate 0"></span>
<span class="Capi">Episodio 15</span>
<strong class="Title">Steins;Gate 0</strong>
</a>
</li>

The fragment of code that does not work:

using System.Net.Http;
using HtmlAgilityPack;
var Ultimo_animes = Ultimos_Episodios[0].Descendants("li")
                .Where(node => node.GetAttributeValue("", "")
                .Equals("")).ToList();
foreach (var Ultimo_anime in Ultimo_animes)
            {
                //Imagen
                Console.WriteLine("Caratula: " +     Ultimo_anime.Descendants("img")
                    .FirstOrDefault().GetAttributeValue("src", ""));
        }

If I change:

GetAttributeValue("src", "")

By:

GetAttributeValue("alt", "")

If you take out: Steins; Gate 0

But with src, it comes out empty

A help please?

Thank you very much in advance and greetings

    
asked by Kaiserdj 26.07.2018 в 02:08
source

1 answer

1

I've discovered the solution, it's silly. When removing all the web html console I realized that the src attribute is set as data-cfsrc I do not know what to do but read it from the web. So if I use

GetAttributeValue("data-cfsrc", "")

If that works, I do not know what is due but so it works. Greetings

    
answered by 26.07.2018 / 21:28
source