从Facebook下载文本(作为字符串)

时间:2013-11-14 18:48:47

标签: c# facebook string webclient-download

我想制作一个从Facebook下载文本的小应用程序。我在下面尝试了这段代码:

    private void button1_Click(object sender, EventArgs e)
    {
        try
        {
            string downloadsite = ""; 
            string result = "";
            downloadsite = "https://de-de.facebook.com/WarframeAlerts";

            using (var client = new WebClient())
            {

               result = client.DownloadString(downloadsite);

            }

        }
        catch (Exception ex)
        {
            MessageBox.Show("Couldn`t connect to the internet!" + Environment.NewLine + ex.ToString());
        }

  }

我得到这个字符串作为结果:

<!DOCTYPE html>
<html lang="de" id="facebook" class="no_js">
<head><meta charset="utf-8" /><script>function envFlush(a){function b(c){for(var d in a)c[d]=a[d];}if(window.requireLazy)    {window.requireLazy(['Env'],b);}else{Env=window.Env|| {};b(Env);}}envFlush({"user":"0","locale":"de_DE","method":"GET","svn_rev":1008734,"tier":"","push_phase":"V3","pkg_cohort":"EXP1:DEFAULT","vip":"31.13.81.81","www_base":"https:\/\/www.facebook.com\/","lsd":"AVpO0XGi","ajaxpipe_token":"AXjAbnLRrn8S7g_m","lhsh":"zAQExA3qP","tracking_domain":"https:\/\/pixel.facebook.com","retry_ajax_on_network_error":"1","fbid_emoticons":"1"});</script><scrip....and so on.

好吧,错误(downloadstring是一个错误)告诉iam使用了错误的“浏览器”。但是我如何绕过这个以获取Facebook页面的文本作为字符串?谢谢你的每一个答案!

*抱歉我的英语不好,我希望你理解我/它......

* https://developers.facebook.com/ - &gt;有什么东西可以帮助我吗?

0 个答案:

没有答案