예제 #1
0
        public void CreateEvent(ref FacebookUser fbUser)
        {
            try
            {
                GlobusLogHelper.log.Info("Start Event Creaton With Username : "******"Start Event Creaton With Username : "******"user");
                if (string.IsNullOrEmpty(userid))
                {
                    userid = GlobusHttpHelper.ParseJson(homePageSource, "user");
                }

                if (string.IsNullOrEmpty(userid) || userid == "0" || userid.Length < 3)
                {
                    GlobusLogHelper.log.Info("Please Check The Account : " + fbUser.username);
                    GlobusLogHelper.log.Debug("Please Check The Account : " + fbUser.username);

                    return;
                }

                fbdtsg = GlobusHttpHelper.Get_fb_dtsg(homePageSource);


                foreach (string item in LstEventDetailsEventCreator)
                {
                    try
                    {
                        string[] eventDetailsArr = Regex.Split(item, "<:>");

                        for (int i = 0; i < eventDetailsArr.Length; i++)
                        {
                            try
                            {
                                string EventDetails = eventDetailsArr[i];

                                if (EventDetails.Contains("Name") || EventDetails.Contains("name"))
                                {
                                    try
                                    {
                                        //title = Uri.EscapeDataString(EventDetails.Replace("Name", string.Empty).Replace("name", string.Empty).Trim());
                                        title = Uri.EscapeDataString(EventDetails.Replace("Name", string.Empty).Replace("name", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Trim());
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                    }
                                }
                                if (EventDetails.Contains("Details") || EventDetails.Contains("details"))
                                {
                                    try
                                    {
                                        //detailstext = Uri.EscapeDataString(EventDetails.Replace("Details", string.Empty).Replace("details", string.Empty).Trim());
                                        detailstext = Uri.EscapeDataString(EventDetails.Replace("Details", string.Empty).Replace("details", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Trim());
                                        details     = detailstext;
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                    }
                                }
                                if (EventDetails.Contains("Where") || EventDetails.Contains("where"))
                                {
                                    try
                                    {
                                        //location = Uri.EscapeDataString(EventDetails.Replace("Where", string.Empty).Replace("where", string.Empty).Trim());
                                        location = Uri.EscapeDataString(EventDetails.Replace("Where", string.Empty).Replace("where", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Trim());
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                    }
                                }
                                if (EventDetails.Contains("When") || EventDetails.Contains("when"))
                                {
                                    try
                                    {
                                        //whendateIntlDisplay = Uri.EscapeDataString(EventDetails.Replace("When", string.Empty).Replace("when", string.Empty).Trim());
                                        whendateIntlDisplay = Uri.EscapeDataString(EventDetails.Replace("When", string.Empty).Replace("when", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Trim());
                                        whendate            = whendateIntlDisplay;
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                    }
                                }
                                if (EventDetails.Contains("Add a time") || EventDetails.Contains("add a time"))
                                {
                                    try
                                    {
                                        //whentimedisplaytime = Uri.EscapeDataString(EventDetails.Replace("Add a time", string.Empty).Replace("add a time", string.Empty).Trim());
                                        whentime            = EventDetails.Replace("Add a time", string.Empty).Replace("add a time", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Trim();
                                        whentimedisplaytime = Uri.EscapeDataString(EventDetails.Replace("Add a time", string.Empty).Replace("add a time", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Trim());
                                        //whentime = whentimedisplaytime;
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                    }
                                }
                                if (EventDetails.Contains("Privacy") || EventDetails.Contains("privacy"))
                                {
                                    try
                                    {
                                        //audiencevalue = ("40").Replace("whentimedisplaytime", string.Empty).Replace("whentimedisplaytime", string.Empty).Trim();
                                        audiencevalue = ("40").Replace("whentimedisplaytime", string.Empty).Replace("whentimedisplaytime", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Trim();
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                            }
                        }

                        try
                        {
                            string getlocationpage             = "https://www.facebook.com/ajax/places/typeahead?value=" + location + "&include_address=2&include_subtext=true&exact_match=false&use_unicorn=true&allow_places=true&allow_cities=true&render_map=true&limit=15&new_js_ranking=0&include_source=plan_edit&city_bias=false&map_height=150&map_width=348&ref=xhp_fb__events__create__location_input%3A%3Arender&sid=771836702690&city_id=1019627&city_set=false&request_id=0.6745269983075559&__user="******"&__a=1&__dyn=7n8ahyj35zoSt2u6aWizG85oCiq78hyWgSmEVFLFwxBxCbzGxa48jhHw&__req=1q&__rev=1353801%20HTTP/1.1";
                            string pageresponseGetlocationpage = gHttpHelper.getHtmlfromUrl(new Uri(getlocationpage));
                            int    startindex = pageresponseGetlocationpage.IndexOf("uid\":");
                            string start      = pageresponseGetlocationpage.Substring(startindex).Replace("uid\":", string.Empty);
                            int    endindex   = start.IndexOf(",");
                            string end        = start.Substring(0, endindex).Replace(",", string.Empty);
                            locationid = end.Trim();
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }

                        try
                        {
                            if (whentime.StartsWith("0"))
                            {
                                int startindex2 = whentime.IndexOf("0");
                                whentime = whentime.Substring(startindex2).Replace("0", string.Empty);
                            }
                            string gettimepage             = "https://www.facebook.com/ajax/typeahead/time_bootstrap.php?request_id=0.8878094537649304&__user="******"&__a=1&__dyn=7n8ahyj2qm9udDgDxyKAEWy6zECiq78hACF3qGEVFLFwxBxCbzGxa49UJ6K&__req=25&__rev=1353801%20HTTP/1.1";
                            string pageresponseGetTimePage = gHttpHelper.getHtmlfromUrl(new Uri(gettimepage));
                            int    startindex  = pageresponseGetTimePage.IndexOf(whentime);
                            string start       = pageresponseGetTimePage.Substring(startindex).Replace(whentime, string.Empty);
                            int    startindex1 = start.IndexOf("uid\":");
                            string start1      = start.Substring(startindex1).Replace("uid\":", string.Empty);
                            int    endindex1   = start1.IndexOf(",");
                            string end         = start1.Substring(0, endindex1).Replace(",", string.Empty).Replace("\"", string.Empty);
                            timeid = end.Trim();
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }
                        try
                        {
                            string timezonedata = "place_id=" + locationid + "&date_str=" + whendateIntlDisplay + "&__user="******"&ttstamp=" + Utils.GenerateTimeStamp() + "";
                            string url          = "https://www.facebook.com/ajax/plans/create/timezone.phpHTTP/1.1";
                            string pgresponse   = gHttpHelper.postFormData(new Uri(url), timezonedata);
                            int    startindex   = pgresponse.IndexOf("tz_identifier\":\"");
                            string start        = pgresponse.Substring(startindex).Replace("tz_identifier\":\"", string.Empty);
                            int    endindex     = start.IndexOf("}");
                            string end          = start.Substring(0, endindex).Replace("}", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty);
                            timezone = Uri.EscapeDataString(end.Trim());
                        }
                        catch
                        { }

                        string createEventPS = gHttpHelper.getHtmlfromUrl(new Uri(FBGlobals.Instance.EventCreatorGetCreateEventUrl));

                        string createEventDialogPS = gHttpHelper.getHtmlfromUrl(new Uri(FBGlobals.Instance.EventCreatorGetAjaxCreateEventDialogUrl + userid + "&__a=1&__dyn=7n8apij35zpVpQ9UmAEKU&__req=g"));

                        string createEventPostSaveUrl = FBGlobals.Instance.EventCreatorPostAjaxCreateEventSaveUrl;

                        //string savePostData = "fb_dtsg=" + fbdtsg + "&title=" + title + "&details_text=" + detailstext + "&details=" + details + "&pre_details=&location_id="+ locationid + "&location=" + location + "&isplacetexttag=&pre_location=&pre_location_id=&when_dateIntlDisplay=" + whendateIntlDisplay + "&when_date=" + whendate + "&when_time="+ timeid +"&when_time_display_time=" + whentimedisplaytime+"&audience[0][value]=" + audiencevalue + "&guest_invite=on&pre_guest_invite=&parent_id=&source=10&who=&__user="******"&__a=1&__dyn=7n8apij35zpVpQ9UmAEKU&__req=1f&phstamp=" + Utils.GenerateTimeStamp() + "";
                        string savePostData           = "fb_dtsg=" + fbdtsg + "&title=" + title + "&details_text=" + detailstext + "&details=" + details + "&pre_details=&location_id=" + locationid + "&location=" + location + "&isplacetexttag=&pre_location=&pre_location_id=&when_dateIntlDisplay=" + whendateIntlDisplay + "&when_date=" + whendate + "&when_time=" + timeid + "&when_time_display_time=" + whentimedisplaytime + "&when_timezone=" + timezone + "&privacyx=1439959856260766&extra_data=&who=&__user="******"&__a=1&__dyn=7n8apij35zpVpQ9UmAEKU&__req=g&ttstamp=" + Utils.GenerateTimeStamp() + "";
                        string createEventPostSaveRes = gHttpHelper.postFormData(new Uri(createEventPostSaveUrl), savePostData);

                        if (createEventPostSaveRes.Contains("?context=create"))
                        {
                            string eventCreatedURL = string.Empty;

                            try
                            {
                                eventCreatedURL = createEventPostSaveRes.Substring(createEventPostSaveRes.IndexOf("goURI("), createEventPostSaveRes.IndexOf("?context=create", createEventPostSaveRes.IndexOf("goURI(")) - createEventPostSaveRes.IndexOf("goURI(")).Replace("\"", string.Empty).Replace("goURI(", string.Empty).Replace("events", string.Empty).Replace("\\", string.Empty).Replace(@"\\\/", string.Empty).Replace(@"//", string.Empty).Replace(@"/", string.Empty).Trim();
                                eventCreatedURL = FBGlobals.Instance.fbeventsUrl + eventCreatedURL;
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                            }

                            GlobusLogHelper.log.Info("Event Created URL :" + eventCreatedURL + " With Username : "******"Event Created URL :" + eventCreatedURL + " With Username : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"errorSummary"))
                        {
                            string errorSummary = FBUtils.GetErrorSummary(createEventPostSaveRes);

                            GlobusLogHelper.log.Info("Event Creation Error  :" + errorSummary + " With Username : "******"Event Creation Error  :" + errorSummary + " With Username : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Error In Event Creation With Username : "******"Error In Event Creation With Username : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Error : " + ex.StackTrace);
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }

            GlobusLogHelper.log.Info("Process Completed Of Event Creaton With Username : "******"Process Completed Of Event Creaton With Username : " + fbUser.username);
        }
예제 #2
0
        public static void Scraper(ref FacebookUser fbUser, string Hash)
        {
            GlobusHttpHelper HttpHelper      = fbUser.globusHttpHelper;
            string           pageSource_Home = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com"), "", "");


            string __user  = string.Empty;
            string fb_dtsg = string.Empty;
            string KeyWord = string.Empty;

            __user = GlobusHttpHelper.GetParamValue(pageSource_Home, "user");
            if (string.IsNullOrEmpty(__user))
            {
                __user = GlobusHttpHelper.ParseJson(pageSource_Home, "user");
            }


            fb_dtsg = GlobusHttpHelper.Get_fb_dtsg(pageSource_Home);



            string PostData     = "__user="******"&__a=1&__dyn=7nmanEyl2lm9o-t2u5bGya4Au74qbx2mbAKGiyEyut9LRwxBxem9V8CdwIhEyfyUnwPUS2O4K5e8GQ8GqcFoy8ACxtpm&__req=h&fb_dtsg=" + fb_dtsg + "&ttstamp=26581701181109510510483495368&__rev=1719057";
            string PostUrl      = "https://www.facebook.com/pubcontent/trending/see_more/?topic_ids[0]=105471716153186&topic_ids[1]=109659645720566&topic_ids[2]=108332329190557&position=3";
            string Pageresponce = HttpHelper.postFormData(new Uri(PostUrl), PostData);

            Pageresponce = Pageresponce.Replace("\\u003C", "<");


            string[] trendingArr = System.Text.RegularExpressions.Regex.Split(Pageresponce, "li data-topicid=");
            trendingArr = trendingArr.Skip(1).ToArray();
            foreach (var item_trendingArr in trendingArr)
            {
                string trendingId      = string.Empty;
                string trendingName    = string.Empty;
                string trendingLinkUrl = string.Empty;
                try
                {
                    try
                    {
                        trendingId = Utils.getBetween(item_trendingArr, "\\\"", "\\\"");
                    }
                    catch { }
                    try
                    {
                        trendingName = Utils.getBetween(item_trendingArr, "_5v0s _5my8\\\">", "<");
                    }
                    catch { };

                    string LinkUrl = Utils.getBetween(item_trendingArr, "_4qzh _5v0t _7ge\\\" href=\\\"", "\" id=").Replace("\\", string.Empty).Replace("amp;", string.Empty);
                    if (!LinkUrl.Contains("www.facebook.com/"))
                    {
                        trendingLinkUrl = "https://www.facebook.com" + LinkUrl;
                    }
                    else
                    {
                        trendingLinkUrl = LinkUrl;
                    }

                    if (trendingName.Contains(KeyWord))
                    {
                        string FindPageSource = string.Empty;


                        FindPageSource = HttpHelper.getHtmlfromUrl(new Uri(trendingLinkUrl));

                        string postID           = string.Empty;
                        string postName         = string.Empty;
                        string postImage        = string.Empty;
                        string postDescriptions = string.Empty;
                        string posttitle        = string.Empty;

                        string[] ContentArr = System.Text.RegularExpressions.Regex.Split(FindPageSource, "userContentWrapper _5pcr _3ccb");
                        ContentArr = ContentArr.Skip(1).ToArray();
                        foreach (var ContentArr_item in ContentArr)
                        {
                            try
                            {
                                postName = trendingName;
                                postID   = trendingId;
                                // class="_4-eo _2t9n"
                                postImage = Utils.getBetween(ContentArr_item, "scaledImageFitWidth img\" src=\"", "alt=").Replace("amp;", string.Empty).Replace("\"", string.Empty);
                            }
                            catch (Exception)
                            {
                            }
                            string   profileName  = posttitle;                                                                                                                                //2
                            string   Message      = Utils.getBetween(ContentArr_item, "<p>", "<").Replace("&#064;", "@").Replace("&amp;", "&").Replace("u0025", "%").Replace("&#039;", "'");; //7
                            string[] DetailedInfo = System.Text.RegularExpressions.Regex.Split(ContentArr_item, "<div class=\"_6m7\">");
                            string   detail       = "-" + DetailedInfo[1];                                                                                                                    //8
                            detail = Utils.getBetween(detail, "-", "</div>").Replace("&amp;", "&").Replace("u0025", "%").Replace("&#039;", "'");

                            if (detail.Contains("<a "))
                            {
                                string GetVisitUrl = Utils.getBetween(detail, "\">", "</a>");

                                detail = Utils.getBetween("$$$####" + detail, "$$$####", "<a href=") + "-" + GetVisitUrl;
                            }

                            string[] ArrDetail = System.Text.RegularExpressions.Regex.Split(ContentArr_item, "<div class=\"mbs _6m6\">");

                            string Titles             = Utils.getBetween(ArrDetail[1], ">", "</a>").Replace("&#064;", "@").Replace("&amp;", "&").Replace("u0025", "%").Replace("&#039;", "'");
                            string SiteRedirectionUrl = Utils.getBetween(ArrDetail[1], "LinkshimAsyncLink.swap(this, &quot;", ");");
                            SiteRedirectionUrl = Uri.UnescapeDataString(SiteRedirectionUrl).Replace("\\u0025", "%").Replace("\\", "");//4
                            string websiteUrl = Utils.getBetween(SiteRedirectionUrl, "//", "/");

                            string[] adImg          = System.Text.RegularExpressions.Regex.Split(ContentArr_item, "<img class=\"scaledImageFitWidth img\"");
                            string   redirectionImg = Utils.getBetween(adImg[1], "src=\"", "\"").Replace("&amp;", "&");

                            string[] profImg    = System.Text.RegularExpressions.Regex.Split(ContentArr_item, "<img class=\"_s0 5xib 5sq7 _rw img\"");
                            string   profileImg = Utils.getBetween(profImg[0], "src=\"", "\"").Replace("&amp;", "&");
                        }
                    }
                }
                catch { };
            }
        }
예제 #3
0
        public void InviteFriendsEventInviter(ref FacebookUser fbUser)
        {
            try
            {
                string fb_dtsg = "";
                int    index   = 0;
                string __user  = "";
                string strEventURLPageSource = "";
                string strplan_id            = "";

                GlobusHttpHelper HttpHelper = fbUser.globusHttpHelper;

                List <string> lstFriend = new List <string>();

                foreach (string lstEventURLsFileitem in LstEventURLsEventInviter)
                {
                    try
                    {
                        int CountInvitation = 1;

                        strEventURLPageSource = HttpHelper.getHtmlfromUrl(new Uri(lstEventURLsFileitem));

                        __user = GlobusHttpHelper.GetParamValue(strEventURLPageSource, "user");
                        if (string.IsNullOrEmpty(__user))
                        {
                            __user = GlobusHttpHelper.ParseJson(strEventURLPageSource, "user");
                        }

                        if (string.IsNullOrEmpty(__user) || __user == "0" || __user.Length < 3)
                        {
                            GlobusLogHelper.log.Info("Please Check The Account : " + fbUser.username);
                            GlobusLogHelper.log.Debug("Please Check The Account : " + fbUser.username);

                            return;
                        }

                        fb_dtsg = GlobusHttpHelper.Get_fb_dtsg(strEventURLPageSource);

                        // Find Total Friends
                        lstFriend = FBUtils.GetAllFriends(ref HttpHelper, __user);
                        lstFriend = lstFriend.Distinct().ToList();

                        GlobusLogHelper.log.Info("Total Friends : " + lstFriend.Count + " for " + fbUser.username);
                        GlobusLogHelper.log.Debug("Total Friends : " + lstFriend.Count + " for " + fbUser.username);

                        List <string> lstids = new List <string>();

                        if (SendToAllFriendsEventInviter)
                        {
                            intNoOfFriends = lstFriend.Count - 1;
                        }

                        foreach (string item in lstFriend)
                        {
                            try
                            {
                                if (item.Contains("&"))
                                {
                                    try
                                    {
                                        string[] IdData = Regex.Split(item, "&");
                                        lstids.Add(IdData[0]);
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                    }
                                }
                                else
                                {
                                    lstids.Add(item);
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                            }
                        }

                        List <string> lstInvitedFriends = new List <string>();
                        foreach (string lstFrienditem in lstids)
                        {
                            try
                            {
                                if (CountInvitation > intNoOfFriends)
                                {
                                    break;
                                }

                                lstInvitedFriends.Add(lstFrienditem);
                                CountInvitation++;
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                            }
                        }

                        #region Split IDs in 100s and Send
                        List <List <string> > split_ListIDs = Utils.Split(lstInvitedFriends, NoOfFriendsSuggestionAtOneTimeEventInviter);


                        foreach (List <string> item in split_ListIDs)
                        {
                            try
                            {
                                index = 0;
                                string checkableitems      = "&checkableitems[" + index + "]";
                                string profileChooserItems = "%7B%22";

                                foreach (string lstFrienditem in item)
                                {
                                    try
                                    {
                                        index++;
                                        profileChooserItems = profileChooserItems + lstFrienditem + "%22%3A1%2C%22";
                                        checkableitems      = checkableitems + "=" + lstFrienditem + "&checkableitems[" + index + "]";
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                    }
                                }


                                try
                                {
                                    int indexOfLastComma = profileChooserItems.LastIndexOf("%2C%22");
                                    profileChooserItems = profileChooserItems.Remove(indexOfLastComma);
                                    profileChooserItems = profileChooserItems + "%7D";
                                    int indexOfLastcheckableitems = checkableitems.LastIndexOf("&checkableitems[" + index + "]");
                                    checkableitems = checkableitems.Remove(indexOfLastcheckableitems);
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }



                                if (lstEventURLsFileitem.Contains("events/"))
                                {
                                    try
                                    {
                                        string eventUrlsTemp = lstEventURLsFileitem + "/";
                                        strplan_id = eventUrlsTemp.Substring(eventUrlsTemp.IndexOf("events/"), (eventUrlsTemp.IndexOf('/', eventUrlsTemp.IndexOf("events/") + 8)) - eventUrlsTemp.IndexOf("events/")).Replace("events/", string.Empty).Trim();
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                    }

                                    #region BySan
                                    if (strEventURLPageSource.Contains("ajax/events/permalink/join.php") || strEventURLPageSource.Contains("Invite Friends"))
                                    {
                                        try
                                        {
                                            string joinPostDataUrl = FBGlobals.Instance.EventInviterPostAjaxJoinPHP;

                                            //eid=160921707405189&ref=0&nctr[_mod]=pagelet_event_header&__user=100004323278246&__a=1&__dyn=798ahxoNpGojEa0&__req=k&fb_dtsg=AQCKCBkm&phstamp=1658167756766107109133

                                            string joinPostData            = "eid=" + strplan_id + "&ref=0&nctr[_mod]=pagelet_event_header&__user="******"&__a=1&__dyn=798aD5z5ynU-wE&__req=9&fb_dtsg=" + fb_dtsg + "&phstamp=165816749496688101132";
                                            string ResponseOfJoinClickPost = HttpHelper.postFormData(new Uri(joinPostDataUrl), joinPostData);
                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                        }
                                    }

                                    #endregion

                                    string strAjaxGetRequest1 = HttpHelper.getHtmlfromUrl(new Uri(FBGlobals.Instance.EventInviterGetAjaxChoosePlan_Id + strplan_id + "&causal_element=js_" + CountInvitation + "&__asyncDialog=1&__user="******"&__a=1"));
                                    string strAjaxGetRequest2 = HttpHelper.getHtmlfromUrl(new Uri(FBGlobals.Instance.EventInviterGetAjaxIncludeAllPlan_Id + strplan_id + "&__user="******"&__a=1"));

                                    //string strPostData = "fb_dtsg=" + fb_dtsg + "&profileChooserItems=" + profileChooserItems + checkableitems + "&__user="******"&__a=1&phstamp=" + Globals.GenerateTimeStamp() + ""; //fb_dtsg=AQCAp9jD&profileChooserItems=%7B%22100001409031727%22%3A1%7D&checkableitems[0]=100001409031727&__user=100003798185175&__a=1&phstamp=1658167651125710668131"
                                    string strPostData = "fb_dtsg=" + fb_dtsg + "&profileChooserItems=" + profileChooserItems + checkableitems + "&__user="******"&__a=1&__dyn=798aD5z5ynU&__req=a&phstamp=" + Utils.GenerateTimeStamp() + ""; //fb_dtsg=AQCAp9jD&profileChooserItems=%7B%22100001409031727%22%3A1%7D&checkableitems[0]=100001409031727&__user=100003798185175&__a=1&phstamp=1658167651125710668131"

                                    //string strPostURL = "http://www.facebook.com/ajax/events/permalink/invite.php?plan_id=" + strplan_id + "&profile_chooser=1";

                                    string strPostURL = FBGlobals.Instance.EventInviterPostAjaxInvitePlan_Id + strplan_id + "&source=1";


                                    string lastResponseStatus = string.Empty;
                                    //  string strResponse = HttpHelper.postFormData(new Uri(strPostURL), strPostData);//HttpHelper.postFormData(new Uri(strPostURL), strPostData);

                                    string strResponse = HttpHelper.postFormData(new Uri(strPostURL), strPostData, ref lastResponseStatus, lstEventURLsFileitem);//string strResponse = HttpHelper.postFormData(new Uri(strPostURL), strPostData, ref lastResponseStatus)//HttpHelper.postFormData(new Uri(strPostURL), strPostData);
                                    if (lastResponseStatus.Contains("error: (404) Not Found"))
                                    {
                                        GlobusLogHelper.log.Info("URL : " + lstEventURLsFileitem + " isn't owned by Username : "******"URL : " + lstEventURLsFileitem + " isn't owned by Username : "******"error"))
                                    {
                                        foreach (string id in item)
                                        {
                                            GlobusLogHelper.log.Info("Invited : " + id + " with UserName : "******" for URL : " + lstEventURLsFileitem);
                                            GlobusLogHelper.log.Debug("Invited : " + id + " with UserName : "******" for URL : " + lstEventURLsFileitem);
                                            try
                                            {
                                                int delayInSeconds = Utils.GenerateRandom(minDelayEventInvitor * 1000, maxDelayEventInvitor * 1000);
                                                GlobusLogHelper.log.Info("Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Error : " + ex.StackTrace);
                                            }
                                        }

                                        GlobusLogHelper.log.Info("Invited Friends : " + item.Count + " with UserName : "******"Invited Friends : " + item.Count + " with UserName : "******" Error With URL : " + lstEventURLsFileitem + " By Username : "******" Error With URL : " + lstEventURLsFileitem + " By Username : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Error : " + ex.StackTrace);
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                            }
                        }

                        #endregion
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }

            GlobusLogHelper.log.Info("Process Completed With User Name : " + fbUser.username);
            GlobusLogHelper.log.Debug("Process Completed With User Name : " + fbUser.username);
        }
예제 #4
0
        public static void LoginUsingGlobusHttp(ref FacebookUser facebookUser)
        {
            ///Sign In
            try
            {
                GlobusHttpHelper objGlobusHttpHelper = facebookUser.globusHttpHelper;
                #region Post variable

                string fbpage_id         = string.Empty;
                string fb_dtsg           = string.Empty;
                string __user            = string.Empty;
                string xhpc_composerid   = string.Empty;
                string xhpc_targetid     = string.Empty;
                string xhpc_composerid12 = string.Empty;
                #endregion

                int intProxyPort = 80;

                if (!string.IsNullOrEmpty(facebookUser.proxyport) && Utils.IdCheck.IsMatch(facebookUser.proxyport))
                {
                    intProxyPort = int.Parse(facebookUser.proxyport);
                }
                Console.WriteLine("Logging in with " + facebookUser.username);
                Console.WriteLine("Logging in with " + facebookUser.username);
                string pageSource = string.Empty;
                try
                {
                    pageSource = objGlobusHttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/login.php"), "", "");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error : " + ex.StackTrace);
                }

                if (pageSource == null || string.IsNullOrEmpty(pageSource))
                {
                    pageSource = objGlobusHttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/login.php"), "", "");
                }

                if (pageSource == null)
                {
                    pageSource = objGlobusHttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/login.php"), "", "");
                    return;
                }

                string valueLSD      = GlobusHttpHelper.GetParamValue(pageSource, "lsd");
                string ResponseLogin = string.Empty;
                try
                {
                    ResponseLogin = objGlobusHttpHelper.postFormData(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + valueLSD + "&locale=en_US&email=" + facebookUser.username.Split('@')[0].Replace("+", "%2B") + "%40" + facebookUser.username.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + valueLSD + "", "", "", "", "", "");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error : " + ex.StackTrace);
                }
                if (string.IsNullOrEmpty(ResponseLogin))
                {
                    ResponseLogin = objGlobusHttpHelper.postFormData(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + valueLSD + "&locale=en_US&email=" + facebookUser.username.Split('@')[0].Replace("+", "%2B") + "%40" + facebookUser.username.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + valueLSD + "", "", "", "", "", "");           //"https://www.facebook.com/login.php?login_attempt=1"
                }
                if (ResponseLogin == null)
                {
                    return;
                }

                string loginStatus = "";
                if (CheckLogin(ResponseLogin, facebookUser.username, facebookUser.password, facebookUser.proxyip, facebookUser.proxyport, facebookUser.proxyusername, facebookUser.proxypassword, ref loginStatus))
                {
                    Console.WriteLine("Logged in with Username : "******"Logged in with Username : "******"Couldn't login with Username : "******"account has been disabled")
                    {
                        // GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_DisabledAccount);
                    }

                    if (loginStatus == "Please complete a security check")
                    {
                        //GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_SecurityCheckAccounts);
                    }


                    if (loginStatus == "Your account is temporarily locked")
                    {
                        //GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_TemporarilyLockedAccount);
                    }
                    if (loginStatus == "have been blocked")
                    {
                        //GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_havebeenblocked);
                    }
                    if (loginStatus == "For security reasons your account is temporarily locked")
                    {
                        // GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_SecurityCheckAccountsforsecurityreason);
                    }

                    if (loginStatus == "Account Not Confirmed")
                    {
                        //GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_AccountNotConfirmed);
                    }
                    if (loginStatus == "Temporarily Blocked for 30 Days")
                    {
                        // GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_30daysBlockedAccount);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.StackTrace);
            }
        }