开发者

I wants some data of My Facebook Account but it not allowing me?

开发者 https://www.devze.com 2022-12-25 04:14 出处:网络
I am using http://lite.facebook.com And i want to get some data from my account. I am using HttpWebRequest for this.

I am using http://lite.facebook.com And i want to get some data from my account. I am using HttpWebRequest for this.

I am able to login to facebook from my credential using web request And I got profile url from home page html.

Now when i am trying to get list of all friends then its kick me out login page.

for login I am using This Code.

string HtmlData = httpHelper.getHtmlfromUrl(new Uri(FacebookUrls.Lite_MainpageUrl));
        lstInput = globussRegex.GetInputControlsNameAndValueInPage(HtmlData);
        foreach (string str in lstInput)
        {
            if (str.Contains("lsd"))
            {
                int FirstPoint = str.IndexOf("name=\"lsd\"");
                if (FirstPoint > 0)
                {
                    TempHtmlData = str.Substring(FirstPoint).Replace("name=\"lsd\"","").Replace("value","");
                }
                int SecondPoint = TempHtmlData.IndexOf("/>");
                if (SecondPoint > 0)
                {
                    Value = TempHtmlData.Substring(0, SecondPoint).Replace("=", "").Replace("\\", "").Replace("\"", "").Replace(" ", "");
                }
            }
        }
        string LoginData = "form_present=1&lsd=" + Value + "&email=" + UserName + "&password=" + Password + "";
        string ResponseData = httpHelper.postFormData(new Uri(FacebookUrls.Lite_LoginUrl), LoginData);

        int FirstProfileTag = ResponseData.IndexOf("/p/");
        int SecondProfileTag = ResponseData.IndexOf("\">Profile");
        if (FirstProfileTag > 0 && SecondProfileTag > 0)
        {
            string TempProfileUrl = ResponseData.Substring(FirstProfileTag, SecondProfileTag - FirstProfileTag);
            string ProfileUrl = FacebookUrls.Lite_ProfileUrl + TempProfileUrl;
            GetUserProfileData(ProfileUrl);
        }

And For getting Profile Url And FriendList Url Iam doing This

 string HtmlData = httpHelper.getHtmlfromUrl(new Uri(ProfileUrl));
        string FriendUrl = "http://lite.fa开发者_如何学Gocebook.com" + "/p/Pankaj-Mishra/1187787295/friends/";

        string HtmlData1 = httpHelper.getHtmlfromUrl(new Uri(FriendUrl));

I got perfect result when i tried for ProfileUrl. but when i tried for frindUrl its logged out how can i solve this problem Plz help me.


Stop scraping HTML data and use their API

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号