Reputation: 241
how would one scrape certain text from a website using a HTTPWebRequest?
I have this code but it only works with HREF, how can I make it to work with text?
Heres the code to scrape I have:
// setup variables for scraping
int startPos = 0, endPos = 0, length = 0;
string tempString = "";
// do the scraping
startPos = html.IndexOf("");
endPos = html.IndexOf(">", startPos);
length = endPos - startPos;
tempString = html.Substring(startPos, length);
For example if a page had this code how can I make it only scrape the1ddiariesareback?:
<s class="hash">#</s><b>the1ddiariesareback</b></span></a>
Upvotes: 0
Views: 552
Reputation: 499302
I suggest using the HTML Agility Pack to download and parse the HTML for you.
You can query the object model using XPath or LINQ to XML syntax.
Upvotes: 4