는이 같은 블로그 기사 내용을 추출하려고 :블로그 기사에서 콘텐츠를 올바르게 추출하는 방법은 무엇입니까?
static void GetBlogData (string blogPostUrl)
{
string blogPostContent = null;
WebClient client = new WebClient();
//client.Headers.Add (HttpRequestHeader.Referer, "http://www.stackoverflow.com");
TextWriter writer = new StreamWriter ("/home/nanda/projects/mono/common/article");
try
{
blogPostContent = client.DownloadString (blogPostUrl);
}
catch (Exception ex)
{
Term.PrintLn ("Unable to download\n{0}", ex.Message);
}
if (blogPostContent != null)
{
writer.WriteLine (blogPostContent);
}
else
{
Term.PrintLn ("No content found");
}
}
나는이 접근 방식의 너무 간단한 것을 알고,하지만 난 같은 일부 URL에서 내용을 추출 할 수없는 나는 이유를 알고 싶어 그들에게는 블록이나 무언가가 있습니다. 웹 사이트/블로그가 콘텐츠 다운로드를 차단했는지 어떻게 알 수 있습니까?
부족 그들은 쿠키를 보내거나 로그인해야 할 수도 있습니다. –