So Far I am trying to retrieve the text between HTML tags for a certain website....
Say for instance I need to extract out the text between these span tags how would I go about that, I am receiving an error stating "the object reference not set to an instance of an object" here is the HTML
There is also HTML Code prior to this portion here; I don't know if that should make a difference.
<div class="thumbnail-details">
<ul>
<li> … </li>
<li class="product-title">
<span class="thumbnail-details-grey">The Blaster Portable Wireless Speaker in Black</span>
</li>
<li> … </li>
</ul>
</div>
So far my C# code is
HtmlWeb hw = new HtmlWeb();
HtmlAgilityPack.HtmlDocument htmlDoc = hw.Load(@"http://www.karmaloop.com/Browse.htm#Pgroup=1");
if (htmlDoc.DocumentNode != null)
{
foreach (HtmlNode text in htmlDoc.DocumentNode.SelectNodes("//span[@class='thumbnail-details-grey']/text()"))
{
Console.WriteLine(text.InnerText);
}
Can I get some help here, I want to extract out "The Blaster Portable Wireless Speaker in Black".
if (htmlDoc != null && htmlDoc.DocumentNode != null)
to get rid of that error if I'm right, but then need to find out why it isn't loading.