Skip to content

Extracting text from webpage (dynamic text from JS, not in html source)

pete

Asked Jan 20, 2009, 9:39 AM EST1 answer
Share
LinkedInX
I was wondering if anyone can show me how to extract text from a website.

I have seen lots of ways to get the html source, then go through the tags, but the problem is that the text displayed on the webpage is taken from a javascript function.

Is there anything which can render the page, then allow me to extract the textual content?

cheers

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Bechir Bejaoui
    0
    try this code

    WebClient webClient = new WebClient(); 
     string url = "http://www.c-sharpcorner.com/"; 
    byte[] request = webClient.DownloadData(url); 
    UTF8Encoding utf = new UTF8Encoding(); 
    TextBox.Text = utf.GetString(request);
    0