azeem
azeem

Reputation: 33

How to extract a certain block of text from web site

i have to extract useful information from web

i can i do using c#

example

title: abc

i have get only "abc"

Upvotes: 1

Views: 691

Answers (3)

RVK
RVK

Reputation: 1

Using DOM parser you can extract required elements. If you pre-aware of the block id or if you able to prepare it then the extraction is quite simple.

Upvotes: 0

Coffee
Coffee

Reputation: 1771

As, @Oded♦ recommended, Html Agility Pack will be useful.

This is example of html agility pack.

 HtmlDocument doc = new HtmlDocument();
 doc.Load("file.htm");
 foreach(HtmlNode link in doc.DocumentElement.SelectNodes("//a[@href"])
 {
    HtmlAttribute att = link["href"];
    att.Value = FixLink(att);
 }
 doc.Save("file.htm");

Upvotes: 1

Oded
Oded

Reputation: 498942

If you need to extract text from a website, you need to use an HTML parser such as the HTML Agility Pack.

Upvotes: 0

Related Questions