none
C# finding something in HTML RRS feed

  • Question

  • <pre lang="x-c#"><br/>
    
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using HtmlAgilityPack;
    using System.Net;
    
    namespace ConsoleApplication2
    {
      class Program
      {
        static void Main(string[] args)
        {
          WebClient site = new WebClient();
          string source = site.DownloadString("http://www.yahoo.com/");
          HtmlDocument document = new HtmlDocument();
          document.LoadHtml(source);
        }
      }
    }
    
    Monday, February 7, 2011 4:01 AM

Answers

  • You will need to know the tags that surround the information you want, then I would suggest Regex with an appropriate pattern to pull out the value(s) you want.
    • Proposed as answer by Adam_Turner Monday, February 7, 2011 4:02 PM
    • Marked as answer by Larcolais Gong Saturday, February 19, 2011 1:43 PM
    Monday, February 7, 2011 3:58 PM
  • Using regex, you don't necessarily need to know the surrounding tags, but not knowing them could return many dates.

    Adam


    Ctrl+Z
    • Marked as answer by Larcolais Gong Saturday, February 19, 2011 1:43 PM
    Monday, February 7, 2011 4:03 PM

All replies

  • I am trying to find the current date on the Yahoo site via Console Application. How would I do so? I forgot to mention that I am using HTML Agility Pack for this, if that helps.
    Monday, February 7, 2011 4:02 AM
  • Hello KBob

    You will get your answer from

    http://bytes.com/topic/c-sharp/answers/438686-how-get-html-string

    Thanks


    Sankarshan Parida

    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.

    Monday, February 7, 2011 5:25 AM
  • Where does it show on the page?

     

    Noam B.



    Do not Forget to Vote as Answer/Helpful, please. It encourages us to help you...
    Monday, February 7, 2011 7:22 AM
  • You will need to know the tags that surround the information you want, then I would suggest Regex with an appropriate pattern to pull out the value(s) you want.
    • Proposed as answer by Adam_Turner Monday, February 7, 2011 4:02 PM
    • Marked as answer by Larcolais Gong Saturday, February 19, 2011 1:43 PM
    Monday, February 7, 2011 3:58 PM
  • Using regex, you don't necessarily need to know the surrounding tags, but not knowing them could return many dates.

    Adam


    Ctrl+Z
    • Marked as answer by Larcolais Gong Saturday, February 19, 2011 1:43 PM
    Monday, February 7, 2011 4:03 PM