0

我想做一个从 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.

好吧,错误(下载字符串是错误的)告诉我我使用了错误的“浏览器”。但是我怎样才能绕过这个来获取 Facebook 页面的文本作为字符串呢?感谢您的每一个回答!

*对不起我的英语不好,我希望你能理解我/它....

* https://developers.facebook.com/ --> 有什么可以帮助我的吗?

4

0 回答 0