Esempio n. 1
0
        public void LoginHttpHelper(ref GlobusHttpHelper HttpHelper)
        {
            try
            {
                Log("[ " + DateTime.Now + " ] => [ Logging In With : " + _Username + " ]");
                Log("[ " + DateTime.Now + " ] => [ Login Process is Running... ]");

                //Check Login
                if (IsLoggedIn)
                {
                    try
                    {
                        string homePage = HttpHelper.getHtmlfromUrlProxy(new Uri("http://www.linkedin.com/home"), _ProxyAddress, int.Parse(_ProxyPort), _ProxyUsername, _ProxyPassword);

                        if (homePage.Contains("Sign Out") && homePage.Contains("class=\"signout\"") && !homePage.Contains("Your LinkedIn account has been temporarily restricted"))
                        {
                            Log("[ " + DateTime.Now + " ] => [ Already Logged In With : " + _Username + " ]");
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                }


                string Url = "https://www.linkedin.com/";
                ////string pageSrcLogin = HttpChilkat.GetHtmlProxy(Url, proxyAddress, proxyPort, proxyUserName, proxyPassword);
                string pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), _ProxyAddress, int.Parse(_ProxyPort), _ProxyUsername, _ProxyPassword);

                if (string.IsNullOrEmpty(pageSrcLogin))
                {
                    try
                    {
                        System.Threading.Thread.Sleep(1000);
                        pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), _ProxyAddress, int.Parse(_ProxyPort), _ProxyUsername, _ProxyPassword, "");
                    }
                    catch
                    {
                    }
                }
                if (string.IsNullOrEmpty(pageSrcLogin))
                {
                    Log("[ " + DateTime.Now + " ] => [ Couldn't Login In With : " + _Username + " ]");
                    return;
                }

                string postdata     = string.Empty;
                string postUrl      = string.Empty;
                string ResLogin     = string.Empty;
                string csrfToken    = string.Empty;
                string sourceAlias  = string.Empty;
                string regCsrfParam = string.Empty;

                if (pageSrcLogin.Contains("csrfToken"))
                {
                    try
                    {
                        int startindex = pageSrcLogin.IndexOf("name=\"csrfToken\"");
                        if (startindex > 0)
                        {
                            string start    = pageSrcLogin.Substring(startindex).Replace("name=\"csrfToken\"", "");
                            int    endindex = start.IndexOf("\" ");
                            string end      = start.Substring(0, endindex);
                            csrfToken = end.Replace("value=\"", "").Replace("\\", "").Replace(" ", "");
                            //csrfToken = Uri.EscapeDataString(csrfToken);
                            if (csrfToken.Contains("https://www.linkedin.com"))
                            {
                                csrfToken = Utils.getBetween("@@@@@@@" + csrfToken, "@@@@@@@", "\"/></form>");
                            }
                        }
                        else
                        {
                            string[] Arr = csrfToken.Split('"');
                            csrfToken = Arr[2].Replace("\\", string.Empty);
                        }
                    }
                    catch
                    {
                        try
                        {
                            csrfToken = pageSrcLogin.Substring(pageSrcLogin.IndexOf("csrfToken"), 100);
                            if (csrfToken.Contains("&"))
                            {
                                string[] Arr = csrfToken.Split('&');
                                csrfToken = Arr[0];
                            }
                            else if (csrfToken.Contains(","))
                            {
                                string[] Arr = csrfToken.Split(',');
                                csrfToken = Arr[0].Replace("\\", string.Empty);
                            }
                            else
                            {
                                string[] Arr = csrfToken.Split(',');
                                csrfToken = Arr[0].Replace("\\", string.Empty).Replace("csrfToken=", "").Replace("\n", "").Replace("\">", "");
                            }
                        }
                        catch { }
                    }
                }

                try
                {
                    if (csrfToken.Contains("&"))
                    {
                        string[] Arr1 = csrfToken.Split('&');
                        csrfToken = Arr1[0].Replace("\"", string.Empty);
                    }
                }
                catch { }

                SearchCriteria.CsrToken = csrfToken.Replace("\n", "").Replace("//", "").Replace("\">", "").Replace("csrfToken=", "");


                if (pageSrcLogin.Contains("sourceAlias"))
                {
                    try
                    {
                        sourceAlias = pageSrcLogin.Substring(pageSrcLogin.IndexOf("sourceAlias"), 100);
                        string[] Arr = sourceAlias.Split('"');
                        sourceAlias = Arr[2].Replace("\\", string.Empty);
                    }
                    catch { }
                }

                try
                {
                    int SourceAliasStart = pageSrcLogin.IndexOf("regCsrfParam");
                    if (SourceAliasStart > 0)
                    {
                        try
                        {
                            regCsrfParam = pageSrcLogin.Substring(pageSrcLogin.IndexOf("regCsrfParam"), 100);
                            string[] Arr = regCsrfParam.Split('"');
                            regCsrfParam = Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty);
                        }
                        catch
                        {
                        }
                    }
                    if (string.IsNullOrEmpty(regCsrfParam))
                    {
                        regCsrfParam = Utils.getBetween(pageSrcLogin, "loginCsrfParam", "/>");
                        regCsrfParam = Utils.getBetween(regCsrfParam, "value=\"", "\"");
                    }
                }
                catch { }


                postUrl = "https://www.linkedin.com/uas/login-submit";
                //postdata = "isJsEnabled=true&source_app=&tryCount=&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign%20In&session_redirect=&loginCsrfParam=" + regCsrfParam + "&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;

                postdata = "isJsEnabled=true&source_app=&tryCount=&clickedSuggestion=false&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign%20In&session_redirect=&trk=hb_signin&loginCsrfParam=" + regCsrfParam + "&fromEmail=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;
                // postdata = "isJsEnabled=true&source_app=&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign+In&session_redirect=&trk=&loginCsrfParam=7462d247-6d54-47de-8f22-29723ea15f9d&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;
                try
                {
                    ResLogin = HttpHelper.postFormDataProxy(new Uri(postUrl), postdata, _ProxyAddress, int.Parse(_ProxyPort), _ProxyUsername, _ProxyPassword);//HttpHelper.postFormDataRef(new Uri(postUrl), postdata, "http://www.linkedin.com/uas/login?goback=&trk=hb_signin", "", "");
                }
                catch { }


                //postUrl = "https://www.linkedin.com/uas/login-submit";
                //isJsEnabled=true&source_app=&tryCount=&session_key=gargimishra%40globussoft.com&session_password=globussoft&signin=Sign%20In&session_redirect=&csrfToken=ajax%3A7066152446927176852&sourceAlias=0_7r5yezRXCiA_H0CRD8sf6DhOjTKUNps5xGTqeX8EEoi
                //postdata = "isJsEnabled=true&source_app=&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign%20In&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;
                // postdata = "session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&source_app=&trk=guest_home_login&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;

                //ResLogin = HttpHelper.postFormDataRef(new Uri(postUrl), postdata, "https://www.linkedin.com/uas/login?goback=&trk=hb_signin", "true", "");
                string dts = string.Empty;
                string captchachallengeid = string.Empty;
                string origActionAlias    = string.Empty;
                string origSourceAlias    = string.Empty;
                string irhf        = string.Empty;
                string captchaText = string.Empty;
                string ImageUrl    = string.Empty;
                //
                if (ResLogin.Contains("Your LinkedIn account has been temporarily restricted") || ResLogin.Contains("Change your password") || ResLogin.Contains("Please confirm your email address") && !ResLogin.Contains("Sign Out"))
                {
                    SearchCriteria.loginREsponce = ResLogin;
                }
                else if (ResLogin.Contains("Security Verification"))
                {
                    string dataforcapctha = HttpHelper.getHtmlfromUrl1(new Uri("https://www.google.com/recaptcha/api/noscript?k=6LcnacMSAAAAADoIuYvLUHSNLXdgUcq-jjqjBo5n"));
                    if (!string.IsNullOrEmpty(dataforcapctha))
                    {
                        int startindex = dataforcapctha.IndexOf("id=\"recaptcha_challenge_field\"");
                        if (startindex > 0)
                        {
                            string start    = dataforcapctha.Substring(startindex).Replace("id=\"recaptcha_challenge_field\"", "");
                            int    endindex = start.IndexOf("\">");
                            string end      = start.Substring(0, endindex).Replace("value=", "").Replace("\"", "");
                            ImageUrl = "https://www.google.com/recaptcha/api/image?c=" + end;
                            WebClient webclient = new WebClient();
                            byte[]    args      = webclient.DownloadData(ImageUrl);
                            string[]  arr1      = new string[] { Globals.CapchaLoginID, Globals.CapchaLoginPassword, "" };
                            captchaText = DecodeDBC(arr1, args);
                        }

                        if (ResLogin.Contains("name=\"security-challenge-id\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"security-challenge-id\"");
                            if (startindexnew > 0)
                            {
                                string start    = ResLogin.Substring(startindexnew).Replace("name=\"security-challenge-id\"", "").Replace("value=\"", "");
                                int    endindex = start.IndexOf("\"");
                                string end      = start.Substring(0, endindex);
                                captchachallengeid = end.Replace("\"", "");
                            }
                        }

                        if (ResLogin.Contains("name=\"dts\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"dts\"");
                            if (startindexnew > 0)
                            {
                                string start    = ResLogin.Substring(startindexnew).Replace("name=\"dts\"", "").Replace("value=\"", "");
                                int    endindex = start.IndexOf("\"");
                                string end      = start.Substring(0, endindex);
                                dts = end.Replace("\"", "");
                            }
                        }

                        if (ResLogin.Contains("name=\"origActionAlias\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"origActionAlias\"");
                            if (startindexnew > 0)
                            {
                                string start    = ResLogin.Substring(startindexnew).Replace("name=\"origActionAlias\"", "").Replace("value=\"", "");
                                int    endindex = start.IndexOf("\"");
                                string end      = start.Substring(0, endindex);
                                origActionAlias = end.Replace("\"", "");
                            }
                        }

                        if (ResLogin.Contains("name=\"origSourceAlias\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"origSourceAlias\"");
                            if (startindexnew > 0)
                            {
                                string start    = ResLogin.Substring(startindexnew).Replace("name=\"origSourceAlias\"", "").Replace("value=\"", "");
                                int    endindex = start.IndexOf("\"");
                                string end      = start.Substring(0, endindex);
                                origSourceAlias = end.Replace("\"", "");
                            }
                        }

                        if (ResLogin.Contains("name=\"irhf\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"irhf\"");
                            if (startindexnew > 0)
                            {
                                string start    = ResLogin.Substring(startindexnew).Replace("name=\"irhf\"", "").Replace("value=\"", "");
                                int    endindex = start.IndexOf("\"");
                                string end      = start.Substring(0, endindex);
                                irhf = end.Replace("\"", "");
                            }
                        }

                        //postdata = "dts=" + dts + "&security-challenge-id=" + captchachallengeid + "&hr=&source_app=&csrfToken=" + csrfToken + "&trk=guest_home&isJsEnabled=true&session_redirect=&session_password="******"&session_key=" + _Username + "&origSourceAlias=" + origSourceAlias + "&origActionAlias=" + origActionAlias + "&irhf=" + irhf +"&sourceAlias=" + sourceAlias;
                        if (!string.IsNullOrEmpty(ImageUrl) && !string.IsNullOrEmpty(captchaText))
                        {
                            postdata = "recaptcha_challenge_field=" + ImageUrl.Replace("https://www.google.com/recaptcha/api/image?c=", "") + "&recaptcha_response_field=" + captchaText.Replace(" ", "+") + "&dts=" + dts + "&security-challenge-id=" + captchachallengeid + "&hr=&source_app=&csrfToken=" + csrfToken + "&isJsEnabled=true&session_redirect=&session_password="******"&session_key=" + Uri.EscapeDataString(_Username) + "&origSourceAlias=" + origSourceAlias + "&origActionAlias=" + origActionAlias + "&irhf=" + irhf + "&sourceAlias=" + sourceAlias;
                            postdata = postdata.Replace(" ", "");
                            ResLogin = HttpHelper.postFormDataRef(new Uri("https://www.linkedin.com/uas/captcha-submit"), postdata, "https://www.linkedin.com/uas/login-submit", "", "", "", "", "");
                        }
                        else
                        {
                            ResLogin = "";
                        }

                        if (ResLogin.Contains("The text you entered does not match the characters in the security image. Please try again with this new image") || string.IsNullOrEmpty(ResLogin))
                        {
                            Log("[ " + DateTime.Now + " ] => [ " + _Username + " Cannot Login because of Capctcha ]");
                            GlobusFileHelper.WriteStringToTextfile(_Username + ":" + _Password + ":" + _ProxyAddress + ":" + _ProxyPort + ":" + _ProxyUsername + ":" + _ProxyPassword, Globals.pathCapcthaLogin);
                            SearchCriteria.loginREsponce = string.Empty;
                        }
                    }
                }

                //ResLogin.Contains("Sign Out") && ResLogin.Contains("class=\"signout\"") && !ResLogin.Contains("Your LinkedIn account has been temporarily restricted")
                if (ResLogin.Contains("Sign Out") && !ResLogin.Contains("Your LinkedIn account has been temporarily restricted"))
                {
                    SearchCriteria.loginREsponce = string.Empty;
                    IsLoggedIn = true;
                    string Search = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/search?trk=advsrch"));
                    SearchCriteria.loginREsponce = Search;
                }
                else if (ResLogin.Contains("logout?session_full_logout"))
                {
                    SearchCriteria.loginREsponce = string.Empty;
                    IsLoggedIn = true;
                    string Search = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/search?trk=advsrch"));
                    SearchCriteria.loginREsponce = Search;
                }
                else
                {
                    //There was an unexpected problem that prevented us from completing your request.
                    SearchCriteria.loginREsponce = string.Empty;
                    IsLoggedIn = false;
                }


                //Url = "http://www.linkedin.com/home?trk=hb_tab_home_top";
                //pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, 888, proxyUserName, proxyPassword);

                //LogoutHttpHelper(ref HttpHelper);

                //Url = "http://www.linkedin.com/home?trk=hb_tab_home_top";
                //pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, 888, proxyUserName, proxyPassword);
            }
            catch { }
        }
Esempio n. 2
0
        public Dictionary<string, string> AddSpecificGroupUser(ref GlobusHttpHelper HttpHelper, string UserID, string gid)
        {
            string endName = string.Empty;
            string DeegreeConn = string.Empty;
            string endKey = string.Empty;
            string Locality = string.Empty;
            string Val_sourceAlias = string.Empty;
            string Val_key = string.Empty;
            string Val_defaultText = string.Empty;
            string Name = string.Empty;
            string Val_CsrToken = string.Empty;
            string Val_Subject = string.Empty;
            string Val_greeting = string.Empty;
            string Val_AuthToken = string.Empty;
            string Val_AuthType = string.Empty;
            string val_trk = string.Empty;
            string Val_lastName = string.Empty;
            string html = string.Empty;
            string Title = string.Empty;

            #region Data Initialization
            string GroupMemId = string.Empty;
            string GroupName = string.Empty;
            string Industry = string.Empty;
            string URLprofile = string.Empty;
            string firstname = string.Empty;
            string lastname = string.Empty;
            string location = string.Empty;
            string country = string.Empty;
            string postal = string.Empty;
            string phone = string.Empty;
            string USERemail = string.Empty;
            string code = string.Empty;
            string education1 = string.Empty;
            string education2 = string.Empty;
            string titlecurrent = string.Empty;
            string companycurrent = string.Empty;
            string titlepast1 = string.Empty;
            string companypast1 = string.Empty;
            string titlepast2 = string.Empty;
            string companypast2 = string.Empty;
            string titlepast3 = string.Empty;
            string companypast3 = string.Empty;
            string titlepast4 = string.Empty;
            string companypast4 = string.Empty;
            string Recommendations = string.Empty;
            string Connection = string.Empty;
            string Designation = string.Empty;
            string Website = string.Empty;
            string Contactsettings = string.Empty;
            string recomandation = string.Empty;

            string titleCurrenttitle = string.Empty;
            string titleCurrenttitle2 = string.Empty;
            string titleCurrenttitle3 = string.Empty;
            string titleCurrenttitle4 = string.Empty;
            string Skill = string.Empty;
            string TypeOfProfile = "Public";
            List<string> EducationList = new List<string>();
            string Finaldata = string.Empty;
            string EducationCollection = string.Empty;
            List<string> checkerlst = new List<string>();
            List<string> checkgrplist = new List<string>();
            string groupscollectin = string.Empty;
            string strFamilyName = string.Empty;
            string LDS_LoginID = string.Empty;
            string LDS_Websites = string.Empty;
            string LDS_UserProfileLink = string.Empty;
            string LDS_CurrentTitle = string.Empty;
            string LDS_Experience = string.Empty;
            string LDS_UserContact = string.Empty;
            string LDS_PastTitles = string.Empty;
            string LDS_BackGround_Summary = string.Empty;
            string LDS_Desc_AllComp = string.Empty;
            string Company = string.Empty;
            List<string> lstpasttitle = new List<string>();
            List<string> checkpasttitle = new List<string>();
            string csrfToken = string.Empty;
            string pageSource = string.Empty;
            string[] RgxSikValue = new string[] { };
            string[] RgxPageNo = new string[] { };
            string sikvalue = string.Empty;
            int pageno = 25;
            int counter = 0;
            #endregion

            try
            {
                GroupSpecMem.Clear();
                GroupName = gid.Split(':')[0];

                string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));

                if (pageSource1.Contains("csrfToken"))
                {
                    csrfToken = pageSource1.Substring(pageSource1.IndexOf("csrfToken"), 50);
                    string[] Arr = csrfToken.Split('>');
                    csrfToken = Arr[0];
                    csrfToken = csrfToken.Replace(":", "%3A").Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty).Replace("\n", string.Empty).Replace(">", string.Empty).Replace("<script src", string.Empty);
                    csrfToken = csrfToken.Trim();
                }

                for (int i = 1; i <= pageno; i++)
                {
                    counter++;

                    string[] RgxGroupData = new string[] { };

                    if (WithGroupSearch == true)
                    {

                        string txid = (UnixTimestampFromDateTime(System.DateTime.Now) * 1000).ToString();

                        if (counter == 1)
                        {
                            pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[2]));
                            RgxSikValue = System.Text.RegularExpressions.Regex.Split(pageSource, "sik");
                            try
                            {
                                sikvalue = RgxSikValue[1].Split('&')[0].Replace("=", string.Empty);
                            }
                            catch { }

                            try
                            {
                                if (NumberHelper.ValidateNumber(sikvalue))
                                {
                                    sikvalue = sikvalue.Split('\"')[0];
                                }
                                else
                                {
                                    sikvalue = sikvalue.Split('\"')[0];
                                }
                            }
                            catch
                            {
                                sikvalue = sikvalue.Split('\"')[0];
                            }

                            if (!string.IsNullOrEmpty(sikvalue))
                            {
                                string postdata = "csrfToken=" + csrfToken + "&searchField=" + SearchKeyword + "&searchMembers=submit&searchMembers=Search&gid=" + gid.Split(':')[2] + "&goback=.gna_" + gid.Split(':')[2] + "";
                                pageSource = HttpHelper.postFormDataRef(new Uri("http://www.linkedin.com/groups"), postdata, "http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[2] + "&sik=" + txid + "&split_page=" + i + "&goback=%2Egna_" + gid.Split(':')[2] + "", "", "");

                            }
                            else
                            {
                                pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/grp/members?csrfToken="+csrfToken+"&search="+SearchKeyword.Replace(" ","+")+"&gid=" + gid.Split(':')[2]));
                            }
                        }

                        if (!string.IsNullOrEmpty(sikvalue))
                        {
                            if (counter > 1)
                            {

                                string getdata = "http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[2] + "&sik=" + txid + "&split_page=" + i + "&goback=%2Egna_" + gid.Split(':')[2] + "";
                                pageSource = HttpHelper.getHtmlfromUrl(new Uri(getdata));
                            }

                            RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"member\" id=\"");

                            if (counter == 1)
                            {
                                try
                                {
                                    RgxPageNo = System.Text.RegularExpressions.Regex.Split(pageSource, "<h3 class=\"page-title\">Search Results: <span>");
                                    pageno = Convert.ToInt32(RgxPageNo[1].Split('<')[0].Replace("(", string.Empty).Replace(")", string.Empty).Replace("+", string.Empty).Trim());
                                    pageno = pageno / 20 + 1;
                                }
                                catch { }

                                if (pageno > 25)
                                {
                                    pageno = 25;
                                }
                            }
                        }
                        else
                        {
                           // RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"member\">");
                            if (counter > 1)
                            {

                                string getdata = "https://www.linkedin.com/grp/members?csrfToken=" + csrfToken + "&search=" + SearchKeyword.Replace(" ", "+") + "&gid=" + gid.Split(':')[2] + "&page="+i;
                                pageSource = HttpHelper.getHtmlfromUrl(new Uri(getdata));
                            }

                            RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"member\">");

                            if (counter == 1)
                            {
                                try
                                {
                                    RgxPageNo = System.Text.RegularExpressions.Regex.Split(pageSource, "<h3 class=\"page-title\">Search Results <span>");
                                    pageno = Convert.ToInt32(RgxPageNo[1].Split('<')[0].Replace("(", string.Empty).Replace(")", string.Empty).Replace("+", string.Empty).Trim());
                                    pageno = pageno / 20 + 1;
                                }
                                catch { }

                                if (pageno > 25)
                                {
                                    pageno = 25;
                                }
                            }
                        }
                    }
                    else
                    {
                        //pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[2] + "&split_page=" + i + ""));
                        pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/grp/members?gid=" + gid.Split(':')[2] + "&page=" + i));

                        RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"member\" id=\"");
                        if (RgxGroupData.Length == 1)
                        {
                            RgxGroupData = Regex.Split(pageSource, "<span class=\"new-miniprofile-container\"");
                            if (RgxGroupData.Length == 1)
                            {
                                break;
                            }
                        }
                    }

                    #region for csv
                    if (WithCsvinAddFriend == true)
                    {
                        List<string> PageSerchUrl = ChilkatBasedRegex.GettingAllUrls(pageSource, "profile/view?id");
                        string FrnAcceptUrL = string.Empty;
                        foreach (string item in PageSerchUrl)
                        {
                            try
                            {
                                if (item.Contains("/profile/view?id"))
                                {
                                    FrnAcceptUrL = "http://www.linkedin.com" + item;
                                    string[] urll = Regex.Split(FrnAcceptUrL, "&authType");
                                    Log("[ " + DateTime.Now + " ] => [ " + FrnAcceptUrL + " ]");

                                    string stringSource = HttpHelper.getHtmlfromUrl1(new Uri(FrnAcceptUrL));

                                    #region GroupMemId
                                    try
                                    {
                                        string[] gid1 = FrnAcceptUrL.Split('&');
                                        GroupMemId = gid1[0].Replace("http://www.linkedin.com/profile/view?id=", string.Empty);
                                    }
                                    catch { }
                                    #endregion

                                    #region Name
                                    try
                                    {
                                        try
                                        {
                                            strFamilyName = stringSource.Substring(stringSource.IndexOf("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\""), (stringSource.IndexOf("i18n__expand_your_network_to_see_more", stringSource.IndexOf("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\"")) - stringSource.IndexOf("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\""))).Replace("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\"", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim();
                                        }
                                        catch
                                        {
                                            try
                                            {
                                                strFamilyName = stringSource.Substring(stringSource.IndexOf("i18n__Overview_for_X"), (stringSource.IndexOf(",", stringSource.IndexOf("i18n__Overview_for_X")) - stringSource.IndexOf("i18n__Overview_for_X"))).Replace("i18n__Overview_for_X", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":Overview for", "").Trim();

                                            }
                                            catch { }
                                        }
                                    }
                                    catch { }

                                    #endregion

                                    #region Namesplitation
                                    string[] NameArr = new string[5];
                                    if (strFamilyName.Contains(" "))
                                    {
                                        try
                                        {
                                            NameArr = Regex.Split(strFamilyName, " ");
                                        }
                                        catch { }
                                    }
                                    #endregion

                                    #region FirstName
                                    try
                                    {
                                        firstname = NameArr[0];
                                    }
                                    catch { }
                                    #endregion

                                    #region LastName

                                    try
                                    {
                                        lastname = NameArr[1];

                                        if (NameArr.Count() == 3)
                                        {
                                            lastname = NameArr[1] + " " + NameArr[2];
                                        }

                                        if (lastname.Contains("}]"))
                                        {

                                            #region Name
                                            try
                                            {
                                                try
                                                {
                                                    strFamilyName = stringSource.Substring(stringSource.IndexOf("<span class=\"n fn\">")).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim();
                                                }
                                                catch
                                                {
                                                    try
                                                    {
                                                        strFamilyName = stringSource.Substring(stringSource.IndexOf("fmt__full_name\":"), (stringSource.IndexOf(",", stringSource.IndexOf("fmt__full_name\":")) - stringSource.IndexOf("fmt__full_name\":"))).Replace("fmt__full_name\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim();

                                                    }
                                                    catch { }
                                                }
                                            }
                                            catch { }
                                            #endregion
                                        }
                                    }
                                    catch { }
                                    #endregion

                                    #region Company
                                    Company = string.Empty;
                                    try
                                    {
                                        try
                                        {
                                            try
                                            {
                                                //Company = stringSource.Substring(stringSource.IndexOf("visible\":true,\"memberHeadline"), (stringSource.IndexOf("memberID", stringSource.IndexOf("visible\":true,\"memberHeadline")) - stringSource.IndexOf("visible\":true,\"memberHeadline"))).Replace("visible\":true,\"memberHeadline", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("   ", string.Empty).Trim();
                                                Company = stringSource.Substring(stringSource.IndexOf("\"memberHeadline"), (stringSource.IndexOf("memberID", stringSource.IndexOf("\"memberHeadline")) - stringSource.IndexOf("\"memberHeadline"))).Replace("\"memberHeadline", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("i18n__LocationLocationcompletenessLevel4", string.Empty).Replace("visibletrue", "").Replace("isPortfoliofalse", string.Empty).Replace("isLNLedtrue", string.Empty).Trim();
                                            }
                                            catch
                                            {
                                            }

                                            if (string.IsNullOrEmpty(Company))
                                            {
                                                try
                                                {
                                                    //memberHeadline
                                                    Company = stringSource.Substring(stringSource.IndexOf("memberHeadline\":"), (stringSource.IndexOf(",", stringSource.IndexOf("memberHeadline\":")) - stringSource.IndexOf("memberHeadline\":"))).Replace("memberHeadline\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("   ", string.Empty).Replace(":", "").Replace("&dsh;", "").Replace("&amp", "").Replace(";", "").Replace("isPortfoliofalse", string.Empty).Replace("isLNLedtrue", string.Empty).Trim();
                                                }
                                                catch
                                                {
                                                }

                                            }

                                            titlecurrent = string.Empty;
                                            companycurrent = string.Empty;
                                            string[] strdesigandcompany = new string[4];
                                            if (Company.Contains(" at ") || Company.Contains(" of "))
                                            {
                                                try
                                                {
                                                    strdesigandcompany = Regex.Split(Company, " at ");

                                                    if (strdesigandcompany.Count() == 1)
                                                    {
                                                        strdesigandcompany = Regex.Split(Company, " of ");
                                                    }
                                                }
                                                catch { }

                                                #region Title
                                                try
                                                {
                                                    titlecurrent = strdesigandcompany[0];
                                                }
                                                catch { }
                                                #endregion

                                                #region Current Company
                                                try
                                                {
                                                    companycurrent = strdesigandcompany[1];
                                                }
                                                catch { }
                                                #endregion
                                            }

                                            if (titlecurrent == string.Empty)
                                            {
                                                titlecurrent = Company;
                                            }
                                        }
                                        catch { }

                                        #region PastCompany
                                        string[] companylist = Regex.Split(stringSource, "companyName\"");
                                        string AllComapny = string.Empty;

                                        string Companyname = string.Empty;
                                        checkerlst.Clear();
                                        foreach (string item1 in companylist)
                                        {
                                            try
                                            {
                                                if (!item1.Contains("<!DOCTYPE html>"))
                                                {
                                                    Companyname = item1.Substring(item1.IndexOf(":"), (item1.IndexOf(",", item1.IndexOf(":")) - item1.IndexOf(":"))).Replace(":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("]", string.Empty).Replace("}", string.Empty).Trim();
                                                    //Checklist.Add(item);
                                                    string items = item1;
                                                    checkerlst.Add(Companyname);
                                                    checkerlst = checkerlst.Distinct().ToList();
                                                }
                                            }
                                            catch { }
                                        }
                                        AllComapny = string.Empty;
                                        foreach (string item1 in checkerlst)
                                        {
                                            if (string.IsNullOrEmpty(AllComapny))
                                            {
                                                AllComapny = item1.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                                            }
                                            else
                                            {
                                                AllComapny = AllComapny + " : " + item1.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                                            }
                                        }

                                        if (companycurrent == string.Empty)
                                        {
                                            companycurrent = checkerlst[0].ToString();
                                        }
                                        #endregion

                                    #endregion Company

                                        #region Company Descripription

                                        try
                                        {
                                            string[] str_CompanyDesc = Regex.Split(stringSource, "showSummarySection");

                                            foreach (string item2 in str_CompanyDesc)
                                            {
                                                try
                                                {
                                                    string Current_Company = string.Empty;
                                                    if (!item2.Contains("<!DOCTYPE html>"))
                                                    {
                                                        int startindex = item2.IndexOf("specialties\":\"");

                                                        if (startindex > 0)
                                                        {
                                                            try
                                                            {
                                                                string start = item2.Substring(startindex).Replace("specialties\":", "");
                                                                int endindex = start.IndexOf("\",\"associatedWith\"");
                                                                string end = start.Substring(0, endindex);
                                                                Current_Company = end.Replace(",\"specialties_lb\":", string.Empty).Replace("\"", string.Empty).Replace("summary_lb", "Summary").Replace(",", ";").Replace("\"u002", "-");
                                                                LDS_BackGround_Summary = Current_Company;
                                                            }
                                                            catch { }
                                                        }

                                                    }

                                                    if (!item2.Contains("<!DOCTYPE html>"))
                                                    {
                                                        int startindex = item2.IndexOf("\"summary_lb\"");

                                                        if (startindex > 0)
                                                        {
                                                            try
                                                            {
                                                                string start = item2.Substring(startindex).Replace("\"summary_lb\"", "");
                                                                int endindex = start.IndexOf("\",\"associatedWith\"");
                                                                string end = start.Substring(0, endindex);
                                                                Current_Company = end.Replace(",\"specialties_lb\":", string.Empty).Replace("<br>", string.Empty).Replace("\n\"", string.Empty).Replace("\"", string.Empty).Replace("summary_lb", "Summary").Replace(",", ";").Replace("u002", "-").Replace(":", string.Empty);
                                                                LDS_BackGround_Summary = Current_Company;
                                                            }
                                                            catch { }
                                                        }

                                                    }

                                                }
                                                catch { }
                                            }
                                        }
                                        catch { }

                                        #endregion

                                        #region Education
                                        EducationCollection = string.Empty;
                                        try
                                        {
                                            try
                                            {
                                                EducationCollection = stringSource.Substring(stringSource.IndexOf("\"schoolName\":"), (stringSource.IndexOf(",", stringSource.IndexOf("\"schoolName\":")) - stringSource.IndexOf("\"schoolName\":"))).Replace("\"schoolName\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim();
                                            }
                                            catch
                                            {
                                                try
                                                {
                                                    //  education1 = stringSource.Substring(stringSource.IndexOf("i18n__Overview_for_X"), (stringSource.IndexOf(",", stringSource.IndexOf("i18n__Overview_for_X")) - stringSource.IndexOf("i18n__Overview_for_X"))).Replace("i18n__Overview_for_X", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":Overview for", "").Trim();

                                                }
                                                catch { }
                                            }
                                        }
                                        catch { }

                                        #endregion

                                        #region Email
                                        try
                                        {
                                            string[] str_Email = Regex.Split(stringSource, "email\"");
                                            USERemail = stringSource.Substring(stringSource.IndexOf("[{\"email\":"), (stringSource.IndexOf("}]", stringSource.IndexOf("[{\"email\":")) - stringSource.IndexOf("[{\"email\":"))).Replace("[{\"email\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                                        }
                                        catch (Exception ex)
                                        {

                                        }
                                        #endregion Email

                                        #region Website
                                        Website = string.Empty;
                                        try
                                        {
                                            Website = stringSource.Substring(stringSource.IndexOf("[{\"URL\":"), (stringSource.IndexOf(",", stringSource.IndexOf("[{\"URL\":")) - stringSource.IndexOf("[{\"URL\":"))).Replace("[{\"URL\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace("}]", string.Empty).Trim();
                                        }
                                        catch { }
                                        #endregion Website

                                        #region location
                                        location = string.Empty;
                                        try
                                        {
                                            location = stringSource.Substring(stringSource.IndexOf("Country\",\"fmt__location\":"), (stringSource.IndexOf("i18n_no_location_matches", stringSource.IndexOf("Country\",\"fmt__location\":")) - stringSource.IndexOf("Country\",\"fmt__location\":"))).Replace("Country\",\"fmt__location\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(":", string.Empty).Replace(",", string.Empty).Trim();
                                        }
                                        catch (Exception ex)
                                        {
                                            try
                                            {
                                                if (string.IsNullOrEmpty(location))
                                                {
                                                    int startindex = stringSource.IndexOf("\"fmt_location\":\"");
                                                    if (startindex > 0)
                                                    {
                                                        string start = stringSource.Substring(startindex).Replace("\"fmt_location\":\"", "");
                                                        int endindex = start.IndexOf("\",");
                                                        string end = start.Substring(0, endindex);
                                                        country = end;
                                                    }
                                                }
                                            }
                                            catch (Exception ex1)
                                            {

                                            }
                                        }

                                        #endregion location

                                        #region Country
                                        try
                                        {
                                            int startindex = stringSource.IndexOf("\"locationName\":\"");
                                            if (startindex > 0)
                                            {
                                                string start = stringSource.Substring(startindex).Replace("\"locationName\":\"", "");
                                                int endindex = start.IndexOf("\",");
                                                string end = start.Substring(0, endindex);
                                                location = end;
                                            }
                                        }
                                        catch (Exception ex)
                                        {

                                        }
                                        #endregion

                                        #region Industry
                                        Industry = string.Empty;
                                        try
                                        {
                                            //Industry = stringSource.Substring(stringSource.IndexOf("fmt__industry_highlight\":"), (stringSource.IndexOf(",", stringSource.IndexOf("fmt__industry_highlight\":")) - stringSource.IndexOf("fmt__industry_highlight\":"))).Replace("fmt__industry_highlight\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                                            int startindex = stringSource.IndexOf("\"industry_highlight\":\"");
                                            if (startindex > 0)
                                            {
                                                string start = stringSource.Substring(startindex).Replace("\"industry_highlight\":\"", "");
                                                int endindex = start.IndexOf("\",");
                                                string end = start.Substring(0, endindex).Replace("&amp;", "&");
                                                Industry = end;
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                        }
                                        #endregion Industry

                                        #region Connection
                                        Connection = string.Empty;
                                        try
                                        {
                                            //Connection = stringSource.Substring(stringSource.IndexOf("_count_string\":"), (stringSource.IndexOf(",", stringSource.IndexOf("_count_string\":")) - stringSource.IndexOf("_count_string\":"))).Replace("_count_string\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                                            int startindex = stringSource.IndexOf("\"numberOfConnections\":");
                                            if (startindex > 0)
                                            {
                                                string start = stringSource.Substring(startindex).Replace("\"numberOfConnections\":", "");
                                                int endindex = start.IndexOf(",");
                                                string end = start.Substring(0, endindex).Replace("&amp;", "&").Replace("}", string.Empty);
                                                Connection = end;
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                        }
                                        #endregion Connection

                                        #region Recommendation
                                        try
                                        {
                                            //recomandation = stringSource.Substring(stringSource.IndexOf("i18n__Recommend_Query\":"), (stringSource.IndexOf(",", stringSource.IndexOf("i18n__Recommend_Query\":")) - stringSource.IndexOf("i18n__Recommend_Query\":"))).Replace("i18n__Recommend_Query\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                                            string PageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/profile-v2-endorsements?id=" + GroupMemId + "&authType=OUT_OF_NETWORK&authToken=rXRG&goback=%2Efps_PBCK_*1_*1_*1_*1_*1_*1_tcs_*2_CP_I_us_*1_*1_false_1_R_*1_*51_*1_*51_true_*1_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2"));
                                            string[] arrayRecommendedName = Regex.Split(PageSource, "headline");
                                            List<string> ListRecommendationName = new List<string>();
                                            recomandation = string.Empty;
                                            foreach (var itemRecomName in arrayRecommendedName)
                                            {
                                                try
                                                {
                                                    if (!itemRecomName.Contains("Endorsements"))
                                                    {
                                                        try
                                                        {

                                                            int startindex = itemRecomName.IndexOf(":");
                                                            string start = itemRecomName.Substring(startindex);
                                                            int endIndex = start.IndexOf("\",");
                                                            string Heading = (start.Substring(0, endIndex).Replace("\"", string.Empty).Replace(":", string.Empty));

                                                            int startindex1 = itemRecomName.IndexOf("fmt__referrerfullName");
                                                            string start1 = itemRecomName.Substring(startindex1);
                                                            int endIndex1 = start1.IndexOf("\",");
                                                            Name = (start1.Substring(0, endIndex1).Replace("\"", string.Empty).Replace("fmt__referrerfullName", string.Empty).Replace(":", string.Empty));

                                                            ListRecommendationName.Add(Name + " : " + Heading);
                                                        }
                                                        catch { }
                                                    }
                                                }
                                                catch { }

                                            }

                                            foreach (var item5 in ListRecommendationName)
                                            {
                                                if (recomandation == string.Empty)
                                                {
                                                    recomandation = item5;
                                                }
                                                else
                                                {
                                                    recomandation += "  -  " + item5;
                                                }
                                            }

                                        }
                                        catch { }
                                        #endregion

                                        #region Experience
                                        LDS_Experience = string.Empty;
                                        if (LDS_Experience == string.Empty)
                                        {
                                            try
                                            {
                                                string[] array = Regex.Split(stringSource, "title_highlight");
                                                string exp = string.Empty;
                                                string comp = string.Empty;
                                                List<string> ListExperince = new List<string>();
                                                string SelItem = string.Empty;

                                                foreach (var itemGrps in array)
                                                {
                                                    try
                                                    {
                                                        if (itemGrps.Contains("title_pivot") && !itemGrps.Contains("<!DOCTYPE html")) //">Join
                                                        {
                                                            try
                                                            {

                                                                int startindex = itemGrps.IndexOf("\":\"");
                                                                string start = itemGrps.Substring(startindex);
                                                                int endIndex = start.IndexOf(",");
                                                                exp = (start.Substring(0, endIndex).Replace("\"", string.Empty).Replace(":", string.Empty).Replace("&amp", "&").Replace(";", string.Empty).Replace("\\u002d", "-").Replace("name:", string.Empty));

                                                            }
                                                            catch { }

                                                            try
                                                            {

                                                                int startindex1 = itemGrps.IndexOf("companyName");
                                                                string start1 = itemGrps.Substring(startindex1);
                                                                int endIndex1 = start1.IndexOf(",");
                                                                comp = (start1.Substring(0, endIndex1).Replace("\"", string.Empty).Replace("companyName", string.Empty).Replace(":", string.Empty).Replace(";", string.Empty).Replace("\\u002d", "-").Replace("name:", string.Empty));

                                                            }
                                                            catch { }

                                                            if (titlecurrent == string.Empty)
                                                            {
                                                                titlecurrent = exp;
                                                            }

                                                            if (companycurrent == string.Empty)
                                                            {
                                                                companycurrent = comp;
                                                            }

                                                            ListExperince.Add(exp + ":" + comp);

                                                        }
                                                    }
                                                    catch { }
                                                }

                                                foreach (var itemExp in ListExperince)
                                                {
                                                    if (LDS_Experience == string.Empty)
                                                    {
                                                        LDS_Experience = itemExp;
                                                    }
                                                    else
                                                    {
                                                        LDS_Experience += "  -  " + itemExp;
                                                    }
                                                }

                                            }
                                            catch { }
                                        }

                                        #endregion

                                        #region Group
                                        try
                                        {
                                            string PageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/mappers?x-a=profile_v2_groups%2Cprofile_v2_follow%2Cprofile_v2_connections&x-p=profile_v2_discovery%2Erecords%3A4%2Ctop_card%2EprofileContactsIntegrationStatus%3A0%2Cprofile_v2_comparison_insight%2Edistance%3A1%2Cprofile_v2_right_fixed_discovery%2Eoffset%3A0%2Cprofile_v2_connections%2Edistance%3A1%2Cprofile_v2_right_fixed_discovery%2Erecords%3A4%2Cprofile_v2_network_overview_insight%2Edistance%3A1%2Cprofile_v2_right_top_discovery_teamlinkv2%2Eoffset%3A0%2Cprofile_v2_right_top_discovery_teamlinkv2%2Erecords%3A4%2Cprofile_v2_discovery%2Eoffset%3A0%2Cprofile_v2_summary_upsell%2EsummaryUpsell%3Atrue%2Cprofile_v2_network_overview_insight%2EnumConn%3A1668%2Ctop_card%2Etc%3Atrue&x-oa=bottomAliases&id=" + GroupMemId + "&locale=&snapshotID=&authToken=&authType=name&invAcpt=&notContactable=&primaryAction=&isPublic=false&sfd=true&_=1366115853014"));

                                            string[] array = Regex.Split(PageSource, "href=\"/groupRegistration?");
                                            string[] array1 = Regex.Split(PageSource, "groupRegistration?");
                                            List<string> ListGroupName = new List<string>();
                                            string SelItem = string.Empty;

                                            foreach (var itemGrps in array1)
                                            {
                                                try
                                                {
                                                    if (itemGrps.Contains("?gid=") && !itemGrps.Contains("<!DOCTYPE html")) //">Join
                                                    {
                                                        if (itemGrps.IndexOf("?gid=") == 0)
                                                        {
                                                            try
                                                            {
                                                                int startindex = itemGrps.IndexOf("\"name\":");
                                                                string start = itemGrps.Substring(startindex);
                                                                int endIndex = start.IndexOf(",");
                                                                ListGroupName.Add(start.Substring(0, endIndex).Replace("\"", string.Empty).Replace("amp", string.Empty).Replace("&", string.Empty).Replace(";", string.Empty).Replace("csrfToken", string.Empty).Replace("name:", string.Empty));
                                                            }
                                                            catch { }
                                                        }
                                                    }
                                                }
                                                catch { }
                                            }

                                            foreach (var item6 in ListGroupName)
                                            {
                                                if (groupscollectin == string.Empty)
                                                {
                                                    groupscollectin = item6;
                                                }
                                                else
                                                {
                                                    groupscollectin += "  -  " + item6;

                                                }
                                            }

                                        }
                                        catch { }

                                        #endregion

                                        #region skill and Expertise
                                        try
                                        {
                                            string[] strarr_skill = Regex.Split(stringSource, "endorse-item-name-text\"");
                                            string[] strarr_skill1 = Regex.Split(stringSource, "fmt__skill_name\"");
                                            if (strarr_skill.Count() >= 2)
                                            {
                                                foreach (string item7 in strarr_skill)
                                                {
                                                    try
                                                    {
                                                        if (!item7.Contains("!DOCTYPE html"))
                                                        {
                                                            try
                                                            {
                                                                string Grp = item7.Substring(item7.IndexOf("<"), (item7.IndexOf(">", item7.IndexOf("<")) - item7.IndexOf("<"))).Replace("<", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                                                                checkgrplist.Add(Grp);
                                                                checkgrplist.Distinct().ToList();
                                                            }
                                                            catch { }
                                                        }

                                                    }
                                                    catch { }
                                                }

                                                foreach (string item8 in checkgrplist)
                                                {
                                                    if (string.IsNullOrEmpty(Skill))
                                                    {
                                                        Skill = item8;
                                                    }
                                                    else
                                                    {
                                                        Skill = Skill + "  -  " + item8;
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                if (strarr_skill1.Count() >= 2)
                                                {
                                                    try
                                                    {
                                                        foreach (string skillitem in strarr_skill1)
                                                        {
                                                            if (!skillitem.Contains("!DOCTYPE html"))
                                                            {
                                                                try
                                                                {
                                                                    string Grp = skillitem.Substring(skillitem.IndexOf(":"), (skillitem.IndexOf("}", skillitem.IndexOf(":")) - skillitem.IndexOf(":"))).Replace(":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                                                                    checkgrplist.Add(Grp);
                                                                    checkgrplist.Distinct().ToList();
                                                                }
                                                                catch { }
                                                            }
                                                        }

                                                        foreach (string item9 in checkgrplist)
                                                        {
                                                            if (string.IsNullOrEmpty(Skill))
                                                            {
                                                                Skill = item9;
                                                            }
                                                            else
                                                            {
                                                                Skill = Skill + "  -  " + item9;
                                                            }
                                                        }
                                                    }
                                                    catch (Exception ex)
                                                    {

                                                    }
                                                }
                                            }
                                        }
                                        catch (Exception ex)
                                        {

                                        }

                                        #endregion

                                        #region Pasttitle and All Company Summary
                                        string[] pasttitles = Regex.Split(stringSource, "company_name");
                                        string pstTitlesitem = string.Empty;
                                        string pstDescCompitem = string.Empty;
                                        LDS_PastTitles = string.Empty;
                                        pasttitles = pasttitles.Skip(1).ToArray();
                                        foreach (string item10 in pasttitles)
                                        {
                                            if (item10.Contains("positionId"))
                                            {
                                                try
                                                {
                                                    int startindex = item10.IndexOf(":");
                                                    if (startindex > 0)
                                                    {
                                                        string start = item10.Substring(startindex).Replace(":\"", "");
                                                        int endindex = start.IndexOf("\",");
                                                        string end = start.Substring(0, endindex);
                                                        pstTitlesitem = end.Replace(",", ";");
                                                    }

                                                    if (string.IsNullOrEmpty(LDS_PastTitles))
                                                    {
                                                        LDS_PastTitles = pstTitlesitem;
                                                    }
                                                    else
                                                    {
                                                        LDS_PastTitles = LDS_PastTitles + "  :  " + pstTitlesitem;
                                                    }

                                                    int startindex1 = item10.IndexOf("summary_lb\":\"");
                                                    if (startindex > 0)
                                                    {
                                                        string start1 = item10.Substring(startindex1).Replace("summary_lb\":\"", "");
                                                        int endindex1 = 0;

                                                        if (start1.Contains("associatedWith"))
                                                        {
                                                            endindex1 = start1.IndexOf("\",\"associatedWith\"");

                                                            if (start1.Contains("\"}"))
                                                            {
                                                                endindex1 = start1.IndexOf("\"}");
                                                            }

                                                        }
                                                        else if (start1.Contains("\"}"))
                                                        {
                                                            endindex1 = start1.IndexOf("\"}");
                                                        }

                                                        string end1 = start1.Substring(0, endindex1);
                                                        pstDescCompitem = end1.Replace(",", ";").Replace("u002d", "-").Replace("<br>", string.Empty).Replace("\n\"", string.Empty);

                                                        if (pstDescCompitem.Contains("\";\"associatedWith"))
                                                        {
                                                            pstDescCompitem = Regex.Split(pstDescCompitem, "\";\"associatedWith")[0];
                                                        }
                                                    }

                                                    if (string.IsNullOrEmpty(LDS_Desc_AllComp))
                                                    {
                                                        LDS_Desc_AllComp = pstTitlesitem + "-" + pstDescCompitem + " ++ ";
                                                    }
                                                    else
                                                    {
                                                        LDS_Desc_AllComp = LDS_Desc_AllComp + pstTitlesitem + "-" + pstDescCompitem + " ++ ";
                                                    }
                                                }
                                                catch
                                                {
                                                }
                                            }

                                        }
                                        #endregion

                                        #region FullUrl
                                        try
                                        {
                                            string[] UrlFull = System.Text.RegularExpressions.Regex.Split(FrnAcceptUrL, "&authType");
                                            LDS_UserProfileLink = UrlFull[0];

                                            LDS_UserProfileLink = UrlFull[0];
                                            //  LDS_UserProfileLink = stringSource.Substring(stringSource.IndexOf("canonicalUrl\":"), (stringSource.IndexOf(",", stringSource.IndexOf("canonicalUrl\":")) - stringSource.IndexOf("canonicalUrl\":"))).Replace("canonicalUrl\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                                        }
                                        catch { }
                                        #endregion

                                        LDS_LoginID = UserID;

                                        if (string.IsNullOrEmpty(firstname))
                                        {
                                            firstname = "Linkedin Member";
                                        }

                                        LDS_BackGround_Summary = LDS_BackGround_Summary.Replace("\n", "").Replace("-", "").Replace("d", "").Replace("&#x2022", "").Replace(";", "").Replace("\n", "").Replace(",", "").Replace("&#x201", "").Trim();

                                        LDS_Desc_AllComp = "NA";
                                        Skill = "NA";

                                        string LDS_FinalData = TypeOfProfile + "," + LDS_UserProfileLink + "," + firstname + "," + lastname + "," + Company.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + companycurrent.Replace(",", ";") + "," + LDS_Desc_AllComp + "," + LDS_BackGround_Summary.Replace(",", ";") + "," + Connection.Replace(",", ";") + "," + recomandation.Replace(",", string.Empty) + "," + Skill.Replace(",", ";") + "," + LDS_Experience.Replace(",", string.Empty) + "," + EducationCollection.Replace(",", ";") + "," + groupscollectin.Replace(",", ";") + "," + USERemail.Replace(",", ";") + "," + LDS_UserContact.Replace(",", ";") + "," + LDS_PastTitles + "," + AllComapny.Replace(",", ";") + "," + country.Replace(",", ";") + "," + location.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + Website.Replace(",", ";") + "," + LDS_LoginID.Replace(",", ";") + ",";
                                        AppFileHelper.AddingLinkedInGroupMemberDataToCSVFile(LDS_FinalData, SearchCriteria.FileName);

                                    }
                                    catch { }
                                }

                            }
                            catch { }
                        }
                    }
                    #endregion

                    foreach (var GrpUser in RgxGroupData)
                    {
                       try
                        {
                            if (GrpUser.Contains("member"))
                            {
                                if (GrpUser.Contains("title=\"YOU") || GrpUser.Contains("<!DOCTYPE html>"))
                                {
                                    if (GrpUser.Contains("title=\"YOU"))
                                    {

                                    }
                                    continue;
                                }

                                try
                                {
                                    //data-li-fullName="Kashish Arora">Send message</a>

                                    int startindex = GrpUser.IndexOf("fullName=");
                                    if (startindex > 0)
                                    {
                                        endName = string.Empty;
                                        string start = GrpUser.Substring(startindex);
                                        int endIndex = start.IndexOf(">Send message<");
                                        if (endIndex == -1)
                                        {
                                            endIndex = start.IndexOf(">");
                                        }
                                        endName = start.Substring(0, endIndex).Replace("fullName=", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Replace("&amp;", "&").Replace("&quot;", "'").Replace("tracking=anetppl_sendmsg", string.Empty).Replace("tracking=anetppl_invite", string.Empty).Replace("\\u00e9","é").Trim();
                                    }
                                    else
                                    {
                                        endName = string.Empty;
                                        int startindex1 = GrpUser.IndexOf("alt=");
                                        string start = GrpUser.Substring(startindex1).Replace("alt=\"", "");
                                        int endIndex = start.IndexOf("\"");
                                        try
                                        {
                                            endName = start.Substring(0, endIndex).Replace("alt=", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Replace(">", string.Empty).Replace("\"", string.Empty).Replace("&amp;", "&").Replace("&quot;", "'").Replace("tracking=anetppl_sendmsg", string.Empty).Replace("tracking=anetppl_invite", string.Empty).Replace("\\u00e9", "é").Trim();
                                        }
                                        catch { }
                                        try
                                        {
                                            if (string.IsNullOrEmpty(endName))
                                            {
                                                endName = start.Substring(start.IndexOf("alt="), start.IndexOf("class=", start.IndexOf("alt=")) - start.IndexOf("alt=")).Replace("alt=", string.Empty).Replace("alt=", string.Empty).Replace("\"", string.Empty).Replace("&quot;", "'").Replace("tracking=anetppl_sendmsg", string.Empty).Replace("tracking=anetppl_invite", string.Empty).Replace("\\u00e9", "é").Trim();
                                            }

                                        }
                                        catch { }
                                    }
                                }
                                catch
                                {

                                }

                                //Deegree connection
                                try
                                {
                                    int startindex = GrpUser.IndexOf("<span class=\"degree-icon\">");
                                    if (startindex > 0)
                                    {
                                        DeegreeConn = string.Empty;
                                        string start = GrpUser.Substring(startindex);
                                        int endIndex = start.IndexOf("<sup>");
                                        DeegreeConn = start.Substring(0, endIndex).Replace("<span class=\"degree-icon\">", string.Empty);

                                        if (DeegreeConn == "1")
                                        {
                                            DeegreeConn = DeegreeConn + "st";
                                        }
                                        else if (DeegreeConn == "2")
                                        {
                                            DeegreeConn = DeegreeConn + "nd";
                                        }
                                        else if (DeegreeConn == "3")
                                        {
                                            DeegreeConn = DeegreeConn + "rd";
                                        }
                                    }
                                    else
                                    {
                                        startindex = GrpUser.IndexOf("span class=\"degree-icon group\">");
                                        DeegreeConn = string.Empty;

                                        if (startindex > 0)
                                        {
                                            DeegreeConn = string.Empty;
                                            string start = GrpUser.Substring(startindex);
                                            int endIndex = start.IndexOf("</span>");
                                            DeegreeConn = start.Substring(0, endIndex).Replace("span class=\"degree-icon group\">", string.Empty);

                                        }

                                        if (DeegreeConn == string.Empty)
                                        {

                                            DeegreeConn = "3rd";
                                        }
                                    }

                                }

                                catch { }

                                try
                                {
                                    int startindex2 = GrpUser.IndexOf("memberId=");
                                    if (startindex2 > 0)
                                    {
                                        endKey = string.Empty;
                                        string start1 = GrpUser.Substring(startindex2);
                                        int endIndex1 = start1.IndexOf("data-li-fullName=");
                                        endKey = start1.Substring(0, endIndex1).Replace("memberId=", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Trim();
                                    }
                                    else
                                    {
                                        endKey = string.Empty;
                                        int startindex3 = GrpUser.IndexOf("member-");
                                        string start1 = GrpUser.Substring(startindex3);
                                        int endIndex1 = start1.IndexOf(">");
                                        endKey = start1.Substring(0, endIndex1).Replace("member-", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Replace(">", string.Empty).Replace("\"", string.Empty).Trim();
                                    }
                                }
                                catch
                                {

                                }

                                try
                                {
                                    GroupSpecMem.Add(endKey, " [" + GroupName.Replace(",", string.Empty) + " ] " + endName + " (" + DeegreeConn.Replace(",", string.Empty) + ")");
                                    string item = UserID + "," + GroupName.Replace(",", string.Empty) + "," + endName + "," + DeegreeConn.Replace(",", string.Empty);
                                    AddingLinkedInDataToCSVFile1(item);
                                    if (WithGroupSearch == true)
                                    {
                                        Loggergrppmem("[ " + DateTime.Now + " ] => [ Added Group Member : " + endName + " (" + DeegreeConn + ") with Search keyword : " + SearchKeyword + " ]");
                                    }
                                    else
                                    {
                                        Loggergrppmem("[ " + DateTime.Now + " ] => [ Added Group Member : " + endName + " ]");
                                    }
                                }
                                catch { }
                            }
                            else
                            {

                            }
                        }
                        catch { }
                    }

                }
                return GroupSpecMem;
            }
            catch { }
            return GroupSpecMem;
        }
Esempio n. 3
0
        public void UpdateStatusUsingAllurl(ref GlobusHttpHelper HttpHelper, int mindelay, int maxdelay)
        {
            try
            {
                string csrfToken = string.Empty;
                string sourceAlias = string.Empty;
                string ImgCount = string.Empty;
                string LogoUrl = string.Empty;
                string mentioned = string.Empty;
                string EntityId = string.Empty;
                string contentTitle = string.Empty;
                string contentSummary = string.Empty;
                string progressId = string.Empty;

                string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));
                if (pageSource.Contains("csrfToken"))
                {
                    csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 100);
                    string[] Arr = csrfToken.Split('&');
                    csrfToken = Arr[0];
                    csrfToken = csrfToken.Replace("csrfToken=", "");
                    csrfToken = csrfToken.Replace("%3A", ":");
                }
                if (pageSource.Contains("sourceAlias"))
                {
                    sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100);
                    string[] ArrsourceAlias = sourceAlias.Split('"');
                    sourceAlias = ArrsourceAlias[2];
                }

                if (pageSource.Contains("X-Progress-ID"))
                {
                    progressId = pageSource.Substring(pageSource.IndexOf("X-Progress-ID"), 100);
                    string[] ArrsprogressId = progressId.Split('"');
                    progressId = ArrsprogressId[0].Replace("X-Progress-ID=", string.Empty).Replace("=",string.Empty);
                }
                string aaa = "lite/web-action-track?csrfToken=" + csrfToken +"";
                string post = HttpHelper.postFormData(new Uri("http://www.linkedin.com/"),aaa);

                string post1 = "X-Progress-ID=" + progressId + "&iframe_jsonp=true&window_post=true&post_window=parent&jsonp_callback=SlideshareUploader"+progressId;
                string pageSource1 = HttpHelper.postFormDataRef(new Uri("http://slideshare.www.linkedin.com/upload?"), post1, "http://www.linkedin.com/", csrfToken,"");
               // string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/nhome/uscp-poll?queryAfter=1387628141050&goback=%2Enmp_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&orderBy=Time&showHidden=false&realTimeTest=C"));
                try
                {
                    mentioned = "%5B%5D";
                }
                catch { }

                try
                {

                    string ReqUrl = Post;
                    //ReqUrl = ReqUrl.Replace(":", "%3A").Replace("//", "%2F%2F");
                   // string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/nhome/uscp-poll?queryAfter=1387606658969&goback=%2Enmp_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&orderBy=Time&showHidden=false&realTimeTest=C"));
                    csrfToken = csrfToken.Replace(":","%3A");
                    string postUrlData = " https://www.linkedin.com/lite/web-action-track?csrfToken=" + csrfToken;
                    string postData = "pkey=member-home&tcode=hp-shr-actvt-msg&plist=";
                    string ResponseStatusMsg1 = HttpHelper.postFormData(new Uri(postUrlData), postData);
                    string pageSource11 = "";
                    //string GetStatus = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/share?getPreview=&url=" + ReqUrl));
                    //string GetStatus = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/nhome/uscp-poll?queryAfter=1387606658969&goback=%2Enmp_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&orderBy=Time&showHidden=false&realTimeTest=C"));
                   /* try
                    {
                        int StartinImgCnt = GetStatus.IndexOf("current");
                        string startImgCnt = GetStatus.Substring(StartinImgCnt);
                        int EndIndexImgCnt = startImgCnt.IndexOf("</span>");
                        string EndImgCnt = startImgCnt.Substring(0, EndIndexImgCnt).Replace("value\":", "").Replace("\"", "");
                        ImgCount = EndImgCnt.Replace("current", string.Empty).Replace(">", string.Empty);
                    }
                    catch
                    {
                        ImgCount = "0";
                    }

                    try
                    {
                        int StartinImgUrl = GetStatus.IndexOf("url");
                        string startImgUrl = GetStatus.Substring(StartinImgUrl);
                        int EndIndexImgUrl = startImgUrl.IndexOf("\"");
                        string EndImgUrl = startImgUrl.Substring(0, EndIndexImgUrl).Replace("value\":", "").Replace("\"", "");
                        LogoUrl = EndImgUrl.Replace("url=", string.Empty).Trim();
                    }
                    catch
                    {
                        LogoUrl = "false";
                    }

                    try
                    {
                        int StartinEntityId = GetStatus.IndexOf("data-entity-id");
                        string startEntityId = GetStatus.Substring(StartinEntityId);
                        int EndIndexEntityId = startEntityId.IndexOf("data-entity-url");
                        string EndEntityId = startEntityId.Substring(0, EndIndexEntityId).Replace("value\":", "").Replace("\"", "");
                        EntityId = EndEntityId.Replace("\"", string.Empty).Replace("data-entity-id", string.Empty).Replace("=", string.Empty).Trim();
                    }
                    catch { }

                    try
                    {
                        int StartinContent = GetStatus.IndexOf("share-view-title");
                        string startContent = GetStatus.Substring(StartinContent);
                        int EndIndexContent = startContent.IndexOf("</h4>");
                        string EndContent = startContent.Substring(0, EndIndexContent).Replace("value\":", "").Replace("\"", "");
                        contentTitle = EndContent.Replace("\"", string.Empty).Replace("\n", string.Empty).Replace("share-view-title", string.Empty).Replace("id=", string.Empty).Replace(">", string.Empty).Replace("&", "and").Replace("amp;", string.Empty).Trim();

                        if (contentTitle.Contains("#"))
                        {
                            contentTitle = contentTitle.Replace("and", "&");
                            contentTitle = Uri.EscapeDataString(contentTitle);
                        }

                    }
                    catch { }

                    try
                    {
                        int StartinConSumm = GetStatus.IndexOf("share-view-summary\">");
                        string startConSumm = GetStatus.Substring(StartinConSumm);
                        int EndIndexConSumm = startConSumm.IndexOf("</span>");
                        string EndConSumm = startConSumm.Substring(0, EndIndexConSumm).Replace("value\":", "").Replace("\"", "");
                        contentSummary = EndConSumm.Replace("\"", string.Empty).Replace("\n", string.Empty).Replace("share-view-summary", string.Empty).Replace("id=", string.Empty).Replace(">", string.Empty).Replace("</span<a href=#", string.Empty).Trim();
                        contentSummary = contentSummary.Replace(",", "%2C").Replace(" ", "%20");

                        if (contentSummary.Contains("#"))
                        {
                            contentSummary = contentSummary.Replace("and", "&");
                            contentSummary = Uri.EscapeDataString(contentSummary);
                        }
                    }
                    catch { }
                    */
                    string PostStatusData = string.Empty;
                    if (EntityId == string.Empty)
                    {
                        //PostStatusData = "ajax=true&contentImageCount=0&contentImageIndex=-1&contentImage=&contentEntityID=&contentUrl=&postText=" + Uri.EscapeDataString(Post) + "&contentTitle=&contentSummary=&contentImageIncluded=true&%23=&postVisibility=EVERYONE&submitPost=&tetherAccountID=&tweetThisOn=false&postToMFeedDefaultPublic=true&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias + "";
                        PostStatusData="POST /lite/web-action-track?csrfToken=ajax%3A3714738396404051762";
                    }
                    else
                    {
                        PostStatusData = "ajax=true&contentImageCount=" + ImgCount + "&contentImageIndex=-1&contentImage=" + Uri.EscapeDataString(LogoUrl) + "&contentEntityID=" + EntityId + "&contentUrl=" + ReqUrl + "&mentions=" + mentioned + "&postText=" + Uri.EscapeDataString(Post) + "&share-entity-typeahead=&contentUrl=" + ReqUrl + "&contentImageIncluded=true&contentTitle=" + contentTitle + "&contentSummary=" + contentSummary + "&postVisibility2=EVERYONE&submitPost=&tetherAccountID=&tweetThisOn=false&postToMFeedDefaultPublic=true&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias + "";

                    }

                    //string ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/nhome/submit-post"), PostStatusData);
                    string ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/home?trk=nav_responsive_tab_home"), PostStatusData);

                    if (ResponseStatusMsg.Contains("Your update has been posted") || ResponseStatusMsg.Contains("success"))
                    {
                        Log("[ " + DateTime.Now + " ] => [ Url Status Updated With: " + accountUser + " ]");
                        Log("[ " + DateTime.Now + " ] => [ Url Status Posted: " + Post + " ]");
                        Log("[ " + DateTime.Now + " ] => [ Url Status: Updated Successfully. ]");
                        GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + Post, Globals.path_PostStatus);
                    }
                    else if (ResponseStatusMsg.Contains("You have exceeded the maximum length by 965 character(s)."))
                    {
                        Log("[ " + DateTime.Now + " ] => [ " + accountUser + " You have exceeded the maximum length by 965 character(s). ]");
                    }
                    else
                    {
                        Log("[ " + DateTime.Now + " ] => [ " + accountUser + " Url Status Not Posted ]");
                    }

                    int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                    Log("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                    Thread.Sleep(delay * 1000);
                }
                catch (Exception ex)
                {

                }

                finally
                {

                }
            }
            catch { }
        }
Esempio n. 4
0
        public void StartCreateGroup(ref GlobusHttpHelper HttpHelper, int mindelay, int maxdelay)
        {
            try
            {
                 string UploadInfo = string.Empty;
                string status = string.Empty;
                string TempID = string.Empty;
                string image = string.Empty;
                string PostCreateGroup = string.Empty;
                string ResponseStatusMsg = string.Empty;
                string urlForNewGroupCreated = string.Empty;
                Log("[ " + DateTime.Now + " ] => [ Group Creation In Account :" + accountUser + " ]");
                try
                {
                    string PageSource1 = string.Empty;
                      for (int i = 0; i <= 5;i++)
                      {
                          PageSource1 = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/createGroup?displayCreate=&trk=anet_creategrp"));
                          if (!string.IsNullOrEmpty(PageSource1))
                          {
                              break;
                          }
                          Thread.Sleep(2 * 1000);
                      }

                    if (PageSource1.Contains("Confirm Your Email Address:"))
                    {
                        //
                        GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.path_NotCreateGroup);
                        Log("[ " + DateTime.Now + " ] => [ Cannot Create Group , Confirm Your Email Address for Create group you must have at least one confirmed email address: " + accountUser + " ]");
                        return;
                    }

                    csrfToken = GetCsrfToken(PageSource1);
                    try
                    {
                        int StartIndex = PageSource1.IndexOf("name=\"upload_info\"");
                        string start = PageSource1.Substring(StartIndex).Replace("name=\"upload_info\"", "").Replace("type=\"hidden\"", "").Replace("value=\"", "");
                        int EndIndex = start.IndexOf("\"/>");
                        string end = start.Substring(0, EndIndex).Replace("value=\"", "").Replace(" ", "");
                        UploadInfo = end;
                    }
                    catch (Exception ex)
                    {

                    }

                    NameValueCollection nvc = new NameValueCollection();
                    nvc.Add("csrfToken", csrfToken);
                    nvc.Add("upload_info", UploadInfo);
                    nvc.Add("callback", "logo.processResponseLargeLogo");
                    nvc.Add("isCSMode", "false");
                    nvc.Add("_method", "PUT");

                    string[] array = Regex.Split(PostIamge, ".");
                    if (!string.IsNullOrEmpty(PostIamge))
                    {
                        Log("[ " + DateTime.Now + " ] => [ Uploading Logo ]");
                    }
                    image = array[array.Length - 1];
                    string result = HttpHelper.HttpUploadFileBackground("http://www.linkedin.com/mupld/upload", PostIamge, "file", "image/" + image, nvc, true, ref status);
                    if (result.Contains("{\"status\":\"ERROR\""))
                    {
                        Log("[ " + DateTime.Now + " ] => [ Error In Uploading Logo ! ]");
                        return;
                    }
                    try
                    {
                        int Startindex = result.IndexOf("value\":");
                        string start = result.Substring(Startindex);
                        int EndIndex = start.IndexOf("\",");
                        string End = start.Substring(0, EndIndex).Replace("value\":", "").Replace("\"", "");
                        TempID = End;
                    }
                    catch (Exception ex)
                    {

                    }
                    string CSVHeader = "UserName" + "," + "GroupName" + "," +"CreatedGroupUrl";
                    string GetRequest = HttpHelper.getHtmlfromUrl1(new Uri("http://media03.linkedin.com/media/" + TempID));
                    TempID = Uri.EscapeDataString(TempID.Replace("\\", ""));

                    if (SearchCriteria.CreateGroupStatus == "Member")
                    {
                        Log("[ " + DateTime.Now + " ] => [ Creating Member Group ]");
                        PostCreateGroup = "csrfToken=" + Uri.EscapeDataString(csrfToken) + "&acceptLogoTerms=acceptLogoTerms&groupName=" + PostGrpName + "&groupCategory=" + SearchCriteria.GroupType + "&otherGroupCategory=&shortDesc=" + PostGrpSummry + "&longDesc=" + PostGrpDesc + "&homeSite=" + PostGrpWebsite + "&groupEmail=" + Uri.EscapeDataString(accountUser) + "&groupInDirectory-open=groupInDirectory-open&logoInProfiles-open=logoInProfiles-open&membersSendInvites-open=membersSendInvites-open&access=request&groupInDirectory-request=groupInDirectory-request&logoInProfiles-request=logoInProfiles-request&emailDomains=&language=" + SearchCriteria.GroupLang + "&countryCode=&postalCode=&acceptContract=acceptContract&create=Create+a+Members-Only+Group&gid=&largeLogoTempID=" + TempID + "&discVisibility=false&tetherAccountID=&facebookTetherID=&uncroppedHeroImageID=&croppedHeroImageID=&heroImageCropParams=";
                        ResponseStatusMsg = HttpHelper.postFormDataRef(new Uri("http://www.linkedin.com/createGroup"), PostCreateGroup, "http://www.linkedin.com/createGroup", "", "");

                        Thread.Sleep(2000);

                        if (ResponseStatusMsg.Contains("Please choose a different group name.") || ResponseStatusMsg.Contains("Sorry this group name is not available. Please choose a different one."))
                        {
                            PostGrpName = PostGrpName + "New";
                            string CSV_Content = accountUser + "," + PostGrpName;
                            PostCreateGroup = "csrfToken=" + Uri.EscapeDataString(csrfToken) + "&acceptLogoTerms=acceptLogoTerms&groupName=" + PostGrpName + "&groupCategory=" + SearchCriteria.GroupType + "&otherGroupCategory=&shortDesc=" + PostGrpSummry + "&longDesc=" + PostGrpDesc + "&homeSite=" + PostGrpWebsite + "&groupEmail=" + Uri.EscapeDataString(accountUser) + "&groupInDirectory-open=groupInDirectory-open&logoInProfiles-open=logoInProfiles-open&membersSendInvites-open=membersSendInvites-open&access=request&groupInDirectory-request=groupInDirectory-request&logoInProfiles-request=logoInProfiles-request&emailDomains=&language=" + SearchCriteria.GroupLang + "&countryCode=&postalCode=&acceptContract=acceptContract&create=Create+a+Members-Only+Group&gid=&largeLogoTempID=" + TempID + "&discVisibility=false&tetherAccountID=&facebookTetherID=&uncroppedHeroImageID=&croppedHeroImageID=&heroImageCropParams=";
                            ResponseStatusMsg = HttpHelper.postFormDataRef(new Uri("http://www.linkedin.com/createGroup"), PostCreateGroup, "http://www.linkedin.com/createGroup", "", "");
                            Thread.Sleep(2000);
                            if (ResponseStatusMsg.Contains("Send Invitation"))
                            {
                                Log("[ " + DateTime.Now + " ] => [ New Member-Only-Group Create : " + PostGrpName + " Place of " + PostGrpName + " has Successfully Created on: " + accountUser + " ]");
                                CSV_Content = accountUser + "," + PostGrpName;
                                CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_CreateGroups);
                            }
                        }
                        else if (ResponseStatusMsg.Contains("Send Invitation"))
                        {

                            Log("[ " + DateTime.Now + " ] => [ Member-Only-Group: " + PostGrpName + " has Successfully Created on: " + accountUser + " has Successfully Created on: " + urlForNewGroupCreated + " ]");
                            string CSV_Content = accountUser + "," + PostGrpName + "," + urlForNewGroupCreated;
                            CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_CreateGroups);
                            urlForNewGroupCreated = string.Empty;
                        }
                        else if (ResponseStatusMsg.Contains("You must confirm your primary email address before creating a group."))
                        {
                            Log("[ " + DateTime.Now + " ] => [ User: "******"  must confirm his/her primary email address before creating a group. ]");
                            GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.path_NotCreatedGroups);
                            return;
                        }
                        else if (ResponseStatusMsg.Contains("Sorry you cannot create more groups on LinkedIn because you already own too many groups."))
                        {
                            Log("[ " + DateTime.Now + " ] => [ Sorry User: "******" cannot create more groups on LinkedIn because his/her already own too many groups. ]");
                            GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.path_NotCreatedGroups);
                            return;
                        }
                        else if (ResponseStatusMsg.Contains("You cannot create new groups because you've exceeded the maximum number of group memberships."))
                        {
                            Log("[ " + DateTime.Now + " ] => [ Sorry User: "******" You cannot create new groups because you've exceeded the maximum number of group memberships. ]");
                            GlobusFileHelper.AppendStringToTextfileNewLine("Sorry User: "******" You cannot create new groups because you've exceeded the maximum number of group memberships.", Globals.path_NotCreatedGroups);
                            return;
                        }
                        else if (ResponseStatusMsg.Contains("Please enter a valid URL."))
                        {
                            Log("[ " + DateTime.Now + " ] => [ Sorry User: "******" You cannot create new groups because your Web Site URL is not Valid. ]");
                            GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.path_NotCreatedGroups);
                            return;
                        }
                        else
                        {
                            Log("[ " + DateTime.Now + " ] => [ Group Not Created With Username >>> " + accountUser + " ]");
                            GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.path_NotCreatedGroups);
                        }
                    }
                    else if (SearchCriteria.CreateGroupStatus == "Open")
                    {
                        try
                        {
                            Log("[ " + DateTime.Now + " ] => [ Creating Open Group ]");
                            PostCreateGroup = "csrfToken=" + Uri.EscapeDataString(csrfToken) + "&acceptLogoTerms=acceptLogoTerms&groupName=" + PostGrpName + "&groupCategory=" + SearchCriteria.GroupType + "&otherGroupCategory=&shortDesc=" + PostGrpSummry + "&longDesc=" + PostGrpDesc + "&homeSite=" + PostGrpWebsite + "&groupEmail=" + Uri.EscapeDataString(accountUser) + "&access=open&groupInDirectory-open=groupInDirectory-open&logoInProfiles-open=logoInProfiles-open&membersSendInvites-open=membersSendInvites-open&groupInDirectory-request=groupInDirectory-request&logoInProfiles-request=logoInProfiles-request&emailDomains=&language=" + SearchCriteria.GroupLang + "&countryCode=&postalCode=&acceptContract=acceptContract&create=Create+an+Open+Group&gid=&largeLogoTempID=" + TempID + "&discVisibility=true&tetherAccountID=&facebookTetherID=&uncroppedHeroImageID=&croppedHeroImageID=&heroImageCropParams=";
                            ResponseStatusMsg = HttpHelper.postFormDataRef(new Uri("http://www.linkedin.com/createGroup"), PostCreateGroup, "http://www.linkedin.com/createGroup?displayCreate=&displayCreate=&trk=hb_side_crgrp", "", "");

                            if (ResponseStatusMsg.Contains("Please choose a different group name.") || ResponseStatusMsg.Contains("Sorry this group name is not available. Please choose a different one."))
                            {
                                //Log("[ " + DateTime.Now + " ] => [ No more unique data avaialble for creating groups -- Please insert data ]");
                                Log("[ " + DateTime.Now + " ] => [ No more unique data available for creating groups -- Please insert data ]");
                                return;
                                PostGrpName = PostGrpName + " New";
                                PostCreateGroup = "csrfToken=" + Uri.EscapeDataString(csrfToken) + "&acceptLogoTerms=acceptLogoTerms&groupName=" + PostGrpName + "&groupCategory=" + SearchCriteria.GroupType + "&otherGroupCategory=&shortDesc=" + PostGrpSummry + "&longDesc=" + PostGrpDesc + "&homeSite=" + PostGrpWebsite + "&groupEmail=" + Uri.EscapeDataString(accountUser) + "&access=open&groupInDirectory-open=groupInDirectory-open&logoInProfiles-open=logoInProfiles-open&membersSendInvites-open=membersSendInvites-open&groupInDirectory-request=groupInDirectory-request&logoInProfiles-request=logoInProfiles-request&emailDomains=&language=" + SearchCriteria.GroupLang + "&countryCode=&postalCode=&acceptContract=acceptContract&create=Create+an+Open+Group&gid=&largeLogoTempID=" + TempID + "&discVisibility=true&tetherAccountID=&facebookTetherID=&uncroppedHeroImageID=&croppedHeroImageID=&heroImageCropParams=";
                                ResponseStatusMsg = HttpHelper.postFormDataRef(new Uri("http://www.linkedin.com/createGroup"), PostCreateGroup, "http://www.linkedin.com/createGroup?displayCreate=&displayCreate=&trk=hb_side_crgrp", "", "");

                                Thread.Sleep(2000);

                                if (ResponseStatusMsg.Contains("Send Invitation"))
                                {
                                    Log("[ " + DateTime.Now + " ] => [ New Open-Group Create : " + PostGrpName + " Place of " + PostGrpName + " has Successfully Created on: " + accountUser + " ]");
                                    string CSV_Content = accountUser + "," + PostGrpName;
                                    CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_CreateGroups);
                                }
                                else
                                {
                                    Log("[ " + DateTime.Now + " ] => [ New Open-Group Not Created : " + PostGrpName + " Place of " + PostGrpName + " has Successfully Created on: " + accountUser + " ]");
                                }
                            }
                            else if (ResponseStatusMsg.Contains("Send Invitation"))
                            {
                                string End = string.Empty;
                                string[] arrForGid = Regex.Split(ResponseStatusMsg, "gid");
                                //arrForGid.Skip(1).ToArray();

                                foreach (string  item in arrForGid)
                                {
                                    if (!item.Contains("<!DOCTYPE html"))
                                    {
                                        int Startindex = item.IndexOf("=");
                                        string start = item.Substring(Startindex);
                                        int EndIndex = start.IndexOf("&");
                                        End = start.Substring(0, EndIndex).Replace("=", "").Replace("\"", "").Replace("&amp", "");
                                        break;
                                    }
                                }
                                urlForNewGroupCreated = "http://www.linkedin.com/groups?home=&gid=" + End;
                                Log("[ " + DateTime.Now + " ] => [ Open-Group: " + PostGrpName + " has  Successfully Created on: " + accountUser + " ]");
                                string CSV_Content = accountUser + "," + PostGrpName+ "," +urlForNewGroupCreated;
                                CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_CreateGroups);
                            }
                            else if (ResponseStatusMsg.Contains("You must confirm your primary email address before creating a group."))
                            {
                                Log("[ " + DateTime.Now + " ] => [ User: "******"  must confirm his/her primary email address before creating a group.  ]");
                                GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.path_NotCreatedGroups);
                                return;
                            }
                            else if (ResponseStatusMsg.Contains("Sorry you cannot create more groups on LinkedIn because you already own too many groups."))
                            {
                                Log("[ " + DateTime.Now + " ] => [ Sorry User: "******" cannot create more groups on LinkedIn because his/her already own too many groups. ]");
                                GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.path_NotCreatedGroups);
                            }
                            else if (ResponseStatusMsg.Contains("You cannot create new groups because you've exceeded the maximum number of group memberships."))
                            {
                                Log("[ " + DateTime.Now + " ] => [ Sorry User: "******" You cannot create new groups because you've exceeded the maximum number of group memberships. ]");
                                GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.path_NotCreatedGroups);
                                //return;
                            }
                            else if (ResponseStatusMsg.Contains("Please enter a valid URL."))
                            {
                                Log("[ " + DateTime.Now + " ] => [ Sorry User: "******" You cannot create new groups because your Web Site URL is not Valid. ]");
                                GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.path_NotCreatedGroups);
                                //return;
                            }
                            else if (ResponseStatusMsg.Contains("Sorry, but group management is currently unavailable. Please try again later"))
                            {
                                Log("[ " + DateTime.Now + " ] => [ Sorry User: "******" Sorry, but group management is currently unavailable. Please try again later. ]");
                                GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.path_NotCreatedGroups);
                                //return;
                            }
                            else
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.path_NotCreatedGroups);
                                Log("[ " + DateTime.Now + " ] => [ Group Not Created With Username >>> " + accountUser + " ]");
                            }
                        }
                        catch (Exception ex)
                        {

                        }
                    }

                    int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                    Log("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                    Thread.Sleep(delay * 1000);
                }
                catch (Exception ex)
                {
                }
                finally
                {
                }
            }
            catch
            {
            }
        }
Esempio n. 5
0
        public Dictionary<string, string> AddSpecificGroupUserWithExcelInput(ref GlobusHttpHelper HttpHelper, string UserID, string gid)
        {
            string endName = string.Empty;
            string DeegreeConn = string.Empty;
            string endKey = string.Empty;
            string Locality = string.Empty;
            string Val_sourceAlias = string.Empty;
            string Val_key = string.Empty;
            string Val_defaultText = string.Empty;
            string Name = string.Empty;
            string Val_CsrToken = string.Empty;
            string Val_Subject = string.Empty;
            string Val_greeting = string.Empty;
            string Val_AuthToken = string.Empty;
            string Val_AuthType = string.Empty;
            string val_trk = string.Empty;
            string Val_lastName = string.Empty;
            string html = string.Empty;
            string Title = string.Empty;

            #region Data Initialization
            string csrfToken = string.Empty;
            string pageSource = string.Empty;
            string[] RgxSikValue = new string[] { };
            string[] RgxPageNo = new string[] { };
            string sikvalue = string.Empty;
            int counter = 0;
            #endregion

            try
            {
                GroupSpecMem.Clear();
                string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));

                if (pageSource1.Contains("csrfToken"))
                {
                    csrfToken = pageSource1.Substring(pageSource1.IndexOf("csrfToken"), 50);
                    string[] Arr = csrfToken.Split('>');
                    csrfToken = Arr[0];
                    csrfToken = csrfToken.Replace(":", "%3A").Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty).Replace("\n", string.Empty).Replace(">", string.Empty).Replace("<script src", string.Empty);
                    csrfToken = csrfToken.Trim();
                }

                    string[] RgxGroupData = new string[] { };

                    foreach (string[] itemArr in msgGroupMem_excelData)
                    {
                        try
                        {
                            pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/groups?viewMembers=&gid=" + gid));
                        }
                        catch { }

                        string group = string.Empty;
                        string mem = string.Empty;

                        try
                        {
                            group = itemArr[0].ToString();
                            mem = itemArr[1].ToString();
                            endKey = itemArr[1].ToString();
                        }
                        catch { }

                        if (!string.IsNullOrEmpty(group) || !string.IsNullOrEmpty(mem))
                        {

                            try
                            {
                                RgxSikValue = System.Text.RegularExpressions.Regex.Split(pageSource, "sik");
                            }
                            catch { }

                            try
                            {
                                sikvalue = RgxSikValue[1].Split('&')[0].Replace("=", string.Empty);
                            }
                            catch { }

                            try
                            {
                                if (NumberHelper.ValidateNumber(sikvalue))
                                {
                                    sikvalue = sikvalue.Split('\"')[0];
                                }
                                else
                                {
                                    sikvalue = sikvalue.Split('\"')[0];
                                }
                            }
                            catch
                            {
                                sikvalue = sikvalue.Split('\"')[0];
                            }

                            string postdata = "csrfToken=" + csrfToken + "&searchField=" + Uri.EscapeDataString(mem) + "&searchMembers=submit&searchMembers=Search&gid=" + gid + "&goback=.gna_" + gid + "";

                            #region Commented old code
                            try
                            {
                                pageSource = HttpHelper.postFormDataRef(new Uri("http://www.linkedin.com/groups"), postdata, "http://www.linkedin.com/groups?viewMembers=&gid=" + gid + "&sik=" + sikvalue + "&split_page=1&goback=%2Egna_" + gid + "", "", "");
                            }
                            catch { }

                            if (pageSource.Contains("Sorry, we found 0 members matching your search."))
                            {
                                Loggergrppmem("[ " + DateTime.Now + " ] => [ Sorry, we found 0 members matching your search : " + mem + " ]");
                                continue;
                            }

                            if (counter > 1)
                            {
                                RgxSikValue = System.Text.RegularExpressions.Regex.Split(pageSource, "sik");
                                try
                                {
                                    sikvalue = RgxSikValue[1].Split('&')[0].Replace("=", string.Empty);
                                }
                                catch { }

                                try
                                {
                                    if (NumberHelper.ValidateNumber(sikvalue))
                                    {
                                        sikvalue = sikvalue.Split('\"')[0];
                                    }
                                    else
                                    {
                                        sikvalue = sikvalue.Split('\"')[0];
                                    }
                                }
                                catch
                                {
                                    sikvalue = sikvalue.Split('\"')[0];
                                }

                                string getdata = "http://www.linkedin.com/groups?viewMembers=&gid=" + gid + "&sik=" + sikvalue + "&split_page=1&goback=%2Egna_" + gid + "";

                                try
                                {
                                    pageSource = HttpHelper.getHtmlfromUrl(new Uri(getdata));
                                }
                                catch { }
                            }

                            try
                            {
                                RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"member\" id=\"");
                            }
                            catch { }
                            #endregion

                            string Url = endKey;
                            //var GrpUser = HttpHelper.getHtmlfromUrl(new Uri(Url));
                            foreach (var GrpUser in RgxGroupData)
                            {
                                try
                                {
                                    if (GrpUser.Contains("member"))
                                    {
                                        if (GrpUser.Contains("title=\"YOU") || GrpUser.Contains("<!DOCTYPE html>"))
                                        {
                                            if (GrpUser.Contains("title=\"YOU"))
                                            {

                                            }
                                            continue;
                                        }

                                        try
                                        {
                                            #region Name
                                            try
                                            {
                                                try
                                                {
                                                    endName = GrpUser.Substring(GrpUser.IndexOf("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\""), (GrpUser.IndexOf("i18n__expand_your_network_to_see_more", GrpUser.IndexOf("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\"")) - GrpUser.IndexOf("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\""))).Replace("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\"", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim();
                                                }
                                                catch
                                                {
                                                    try
                                                    {
                                                        endName = GrpUser.Substring(GrpUser.IndexOf("fmt__full_name\":"), (GrpUser.IndexOf(",", GrpUser.IndexOf("fmt__full_name\":")) - GrpUser.IndexOf("fmt__full_name\":"))).Replace("fmt__full_name\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim();

                                                    }
                                                    catch { }
                                                }

                                                if (string.IsNullOrEmpty(endName))
                                                {
                                                    try
                                                    {
                                                        //endName = Utils.getBetween(GrpUser, "<span class=\"full-name\">", "</span>");
                                                        endName = GrpUser.Substring(GrpUser.IndexOf("<span class=\"full-name\">"), (GrpUser.IndexOf("</span><span></span></span></h1></div></div><div id=\"headline-container\" data-li-template=\"headline\">", GrpUser.IndexOf("</span><span></span></span></h1></div></div><div id=\"headline-container\" data-li-template=\"headline\">")) - GrpUser.IndexOf("<span class=\"full-name\">"))).Replace("<span class=\"full-name\">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim();
                                                    }
                                                    catch
                                                    { }
                                                }

                                                if (string.IsNullOrEmpty(endName))
                                                {
                                                    try
                                                    {
                                                        //endName = Utils.getBetween(GrpUser, "<span class=\"full-name\">", "</span>");
                                                        endName = GrpUser.Substring(GrpUser.IndexOf("data-li-fullName="), (GrpUser.IndexOf(">Send message</a>", GrpUser.IndexOf(">Send message</a>")) - GrpUser.IndexOf("data-li-fullName="))).Replace("data-li-fullName=", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("\n", string.Empty).Trim();
                                                    }
                                                    catch
                                                    { }
                                                }
                                                //anetppl_profile">Christian A. Kenyeres</a>
                                            }
                                            catch { }

                                            #endregion
                                        }
                                        catch
                                        {

                                        }

                                        //Deegree connection
                                        try
                                        {
                                            int startindex = GrpUser.IndexOf("class=\"degree-icon");
                                            if (startindex > 0)
                                            {
                                                DeegreeConn = string.Empty;
                                                string start = GrpUser.Substring(startindex);
                                                int endIndex = start.IndexOf("<sup>");
                                                DeegreeConn = start.Substring(0, endIndex).Replace("\n",string.Empty).Replace("class=\"degree-icon", string.Empty).Replace("\"",string.Empty).Replace(">",string.Empty).Trim().ToString();

                                                if (DeegreeConn == "1")
                                                {
                                                    DeegreeConn = DeegreeConn + "st";
                                                }
                                                else if (DeegreeConn == "2")
                                                {
                                                    DeegreeConn = DeegreeConn + "nd";
                                                }
                                                else if (DeegreeConn == "3")
                                                {
                                                    DeegreeConn = DeegreeConn + "rd";
                                                }
                                                else if (DeegreeConn == "")
                                                {
                                                    DeegreeConn = "3rd";
                                                }
                                            }
                                            else
                                            {
                                                startindex = GrpUser.IndexOf("class=\"degree-icon group\">");
                                                DeegreeConn = string.Empty;

                                                if (startindex > 0)
                                                {
                                                    DeegreeConn = string.Empty;
                                                    string start = GrpUser.Substring(startindex);
                                                    int endIndex = start.IndexOf("</span>");
                                                    DeegreeConn = start.Substring(0, endIndex).Replace("span class=\"degree-icon group\">", string.Empty);

                                                }
                                                else
                                                {
                                                    DeegreeConn = "3rd";
                                                }

                                            }

                                        }

                                        catch { }

                                        try
                                        {
                                            //endKey = Utils.getBetween(GrpUser, "view?id=", "&").Replace("view?id=", "");
                                            int startindex2 = GrpUser.IndexOf("memberId=");
                                            if (startindex2 > 0)
                                            {
                                                endKey = string.Empty;
                                                string start1 = GrpUser.Substring(startindex2);
                                                int endIndex1 = start1.IndexOf("data-li-fullName=");
                                                endKey = start1.Substring(0, endIndex1).Replace("memberId=", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Trim();
                                            }
                                            else
                                            {
                                                endKey = string.Empty;
                                                int startindex3 = GrpUser.IndexOf("member-");
                                                string start1 = GrpUser.Substring(startindex3);
                                                int endIndex1 = start1.IndexOf(">");
                                                endKey = start1.Substring(0, endIndex1).Replace("member-", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Replace(">", string.Empty).Replace("\"", string.Empty).Trim();
                                            }
                                        }
                                        catch
                                        {

                                        }

                                        try
                                        {
                                            string endNamedisp = endName;
                                            endName = Uri.EscapeDataString(endName);
                                            GroupSpecMem.Add(endKey, endNamedisp + " (" + DeegreeConn + ")");

                                            if (WithGroupSearch == true)
                                            {
                                                Loggergrppmem("[ " + DateTime.Now + " ] => [ Added Group Member : " + endNamedisp + " (" + DeegreeConn + ") with Search keyword : " + SearchKeyword + " ]");
                                            }
                                            else
                                            {
                                                Loggergrppmem("[ " + DateTime.Now + " ] => [ Added Group Member : " + endNamedisp + " ]");
                                            }
                                            endKey = "";
                                            endName = "";
                                        }
                                        catch { }
                                    }
                                    else
                                    {

                                    }
                                }
                                catch { }
                            }
                        }
                    }

                return GroupSpecMem;
            }
            catch { }
            return GroupSpecMem;
        }
Esempio n. 6
0
        public void LoginHttpHelper_Checker(ref GlobusHttpHelper HttpHelper)
        {
            try
            {
                this.HttpHelper = HttpHelper;

                //Log("[ " + DateTime.Now + " ] => [ Logging In With Account : " + SearchCriteria.LoginID + " ]");
                Log("[ " + DateTime.Now + " ] => [ Logging In With Account : " + accountUser + " ]");
                Log("[ " + DateTime.Now + " ] => [ Login Process is Running... ]");
                Url = "https://www.linkedin.com/";
                string pageSrcLogin = string.Empty;
                int ProxyPort = 0;
                if (!string.IsNullOrEmpty(proxyPort) && NumberHelper.ValidateNumber(proxyPort))
                {
                    ProxyPort = int.Parse(proxyPort);
                }
                pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, ProxyPort, proxyUserName, proxyPassword);

                string postdata = string.Empty;
                string postUrl = string.Empty;
                string ResLogin = string.Empty;
                string csrfToken = string.Empty;
                string regCsrfParam = string.Empty;
                string sourceAlias = string.Empty;

                if (pageSrcLogin.Contains("csrfToken"))
                {
                    try
                    {
                        int startIndex = pageSrcLogin.IndexOf("name=\"csrfToken\"");
                        string start = pageSrcLogin.Substring(startIndex).Replace("name=\"csrfToken\"", "");
                        int endIndex = start.IndexOf("\" ");
                        string end = start.Substring(0, endIndex).Replace("value=\"", "").Trim();
                        csrfToken = end;
                        //csrfToken = csrfToken;
                    }
                    catch (Exception ex)
                    {

                    }

                }

                try
                {
                    if (csrfToken.Contains("&"))
                    {
                        string[] Arr = csrfToken.Split('&');
                        csrfToken = Arr[0].Replace("\"", string.Empty);

                    }

                }
                catch { }

                if (pageSrcLogin.Contains("sourceAlias"))
                {
                    sourceAlias = pageSrcLogin.Substring(pageSrcLogin.IndexOf("sourceAlias"), 100);
                    string[] Arr = sourceAlias.Split('"');
                    sourceAlias = Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty).Trim();
                }

                try
                {
                    int SourceAliasStart = pageSrcLogin.IndexOf("regCsrfParam");
                    if (SourceAliasStart > 0)
                    {
                        try
                        {

                            regCsrfParam = pageSrcLogin.Substring(pageSrcLogin.IndexOf("regCsrfParam"), 100);
                            string[] Arr = regCsrfParam.Split('"');
                            regCsrfParam = Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty);
                        }
                        catch
                        {
                        }
                    }

                }
                catch { }

                postUrl = "https://www.linkedin.com/uas/login-submit";
                postdata = "isJsEnabled=true&source_app=&tryCount=&session_key=" + Uri.EscapeDataString(accountUser) + "&session_password="******"&signin=Sign%20In&session_redirect=&loginCsrfParam=" + regCsrfParam + "&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;

                try
                {
                    ResLogin = HttpHelper.postFormDataProxy(new Uri(postUrl), postdata, proxyAddress, ProxyPort, proxyUserName, proxyPassword);//HttpHelper.postFormDataRef(new Uri(postUrl), postdata, "http://www.linkedin.com/uas/login?goback=&trk=hb_signin", "", "");
                }
                catch { }

                //if (GroupStatus.GrouppageSourcewithProxy == string.Empty)
                //{
                //    GroupStatus.GrouppageSourcewithProxy = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/grp/"));
                //}

                string ImageUrl = string.Empty;
                string captchaText = string.Empty;
                string captchachallengeid = string.Empty;
                string dts = string.Empty;
                string origActionAlias = string.Empty;
                string origSourceAlias = string.Empty;
                string irhf = string.Empty;
                string submissionID = string.Empty;
                string CAPTCHAfwdcsrftoken = string.Empty;
                string CAPTCHAfwdsignin = string.Empty;
                string CAPTCHAfwdsession_password = string.Empty;
                string CAPTCHAfwdsession_key = string.Empty;
                string CAPTCHAfwdisJsEnabled = string.Empty;
                string CAPTCHAfwdloginCsrfParam = string.Empty;

                if (ResLogin.Contains("Security Verification"))
                {
                    string dataforcapctha = HttpHelper.getHtmlfromUrl1(new Uri("https://www.google.com/recaptcha/api/noscript?k=6LcnacMSAAAAADoIuYvLUHSNLXdgUcq-jjqjBo5n"));
                    if (!string.IsNullOrEmpty(dataforcapctha))
                    {
                        int startindex = dataforcapctha.IndexOf("id=\"recaptcha_challenge_field\"");
                        if (startindex > 0)
                        {
                            string start = dataforcapctha.Substring(startindex).Replace("id=\"recaptcha_challenge_field\"", "");
                            int endindex = start.IndexOf("\">");
                            string end = start.Substring(0, endindex).Replace("value=", string.Empty).Replace("\"", string.Empty).Trim();
                            ImageUrl = "https://www.google.com/recaptcha/api/image?c=" + end;
                            System.Net.WebClient webclient = new System.Net.WebClient();
                            byte[] args = webclient.DownloadData(ImageUrl);
                            string[] arr1 = new string[] { Globals.CapchaLoginID, Globals.CapchaLoginPassword, "" };
                            captchaText = DecodeDBC(arr1, args);
                        }

                        if (ResLogin.Contains("name=\"security-challenge-id\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"security-challenge-id\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"security-challenge-id\"", "").Replace("value=\"", "");
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                captchachallengeid = end.Replace("\"", string.Empty).Trim();
                            }
                        }

                        if (ResLogin.Contains("name=\"dts\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"dts\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"dts\"", "").Replace("value=\"", "");
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                dts = end.Replace("\"", string.Empty).Trim();
                            }
                        }

                        if (ResLogin.Contains("name=\"origActionAlias\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"origActionAlias\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"origActionAlias\"", "").Replace("value=\"", "");
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                origActionAlias = end.Replace("\"", string.Empty).Trim();
                            }
                        }

                        if (ResLogin.Contains("name=\"submissionId\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"submissionId\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"submissionId\"", string.Empty).Replace("value=\"", string.Empty);
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                submissionID = end.Replace("\"", string.Empty).Trim();
                            }
                        }
                        if (ResLogin.Contains("name=\"CAPTCHA-fwd-csrfToken\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"CAPTCHA-fwd-csrfToken\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"CAPTCHA-fwd-csrfToken\"", string.Empty).Replace("value=\"", string.Empty);
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                CAPTCHAfwdcsrftoken = end.Replace("\"", string.Empty).Trim();
                            }
                        }
                        if (ResLogin.Contains("name=\"CAPTCHA-fwd-signin\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"CAPTCHA-fwd-signin\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"CAPTCHA-fwd-signin\"", string.Empty).Replace("value=\"", string.Empty);
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                CAPTCHAfwdsignin = end.Replace("\"", string.Empty).Trim();
                            }
                        }
                        if (ResLogin.Contains("name=\"CAPTCHA-fwd-session_password\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"CAPTCHA-fwd-session_password\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"CAPTCHA-fwd-session_password\"", string.Empty).Replace("value=\"", string.Empty);
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                CAPTCHAfwdsession_password = end.Replace("\"", string.Empty).Trim();
                            }
                        }
                        if (ResLogin.Contains("name=\"CAPTCHA-fwd-session_key\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"CAPTCHA-fwd-session_key\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"CAPTCHA-fwd-session_key\"", string.Empty).Replace("value=\"", string.Empty);
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                CAPTCHAfwdsession_key = end.Replace("\"", string.Empty).Trim();
                            }
                        }
                        if (ResLogin.Contains("name=\"CAPTCHA-fwd-isJsEnabled\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"CAPTCHA-fwd-isJsEnabled\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"CAPTCHA-fwd-isJsEnabled\"", string.Empty).Replace("value=\"", string.Empty);
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                CAPTCHAfwdisJsEnabled = end.Replace("\"", string.Empty).Trim();
                            }
                        }
                        if (ResLogin.Contains("name=\"CAPTCHA-fwd-loginCsrfParam\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"CAPTCHA-fwd-loginCsrfParam\"");
                            if (startindexnew > 0) ;
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"CAPTCHA-fwd-loginCsrfParam\"", string.Empty).Replace("value=\"", string.Empty);
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                CAPTCHAfwdloginCsrfParam = end.Replace("\"", string.Empty).Trim();
                            }
                        }

                        if (ResLogin.Contains("name=\"origSourceAlias\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"origSourceAlias\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"origSourceAlias\"", "").Replace("value=\"", "");
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                origSourceAlias = end.Replace("\"", string.Empty).Trim();
                            }
                        }

                        if (ResLogin.Contains("name=\"irhf\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"irhf\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"irhf\"", "").Replace("value=\"", "");
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                irhf = end.Replace("\"", string.Empty).Trim();
                            }
                        }

                        if (!string.IsNullOrEmpty(ImageUrl) && !string.IsNullOrEmpty(captchaText))
                        {
                            postdata = "recaptcha_challenge_field=" + ImageUrl.Replace("https://www.google.com/recaptcha/api/image?c=", string.Empty) + "&recaptcha_response_field=" + captchaText.Replace(" ", "+") + "&irhf=" + irhf + "&dts=" + dts + "&security-challenge-id=" + captchachallengeid + "&submissionId=" + submissionID + "&CAPTCHA-fwd-csrfToken=" + CAPTCHAfwdcsrftoken + "&CAPTCHA-fwd-isJsEnabled=" + CAPTCHAfwdisJsEnabled + "&CAPTCHA-fwd-signin=" + CAPTCHAfwdsignin + "&CAPTCHA-fwd-loginCsrfParam=" + CAPTCHAfwdloginCsrfParam + "&CAPTCHA-fwd-session_password="******"&CAPTCHAfwd-session_key=" + CAPTCHAfwdsession_key + "&session_password="******"&session_key=" + Uri.EscapeDataString(accountUser) + "&origSourceAlias=" + origSourceAlias + "&origActionAlias=" + origActionAlias + "&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;
                            postdata = postdata.Replace(" ", string.Empty);
                            ResLogin = HttpHelper.postFormDataRef(new Uri("https://www.linkedin.com/uas/captcha-submit"), postdata, "https://www.linkedin.com/uas/login-submit", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);
                        }
                        else
                        {
                            ResLogin = string.Empty;
                        }

                        if (ResLogin.Contains("The text you entered does not match the characters in the security image. Please try again with this new image") || string.IsNullOrEmpty(ResLogin))
                        {
                            Log("[ " + DateTime.Now + " ] => [ " + accountUser + "  Cannot Login because of Capctcha ]");
                            GlobusFileHelper.WriteStringToTextfile(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.pathCapcthaLogin);
                            SearchCriteria.loginREsponce = string.Empty;
                            //FrmScrapGroupMember.ChangeToNextAccount = true;
                        }
                    }
                }

                string CheckedAccount = accountUser + ":" + accountPass;

                if (ResLogin.Contains("Sign Out") || ResLogin.Contains("class=\"signout\"") || ResLogin.Contains("Cerrar sesión"))
                {
                    IsLoggedIn = true;
                    Log("[ " + DateTime.Now + " ] => [ Logged In With Account : " + accountUser + " ]");
                    GlobusFileHelper.AppendStringToTextfileNewLine(CheckedAccount, Globals.Path_WorkingAccount_AccountChecker);
                }
                else if (ResLogin.Contains("logout?session_full_logout"))
                {
                    SearchCriteria.loginREsponce = string.Empty;
                    IsLoggedIn = true;
                    string Search = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/search?trk=advsrch"));
                    SearchCriteria.loginREsponce = Search;
                }
                else if (ResLogin.Contains("Sign-In Verification"))
                {
                    Log("[ " + DateTime.Now + " ] => [ Verification required : " + accountUser + " ]");
                }
                else if (ResLogin.Contains("Your LinkedIn account has been temporarily restricted"))
                {
                    Log("[ " + DateTime.Now + " ] => [ Your LinkedIn account : " + accountUser + " has been temporarily restricted ]");
                    //FrmScrapGroupMember.ChangeToNextAccount = true;
                }
                else
                {
                    Log("[ " + DateTime.Now + " ] => [ NotLogged In With Account : " + accountUser + " ]");
                    //FrmScrapGroupMember.ChangeToNextAccount = true;
                    GlobusFileHelper.AppendStringToTextfileNewLine(CheckedAccount, Globals.Path_NonWorkingAccount_AccountChecker);
                }

            }
            catch (Exception ex)
            {
            }
        }
Esempio n. 7
0
        public void PostFinalMsg(ref GlobusHttpHelper HttpHelper, Dictionary<string, string> SlectedContacts,string userText, List<string> GrpMemSubjectlist, string msg, string body, string UserEmail, string FromemailId, string FromEmailNam, bool msg_spintaxt, int mindelay, int maxdelay, bool preventMsgSameUser, bool preventMsgGlobalUser)
        {
            ComposeMsgDbManager objComposeMsgDbMgr = new ComposeMsgDbManager();

             try
             {
                 string postdata = string.Empty;
                 string postUrl = string.Empty;

                 string ResLogin = string.Empty;
                 string csrfToken = string.Empty;
                 string sourceAlias = string.Empty;

                 string ReturnString = string.Empty;
                 string PostMsgSubject = string.Empty;
                 string PostMsgBody = string.Empty;
                 string FString = string.Empty;
                 string Nstring = string.Empty;
                 string connId = string.Empty;
                 string FullName = string.Empty;
                 string ToMsg = string.Empty;
                 string ToCd = string.Empty;

                 try
                 {
                     DataSet ds_bList = new DataSet();
                     DataSet ds = new DataSet();
                     string MessageText = string.Empty;
                     string PostedMessage = string.Empty;

                     string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));
                     if (pageSource.Contains("csrfToken"))
                     {
                         csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 50);
                         string[] Arr = csrfToken.Split('<');
                         csrfToken = Arr[0];
                         csrfToken = csrfToken.Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty).Replace("\n", string.Empty).Replace(">", string.Empty).Replace("<script typ", string.Empty);
                         csrfToken = csrfToken.Trim();
                     }

                     if (pageSource.Contains("sourceAlias"))
                     {
                         sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100);
                         string[] Arr = sourceAlias.Split('"');
                         sourceAlias = Arr[2];
                     }

                     if (IsAllAccounts)
                     {
                         try
                         {
                             ClsLinkedinMain obj_ClsLinkedinMain = new ClsLinkedinMain();

                             Dictionary<string, string> dTotalFriends = obj_ClsLinkedinMain.PostAddMembers(ref HttpHelper, UserEmail);

                             Log("[ " + DateTime.Now + " ] => [ No. Of Friends = " + dTotalFriends.Count + " With Username >>> " + UserEmail + " ]");

                             if (dTotalFriends.Count > 0)
                             {

                                 PostMessageToAllAccounts(ref HttpHelper,SlectedContacts, dTotalFriends, msg, body, UserEmail, FromemailId, FromEmailNam, mindelay, mindelay);

                                 int count = SlectedContacts2.Count();

                                 if (count > 0)
                                 {
                                     do
                                     {

                                         PostMessageToAllAccounts(ref HttpHelper, SlectedContacts2, dTotalFriends, msg, body, UserEmail, FromemailId, FromEmailNam, mindelay, mindelay);
                                         count = SlectedContacts2.Count();

                                     } while (count > 0);
                                 }
                             }
                             Log("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED With Username >>> " + UserEmail + " ]");
                             Log("-----------------------------------------------------------------------------------------------------------------------------------");

                             return;
                         }
                         catch (Exception ex)
                         {
                         }
                     }

                             string ContactName = string.Empty;
                             int counter = 1;
                             Dictionary<string, string> SlectedSentContacts = new Dictionary<string, string>();
                             Nstring = string.Empty;
                             ContactName = string.Empty;
                             string ProfileUrl = string.Empty;
                             string ProfileID = string.Empty;
                             foreach (KeyValuePair<string, string> itemChecked in SlectedContacts)
                             {
                                 if (Globals.groupStatusString == "API")
                                 {
                                     ProfileUrl = "https://www.linkedin.com/contacts/view?id=" + itemChecked.Key + "";
                                     string profilePageSource = HttpHelper.getHtmlfromUrl1(new Uri(ProfileUrl));
                                     ProfileID = Utils.getBetween(profilePageSource, "id=", ",").Replace("\"", "");
                                 }
                                 else
                                 {
                                     ProfileUrl = "https://www.linkedin.com/profile/view?id=" + itemChecked.Key + "";

                                     ProfileID = itemChecked.Key;
                                 }

                                 if (counter < 50)
                                 {
                                     SlectedSentContacts.Add(itemChecked.Key, itemChecked.Value);

                                     try
                                     {
                                         string Querystring = "Select ProfileID From tb_BlackListAccount Where ProfileID ='" + ProfileID+ "'";
                                         //string Querystring = "Select ProfileID From tb_BlackListAccount Where ProfileID ='" + itemChecked.Key +"'";
                                         ds_bList = DataBaseHandler.SelectQuery(Querystring, "tb_BlackListAccount");
                                     }
                                     catch { }

                                     if (ds_bList.Tables.Count > 0 && ds_bList.Tables[0].Rows.Count > 0)
                                     {
                                         Log("[ " + DateTime.Now + " ] => [ User: "******":", string.Empty).Trim() + " is Added BlackListed List For Send Messages Pls Check ]");

                                     }
                                     else
                                     {

                                         try
                                         {

                                             string FName = string.Empty;
                                             string Lname = string.Empty;

                                             try
                                             {
                                                 FName = itemChecked.Value.Split(' ')[0];
                                                 Lname = itemChecked.Value.Split(' ')[1];
                                             }
                                             catch { }

                                             FullName = FName + " " + Lname;
                                             try
                                             {
                                                 //ContactName = ContactName + "  :  " + FullName;
                                                 ContactName = "  :  " + FullName;
                                             }
                                             catch { }

                                             if (ToMsg == string.Empty)
                                             {
                                                 //ToMsg += FullName;
                                                 ToMsg = FullName;
                                             }
                                             else
                                             {
                                                 //ToMsg += ";" + FullName;
                                                 ToMsg = ";" + FullName;
                                             }

                                             Log("[ " + DateTime.Now + " ] => [ Adding Contact " + FullName + " ]");

                                             //ToCd = itemChecked.Key;  //for client sudi
                                             ToCd = ProfileID;
                                             List<string> AddAllString = new List<string>();

                                             if (FString == string.Empty)
                                             {
                                                 string CompString = "{" + "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}";
                                                 FString = CompString;
                                             }
                                             else
                                             {
                                                 string CompString = "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}";
                                                 FString = CompString;
                                             }

                                             if (Nstring == string.Empty)
                                             {
                                                 Nstring = FString;
                                                 connId = ToCd;
                                             }
                                             else
                                             {
                                                 //Nstring += "," + FString;
                                                 Nstring = FString;
                                                 connId = ToCd;
                                                 //connId += " " + ToCd;
                                             }

                                         }
                                         catch { }
                                         //Nstring += "}";
                                     }

                                 }
                                 else
                                 {
                                     try
                                     {
                                         SlectedContacts1.Add(itemChecked.Key, itemChecked.Value);
                                     }
                                     catch
                                     {

                                     }
                                 }
                                 counter++;

                                 //}

                                 if (SlectedContacts1.Count != 0)
                                 {
                                     foreach (KeyValuePair<string, string> itemremove in SlectedSentContacts)
                                     {
                                         SlectedContacts1.Remove(itemremove.Key);
                                     }
                                 }

                                 if (msg_spintaxt == true)
                                 {
                                     try
                                     {
                                         body = GlobusSpinHelper.spinLargeText(new Random(), userText);
                                         msg = GrpMemSubjectlist[RandomNumberGenerator.GenerateRandom(0, GrpMemSubjectlist.Count - 1)];
                                     }
                                     catch
                                     {
                                     }

                                     body = body.Replace("<Insert Name>", FullName);
                                     body = body.Replace("<Insert From Email>", FromEmailNam);

                                 }

                                 if (preventMsgSameUser)
                                 {
                                     try
                                     {
                                         string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgSubject,MsgBody From tb_ManageComposeMsg Where MsgFrom ='" + UserEmail + "' and MsgBody = '" + body + "' and MsgToId = " + connId + "";
                                         ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageComposeMsg");
                                     }
                                     catch { }
                                 }

                                 if (preventMsgGlobalUser)
                                 {
                                     try
                                     {
                                         string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgSubject,MsgBody From tb_ManageComposeMsg Where MsgToId = " + connId + "";
                                         ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageComposeMsg");
                                     }
                                     catch { }
                                 }

                                 try
                                 {
                                     string PostMessage = string.Empty;
                                     string ResponseStatusMsg = string.Empty;

                                     Log("[ " + DateTime.Now + " ] => [ Message Sending Process Running.. ]");

                                     if (ds.Tables.Count > 0)
                                     {
                                         if (ds.Tables[0].Rows.Count > 0)
                                         {

                                             PostMessage = "";
                                             ResponseStatusMsg = "Already Sent";

                                         }
                                         else
                                         {

                                             PostMessage = "senderEmail=" + FromemailId.Trim() + "&ccInput=&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(body.ToString()) + "&isReply=&isForward=&itemId=&recipients=" + Uri.EscapeUriString(connId) + "&recipientNames=" + Uri.EscapeUriString(Nstring) + "&groupId=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias + "&submit=Send+Message";
                                             //ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/inbox/mailbox/message/send"), PostMessage);

                                             ResponseStatusMsg = HttpHelper.postFormDataRef(new Uri("http://www.linkedin.com/inbox/mailbox/message/send"), PostMessage, "https://www.linkedin.com/inbox/", "", "", "XMLHttpRequest", "https://www.linkedin.com","1");   //ahmed sudi client changes
                                         }
                                     }
                                     else
                                     {

                                         PostMessage = "senderEmail=" + FromemailId.Trim() + "&ccInput=&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(body.ToString()) + "&isReply=&isForward=&itemId=&recipients=" + Uri.EscapeUriString(connId) + "&recipientNames=" + Uri.EscapeUriString(Nstring) + "&groupId=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias + "&submit=Send+Message";
                                         //ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/inbox/mailbox/message/send"), PostMessage);
                                         ResponseStatusMsg = HttpHelper.postFormDataRef(new Uri("http://www.linkedin.com/inbox/mailbox/message/send"), PostMessage, "https://www.linkedin.com/inbox/", "", "", "XMLHttpRequest", "https://www.linkedin.com", "1");   //ahmed sudi client changes
                                     }

                                     if (ResponseStatusMsg.Contains("Your message was successfully sent.") || ResponseStatusMsg.Contains("Tu mensaje ha sido enviado con éxito."))
                                     {
                                         foreach (var item in SlectedSentContacts)
                                         {
                                             try
                                             {
                                                 string Querystring = "Select ProfileID From tb_BlackListAccount Where ProfileID ='" + item.Key + "'";
                                                 ds_bList = DataBaseHandler.SelectQuery(Querystring, "tb_BlackListAccount");
                                             }
                                             catch { }

                                             if (ds_bList.Tables.Count > 0 && ds_bList.Tables[0].Rows.Count > 0)
                                             {

                                                 Log("[ " + DateTime.Now + " ] => [ User: "******":", string.Empty).Trim() + " is Added BlackListed List For Send Messages Pls Check ]");
                                             }
                                             else
                                             {
                                                 Log("[ " + DateTime.Now + " ] => [ Subject Posted : " + msg + " ]");
                                                 Log("[ " + DateTime.Now + " ] => [ Body Text Posted : " + body.ToString() + " ]");
                                                 Log("[ " + DateTime.Now + " ] => [ Message Posted To Account: " + item.Value + " With Username >>> " + UserEmail + " ]");

                                                 ReturnString = "Your message was successfully sent.";
                                                 string bdy = string.Empty;

                                                 try
                                                 {
                                                     bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                                                 }
                                                 catch { }
                                                 if (string.IsNullOrEmpty(bdy))
                                                 {
                                                     bdy = body.ToString().Replace(",", ":");
                                                 }

                                                 string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName" + "," + "ProfileUrl";
                                                 string CSV_Content = UserEmail + "," + msg + "," + bdy + "," + ContactName.Replace(":", string.Empty).Trim() + "," + ProfileUrl;
                                                 CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_ComposeMessageSent);

                                                 try
                                                 {
                                                     objComposeMsgDbMgr.InsertComposeMsgData(UserEmail, Convert.ToInt32(connId), ContactName, msg, bdy);
                                                 }
                                                 catch { }
                                             }
                                         }

                                     }

                                     else if (ResponseStatusMsg.Contains("There was an unexpected problem that prevented us from completing your request."))
                                     {
                                         Log("[ " + DateTime.Now + " ] => [ Error In Message Posting ]");
                                         GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", Globals.path_ComposeMessage);
                                     }
                                     else if ((ResponseStatusMsg.Contains("Already Sent")) || (ResponseStatusMsg.Contains("Ya ha sido enviada")))
                                     {
                                         string bdy = string.Empty;
                                         try
                                         {
                                             bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                                         }
                                         catch { }

                                         if (string.IsNullOrEmpty(bdy))
                                         {
                                             bdy = bdy.ToString().Replace(",", ":");
                                         }
                                         string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                         string CSV_Content = UserEmail + "," + msg + "," + bdy.ToString() + "," + ContactName;
                                         CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_MessageAlreadySentComposeMgs);

                                         Log("[ " + DateTime.Now + " ] => [ Message Not Posted To Account: " + ContactName.Replace(":", string.Empty) + " because it has sent the same message already]");
                                     }
                                     else
                                     {
                                         Log("[ " + DateTime.Now + " ] => [ Failed In Message Posting ]");
                                         GlobusFileHelper.AppendStringToTextfileNewLine("Failed In Message Posting", Globals.path_ComposeMessage);
                                     }

                                     //if (SlectedContacts1.Count != 0) //client ahmed sudi
                                     {
                                         int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                                         Log("[ " + DateTime.Now + " ] => [ " + "Delay for : " + delay + " Seconds ]");
                                         Thread.Sleep(delay * 1000);
                                     }

                                 }
                                 catch (Exception ex)
                                 {
                                     GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_ComposeMessage);
                                 }
                             }

                 }
                 catch (Exception ex)
                 {
                     GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error -->  PostFinalMsg() --> 1 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                     GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> PostFinalMsg() --> 1 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinComposeMessageErrorLogs);
                 }

             }
             catch (Exception ex)
             {
                 GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error -->  PostFinalMsg() --> 2 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                 GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> PostFinalMsg() --> 2 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinComposeMessageErrorLogs);
             }
        }
Esempio n. 8
0
        public void AddExperience(ref GlobusHttpHelper HttpHelper)
        {
            string FirstGetResponse = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/edit?trk=tab_pro"));
            string postData = string.Empty;
            string postUrl = string.Empty;
            string expertise_comments = string.Empty;
            string specialties = string.Empty;
            string csrfToken = string.Empty;
            string sourceAlias = string.Empty;
            string goback = string.Empty;
            string Companyname = string.Empty;
            string Title = string.Empty;
            string Description = string.Empty;
            string Location = string.Empty;
            string startDateMonth = string.Empty;
            string startDateYear = string.Empty;
            string endDateMonth = string.Empty;
            string endDateYear = string.Empty;
            // birthday_day = RandomNumberGenerator.GenerateRandom(1, 28).ToString();
            if (!SameExperienceTime && EndMonthFromcmb != string.Empty)
            {
                try
                {
                    startDateMonth = RandomNumberGenerator.GenerateRandom(1, 12).ToString();
                    startDateYear = RandomNumberGenerator.GenerateRandom(1980, 2013).ToString();
                    endDateMonth = RandomNumberGenerator.GenerateRandom(1, 12).ToString();
                    endDateYear = RandomNumberGenerator.GenerateRandom(1980, 2013).ToString();
                }
                catch { }

                if (Convert.ToInt32(startDateYear) < Convert.ToInt32(endDateYear))
                {

                }
                else
                {
                    startDateYear = "2008";
                    endDateYear = "2011";
                }
            }
            else
            {
                startDateMonth = StartMonthFromcmb;
                startDateYear = StartYearFromcmb;
                endDateMonth = EndMonthFromcmb;
                endDateYear = EndYearFromcmb;
            }

            try
            {
                Companyname = lstCmpNames[RandomNumberGenerator.GenerateRandom(0, lstCmpNames.Count)];
                Loger("[ " + DateTime.Now + " ] => [ Company Name : " + Companyname + " ]");
            }
            catch { }
            try
            {
                Title = lstTitelNames[RandomNumberGenerator.GenerateRandom(0, lstTitelNames.Count)];
                Loger("[ " + DateTime.Now + " ] => [ Company Title : " + Title + " ]");
            }
            catch { }
            try
            {
                Location = lstLocationNames[RandomNumberGenerator.GenerateRandom(0, lstLocationNames.Count)];
                Loger("[ " + DateTime.Now + " ] => [ Location : " + Location + " ]");
            }
            catch { }
            try
            {
                Description = lstDescriptionNames[RandomNumberGenerator.GenerateRandom(0, lstDescriptionNames.Count)];
                Loger("[ " + DateTime.Now + " ] => [ Description : " + Description + " ]");
            }
            catch { }

            string[] ArrCsrfToken = Regex.Split(FirstGetResponse, "input");

            if (FirstGetResponse.Contains("csrfToken"))
            {
                try
                {
                    csrfToken = FirstGetResponse.Substring(FirstGetResponse.IndexOf("csrfToken"), 100);
                    string[] Arr = csrfToken.Split('>');
                    csrfToken = Arr[0].Replace("csrfToken=", "").Replace("\"","").Trim();
                }
                catch (Exception ex)
                {
                }
            }

            try
            {
                string[] ArrForValue = Regex.Split(FirstGetResponse, "name\":\"sourceAlias");
                string strValue = (ArrForValue[1].Substring(ArrForValue[1].IndexOf("value\":"), ArrForValue[1].IndexOf("type\":", ArrForValue[1].IndexOf("value\":")) - ArrForValue[1].IndexOf("value\":")).Replace("value\":", string.Empty).Replace("\\\"", string.Empty).Replace("\"", string.Empty).Replace(",","").Trim());
                sourceAlias = (strValue);
            }
            catch { }
            if (FirstGetResponse.Contains("goback"))
            {
                try
                {
                    goback = FirstGetResponse.Substring(FirstGetResponse.IndexOf("goback"), 300);
                    string[] Arr = goback.Split(',');
                    goback = Arr[0].Replace("goback=", "").Replace("\n", string.Empty).Replace("\"", string.Empty);
                }
                catch (Exception ex)
                {
                }
            }

            try
            {
                string postdataa = "csrfToken=" + csrfToken + "&goback=" + goback + "&trk=view-topcard&startTask=&futureOffset=";
                //string CheckRes = HttpHelper.postFormDataRef(new Uri("http://www.linkedin.com/profile/guided-edit-entry-point"), postdataa, "http://www.linkedin.com/profile/edit?trk=tab_pro", "", "XMLHttpRequest", "", "", "1");
                string CheckRes = HttpHelper.postFormDataRef(new Uri("http://www.linkedin.com/profile/guided-edit-entry-point"), postdataa, "http://www.linkedin.com/profile/edit?trk=nav_responsive_sub_nav_edit_profile", "", "XMLHttpRequest", "", "", "1");
                string FirstPostUrlForAddExperience = "http://www.linkedin.com/lite/web-action-track?csrfToken=" + csrfToken;
                string FirstPostDataForAddExperience = "pkey=nprofile_v2_edit_fs&tcode=nprofile-edit-position-submit&plist=activityType%3Aadd";
                string FirstPostResponseForAddExperience = HttpHelper.postFormDataRef(new Uri(FirstPostUrlForAddExperience), FirstPostDataForAddExperience, "http://www.linkedin.com/profile/edit?trk=nav_responsive_sub_nav_edit_profile", "", "XMLHttpRequest", "", "", "1");
            }
            catch { }

            try
            {
                string SecondPostUrlForAddExperience = "http://www.linkedin.com/lite/web-action-track?csrfToken=" + csrfToken;
                string SecondPostDataForAddExperience = "pkey=nprofile_v2_edit_fs&tcode=nprofile-edit-position-submit&plist=activityType%3Aadd";
                SecondPostDataForAddExperience = "pkey=nprofile_v2_edit_fs&tcode=profile-edit-position-form&plist=source%3Aprof-edit-background-add_position-link";
                string SecondPostResponseForAddExperience = HttpHelper.postFormDataRef(new Uri(SecondPostUrlForAddExperience), SecondPostDataForAddExperience, "http://www.linkedin.com/profile/edit?trk=nav_responsive_sub_nav_edit_profile", "", "XMLHttpRequest", "", "", "1");
            }
            catch { }
            string ThirdPostResponseForAddExperience = string.Empty;
            try
            {
                if (!string.IsNullOrEmpty(endDateYear) && !string.IsNullOrEmpty(endDateMonth))
                {

                    string ThirdPostUrlForAddExperience = "http://www.linkedin.com/profile/edit-position-submit?goback=" + goback;
                    string ThirdPostDataForAddExperience = "companyName=" + Companyname + "&companyDisplayName=" + Companyname + "&title=" + Title + "&positionLocationName=" + Location + "&startDateMonth=" + startDateMonth + "&startDateYear=" + startDateYear + "&endDateMonth=" + endDateMonth + "&endDateYear=" + endDateYear + "&updateHeadline=true&updatedHeadline=&summary=" + Description + "&trk-infoParams=&submit=Save&locale=en_US&timestamp=0&useJsonResponse=true&positionID=&experienceId=&defaultLocaleParam=en_US&companyID=0&positionLocation=0&checkboxValue=&sendMailCheckboxValue=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;
                    ThirdPostResponseForAddExperience = HttpHelper.postFormDataRef(new Uri(ThirdPostUrlForAddExperience), ThirdPostDataForAddExperience, "http://www.linkedin.com/profile/edit?trk=tab_pro", "", "XMLHttpRequest", "", "", "1");

                    Loger("[ " + DateTime.Now + " ] => [ Experience Add to UserName : "******" ]");
                    Loger("[ " + DateTime.Now + " ] => [ Company Name : " + Companyname + " Title : " + Title + " Set Using UserName : "******" ]");

                    try
                    {

                        string CSVHeader = "User Name" + "," + "Company Name" + "," + "Title" + "," + "Location" + "," + "Description";
                        string CSV_Content = _UserName + "," + Companyname + "," + Title + "," + Location + "," + Description.Replace(",",string.Empty) ;
                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_LinkedinAddExperience);
                        Loger("[ " + DateTime.Now + " ] => [ Data Saved In CSV File ! ]");

                    }
                    catch { }

                }
                else
                {
                    string ThirdPostUrlForAddExperience = "http://www.linkedin.com/profile/edit-position-submit?goback=" + goback;
                    string ThirdPostDataForAddExperience = "companyName=" + Companyname + "&companyDisplayName=" + Companyname + "&title=" + Title + "&positionLocationName=" + Location + "&startDateMonth=" + startDateMonth + "&startDateYear=" + startDateYear + "&endDateMonth=&endDateYear=&isCurrent=isCurrent&updateHeadline=true&updatedHeadline=" + Title + "&summary=" + Description + "&trk-infoParams=&submit=Save&locale=en_US&timestamp=1360644826453&useJsonResponse=true&positionID=&experienceId=&defaultLocaleParam=en_US&companyID=0&positionLocation=0&checkboxValue=&sendMailCheckboxValue=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;
                    ThirdPostResponseForAddExperience = HttpHelper.postFormDataRef(new Uri(ThirdPostUrlForAddExperience), ThirdPostDataForAddExperience, "http://www.linkedin.com/profile/edit?trk=tab_pro", "", "XMLHttpRequest", "", "", "1");
                    Loger("[ " + DateTime.Now + " ] => [ Experience Add to UserName : "******" ]");
                    Loger("[ " + DateTime.Now + " ] => [ Company Name : " + Companyname + " Title : " + Title + " Set Using UserName : "******" ]");

                    try
                    {

                        string CSVHeader = "User Name" + "," + "Company Name" + "," + "Title" + "," + "Location" + "," + "Description" ;
                        string CSV_Content = _UserName + "," + Companyname + "," + Title + "," + Location + "," + Description.Replace(",","");
                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_LinkedinAddExperience);
                        Loger("[ " + DateTime.Now + " ] => [ Data Saved In CSV File ! ]");

                    }
                    catch { }

                }
            }
            catch { }
        }
Esempio n. 9
0
        public void LoginHttpHelper(ref GlobusHttpHelper HttpHelper)
        {
            try
            {
                Log("[ " + DateTime.Now + " ] => [ Logging In With : " + _Username + " ]");
                Log("[ " + DateTime.Now + " ] => [ Login Process is Running... ]");

                //Check Login
                if (IsLoggedIn)
                {
                    try
                    {
                        string homePage = HttpHelper.getHtmlfromUrlProxy(new Uri("http://www.linkedin.com/home"), _ProxyAddress, int.Parse(_ProxyPort), _ProxyUsername, _ProxyPassword);

                        if (homePage.Contains("Sign Out") && homePage.Contains("class=\"signout\"") && !homePage.Contains("Your LinkedIn account has been temporarily restricted"))
                        {
                            Log("[ " + DateTime.Now + " ] => [ Already Logged In With : " + _Username + " ]");
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                }

                string Url = "https://www.linkedin.com/";
                ////string pageSrcLogin = HttpChilkat.GetHtmlProxy(Url, proxyAddress, proxyPort, proxyUserName, proxyPassword);
                string pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), _ProxyAddress, int.Parse(_ProxyPort), _ProxyUsername, _ProxyPassword);

                if (string.IsNullOrEmpty(pageSrcLogin))
                {
                    try
                    {
                        System.Threading.Thread.Sleep(1000);
                        pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), _ProxyAddress, int.Parse(_ProxyPort), _ProxyUsername, _ProxyPassword, "");
                    }
                    catch
                    {
                    }
                }
                if (string.IsNullOrEmpty(pageSrcLogin))
                {
                    Log("[ " + DateTime.Now + " ] => [ Couldn't Login In With : " + _Username + " ]");
                    return;
                }

                string postdata = string.Empty;
                string postUrl = string.Empty;
                string ResLogin = string.Empty;
                string csrfToken = string.Empty;
                string sourceAlias = string.Empty;
                string regCsrfParam = string.Empty;

                if (pageSrcLogin.Contains("csrfToken"))
                {
                    try
                    {
                        int startindex = pageSrcLogin.IndexOf("name=\"csrfToken\"");
                        if (startindex > 0)
                        {
                            string start = pageSrcLogin.Substring(startindex).Replace("name=\"csrfToken\"", "");
                            int endindex = start.IndexOf("\" ");
                            string end = start.Substring(0, endindex);
                            csrfToken = end.Replace("value=\"", "").Replace("\\", "").Replace(" ", "");
                            csrfToken = Uri.EscapeDataString(csrfToken);
                        }
                        else
                        {
                            string[] Arr = csrfToken.Split('"');
                            csrfToken = Arr[2].Replace("\\", string.Empty);
                        }
                    }
                    catch
                    {
                        try
                        {
                            csrfToken = pageSrcLogin.Substring(pageSrcLogin.IndexOf("csrfToken"), 100);
                            if (csrfToken.Contains("&"))
                            {
                                string[] Arr = csrfToken.Split('&');
                                csrfToken = Arr[0];
                            }
                            else if (csrfToken.Contains(","))
                            {
                                string[] Arr = csrfToken.Split(',');
                                csrfToken = Arr[0].Replace("\\", string.Empty);
                            }
                            else
                            {
                                string[] Arr = csrfToken.Split(',');
                                csrfToken = Arr[0].Replace("\\", string.Empty).Replace("csrfToken=", "").Replace("\n", "").Replace("\">", "");
                            }

                        }
                        catch { }
                    }
                }

                try
                {
                    if (csrfToken.Contains("&"))
                    {
                        string[] Arr1 = csrfToken.Split('&');
                        csrfToken = Arr1[0].Replace("\"", string.Empty);
                    }
                }
                catch { }

                SearchCriteria.CsrToken = csrfToken.Replace("\n", "").Replace("//", "").Replace("\">", "").Replace("csrfToken=", "");

                if (pageSrcLogin.Contains("sourceAlias"))
                {
                    try
                    {
                        sourceAlias = pageSrcLogin.Substring(pageSrcLogin.IndexOf("sourceAlias"), 100);
                        string[] Arr = sourceAlias.Split('"');
                        sourceAlias = Arr[2].Replace("\\", string.Empty);
                    }
                    catch { }
                }

                try
                {
                    int SourceAliasStart = pageSrcLogin.IndexOf("regCsrfParam");
                    if (SourceAliasStart > 0)
                    {
                        try
                        {

                            regCsrfParam = pageSrcLogin.Substring(pageSrcLogin.IndexOf("regCsrfParam"), 100);
                            string[] Arr = regCsrfParam.Split('"');
                            regCsrfParam = Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty);
                        }
                        catch
                        {
                        }
                    }

                }
                catch { }

                postUrl = "https://www.linkedin.com/uas/login-submit";
                //postdata = "isJsEnabled=true&source_app=&tryCount=&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign%20In&session_redirect=&loginCsrfParam=" + regCsrfParam + "&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;

                postdata = "isJsEnabled=true&source_app=&tryCount=&clickedSuggestion=false&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign%20In&session_redirect=&trk=hb_signin&loginCsrfParam=" + regCsrfParam + "&fromEmail=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;
               // postdata = "isJsEnabled=true&source_app=&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign+In&session_redirect=&trk=&loginCsrfParam=7462d247-6d54-47de-8f22-29723ea15f9d&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;
                try
                {
                    ResLogin = HttpHelper.postFormDataProxy(new Uri(postUrl), postdata,_ProxyAddress,int.Parse(_ProxyPort),_ProxyUsername,_ProxyPassword);//HttpHelper.postFormDataRef(new Uri(postUrl), postdata, "http://www.linkedin.com/uas/login?goback=&trk=hb_signin", "", "");
                }
                catch { }

                //postUrl = "https://www.linkedin.com/uas/login-submit";
                //isJsEnabled=true&source_app=&tryCount=&session_key=gargimishra%40globussoft.com&session_password=globussoft&signin=Sign%20In&session_redirect=&csrfToken=ajax%3A7066152446927176852&sourceAlias=0_7r5yezRXCiA_H0CRD8sf6DhOjTKUNps5xGTqeX8EEoi
               //postdata = "isJsEnabled=true&source_app=&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign%20In&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;
                // postdata = "session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&source_app=&trk=guest_home_login&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;

                //ResLogin = HttpHelper.postFormDataRef(new Uri(postUrl), postdata, "https://www.linkedin.com/uas/login?goback=&trk=hb_signin", "true", "");
                string dts = string.Empty;
                string captchachallengeid = string.Empty;
                string origActionAlias = string.Empty;
                string origSourceAlias = string.Empty;
                string irhf = string.Empty;
                string captchaText = string.Empty;
                string ImageUrl = string.Empty;
                //
                if (ResLogin.Contains("Your LinkedIn account has been temporarily restricted") || ResLogin.Contains("Change your password") || ResLogin.Contains("Please confirm your email address") && !ResLogin.Contains("Sign Out"))
                {
                    SearchCriteria.loginREsponce = ResLogin;
                }
                else if (ResLogin.Contains("Security Verification"))
                {
                    string dataforcapctha = HttpHelper.getHtmlfromUrl1(new Uri("https://www.google.com/recaptcha/api/noscript?k=6LcnacMSAAAAADoIuYvLUHSNLXdgUcq-jjqjBo5n"));
                    if (!string.IsNullOrEmpty(dataforcapctha))
                    {
                        int startindex = dataforcapctha.IndexOf("id=\"recaptcha_challenge_field\"");
                        if (startindex > 0)
                        {
                            string start = dataforcapctha.Substring(startindex).Replace("id=\"recaptcha_challenge_field\"", "");
                            int endindex = start.IndexOf("\">");
                            string end = start.Substring(0, endindex).Replace("value=", "").Replace("\"", "");
                            ImageUrl = "https://www.google.com/recaptcha/api/image?c=" + end;
                            WebClient webclient = new WebClient();
                            byte[] args = webclient.DownloadData(ImageUrl);
                            string[] arr1 = new string[] { Globals.CapchaLoginID, Globals.CapchaLoginPassword, "" };
                            captchaText = DecodeDBC(arr1, args);
                        }

                        if (ResLogin.Contains("name=\"security-challenge-id\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"security-challenge-id\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"security-challenge-id\"", "").Replace("value=\"", "");
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                captchachallengeid = end.Replace("\"", "");
                            }
                        }

                        if (ResLogin.Contains("name=\"dts\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"dts\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"dts\"", "").Replace("value=\"", "");
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                dts = end.Replace("\"", "");
                            }
                        }

                        if (ResLogin.Contains("name=\"origActionAlias\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"origActionAlias\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"origActionAlias\"", "").Replace("value=\"", "");
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                origActionAlias = end.Replace("\"", "");
                            }
                        }

                        if (ResLogin.Contains("name=\"origSourceAlias\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"origSourceAlias\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"origSourceAlias\"", "").Replace("value=\"", "");
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                origSourceAlias = end.Replace("\"", "");
                            }
                        }

                        if (ResLogin.Contains("name=\"irhf\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"irhf\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"irhf\"", "").Replace("value=\"", "");
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                irhf = end.Replace("\"", "");
                            }
                        }

                        //postdata = "dts=" + dts + "&security-challenge-id=" + captchachallengeid + "&hr=&source_app=&csrfToken=" + csrfToken + "&trk=guest_home&isJsEnabled=true&session_redirect=&session_password="******"&session_key=" + _Username + "&origSourceAlias=" + origSourceAlias + "&origActionAlias=" + origActionAlias + "&irhf=" + irhf +"&sourceAlias=" + sourceAlias;
                        if (!string.IsNullOrEmpty(ImageUrl) && !string.IsNullOrEmpty(captchaText))
                        {
                            postdata = "recaptcha_challenge_field=" + ImageUrl.Replace("https://www.google.com/recaptcha/api/image?c=", "") + "&recaptcha_response_field=" + captchaText.Replace(" ", "+") + "&dts=" + dts + "&security-challenge-id=" + captchachallengeid + "&hr=&source_app=&csrfToken=" + csrfToken + "&isJsEnabled=true&session_redirect=&session_password="******"&session_key=" + Uri.EscapeDataString(_Username) + "&origSourceAlias=" + origSourceAlias + "&origActionAlias=" + origActionAlias + "&irhf=" + irhf + "&sourceAlias=" + sourceAlias;
                            postdata = postdata.Replace(" ", "");
                            ResLogin = HttpHelper.postFormDataRef(new Uri("https://www.linkedin.com/uas/captcha-submit"), postdata, "https://www.linkedin.com/uas/login-submit", "", "", "", "", "");
                        }
                        else
                        {
                            ResLogin = "";
                        }

                        if (ResLogin.Contains("The text you entered does not match the characters in the security image. Please try again with this new image") || string.IsNullOrEmpty(ResLogin))
                        {
                            Log("[ " + DateTime.Now + " ] => [ " + _Username + " Cannot Login because of Capctcha ]");
                            GlobusFileHelper.WriteStringToTextfile(_Username + ":" + _Password + ":" + _ProxyAddress + ":" + _ProxyPort + ":" + _ProxyUsername + ":" + _ProxyPassword, Globals.pathCapcthaLogin);
                            SearchCriteria.loginREsponce = string.Empty;
                        }
                    }
                }

                //ResLogin.Contains("Sign Out") && ResLogin.Contains("class=\"signout\"") && !ResLogin.Contains("Your LinkedIn account has been temporarily restricted")
                if (ResLogin.Contains("Sign Out") && !ResLogin.Contains("Your LinkedIn account has been temporarily restricted"))
                {
                    SearchCriteria.loginREsponce = string.Empty;
                    IsLoggedIn = true;
                    string Search = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/search?trk=advsrch"));
                    SearchCriteria.loginREsponce = Search;
                }
                else if (ResLogin.Contains("logout?session_full_logout"))
                {
                    SearchCriteria.loginREsponce = string.Empty;
                    IsLoggedIn = true;
                    string Search = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/search?trk=advsrch"));
                    SearchCriteria.loginREsponce = Search;
                }
                else
                {
                    //There was an unexpected problem that prevented us from completing your request.
                    SearchCriteria.loginREsponce = string.Empty;
                    IsLoggedIn = false;
                }

                //Url = "http://www.linkedin.com/home?trk=hb_tab_home_top";
                //pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, 888, proxyUserName, proxyPassword);

                //LogoutHttpHelper(ref HttpHelper);

                //Url = "http://www.linkedin.com/home?trk=hb_tab_home_top";
                //pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, 888, proxyUserName, proxyPassword);
            }
            catch { }
        }
Esempio n. 10
0
        public void EndorsingPeople(ref GlobusHttpHelper HttpHelper, string UserId)
        {
            try
            {
                int count = 0;
                int ProxyPort = 0;
                if (!string.IsNullOrEmpty(proxyPort) && NumberHelper.ValidateNumber(proxyPort))
                {
                    ProxyPort = Convert.ToInt32(proxyPort);
                }

                string EndorseLink = string.Empty;
                string modelNo = string.Empty;
                string csrfToken = string.Empty;
                string postdata = string.Empty;
                string _ed = string.Empty;
                string endorseUrl = string.Empty;
                string Link = string.Empty;
                string LinkSource = string.Empty;
                string PageSourceProfile = string.Empty;

                try
                {
                    Globals.tempDict.Add(UserId, "");
                    Log("[ " + DateTime.Now + " ] => [ Starting Getting Member Details For User Id Link - :" + UserId + " With : " + Username + " ]");
                }
                catch
                {
                }

                if (!UserId.Contains("http"))
                {
                    Link = "http://www.linkedin.com/people/conn-details?i=&contactMemberID=" + UserId;

                    PageSourceProfile = HttpHelper.getHtmlfromUrlProxy(new Uri(Link), proxyAddress, 0, proxyUsername, proxyPassword);

                    try
                    {
                        int startindex = PageSourceProfile.IndexOf("/profile/view?id=");
                        if (startindex > 0)
                        {
                            string start = PageSourceProfile.Substring(startindex);
                            int endIndex = start.IndexOf("\">");
                            string end = start.Substring(0, endIndex).Replace("\\", "").Replace("&amp;", "&");

                            if (end.Contains("&trk"))
                            {
                                end = end.Split('&')[0].ToString();
                            }

                            LinkSource = "http://www.linkedin.com" + end;
                        }
                    }
                    catch (Exception ex)
                    {
                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error -->EndorsingPeople() --> LinkSource >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> EndorsingPeople() --> LinkSource >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_EndorsePeople);
                    }

                    if (string.IsNullOrEmpty(UserId))
                    {
                        try
                        {
                            Globals.tempDict.Add(UserId, "");
                            Log("[ " + DateTime.Now + " ] => [ Cannot Find Data For Userid : " + UserId + " From " + Username + " ]");
                            return;
                        }
                        catch
                        { }
                    }

                    PageSourceProfile = HttpHelper.getHtmlfromUrlProxy(new Uri(LinkSource), proxyAddress, 0, proxyUsername, proxyPassword);
                }
                else
                {
                    Link = UserId;

                    PageSourceProfile = HttpHelper.getHtmlfromUrlProxy(new Uri(Link), proxyAddress, 0, proxyUsername, proxyPassword);
                }

                if (PageSourceProfile.Contains("csrfToken"))
                {
                    csrfToken = PageSourceProfile.Substring(PageSourceProfile.IndexOf("csrfToken"), 100);
                    string[] Arr = csrfToken.Split('&');

                    try
                    {
                        csrfToken = Arr[0].Replace("csrfToken=", "").Replace("\\", "");
                        csrfToken = csrfToken.Split('>')[0].Replace(">", string.Empty).Replace("\"",string.Empty);
                    }
                    catch (Exception ex)
                    {
                        csrfToken = Arr[0].Replace("csrfToken=", "").Replace("\\", "");
                    }
                    //csrfToken
                    if (csrfToken.Contains("updateTagsUrl"))
                    {
                        csrfToken = csrfToken.Split(',')[0].ToString();
                    }

                }

                Dictionary<string, string> lstskilldata = new Dictionary<string, string>();
                if (PageSourceProfile.Contains("/profile/unendorse?_ed="))
                {
                    _ed = Utils.getBetween(PageSourceProfile, "/profile/unendorse?_ed=", "&");
                }
                if (PageSourceProfile.Contains("endorseURL:"))
                {
                    endorseUrl = Utils.getBetween(PageSourceProfile, "endorseURL:", ",").Replace("\\","").Replace("'","").Trim();
                    endorseUrl = "https://www.linkedin.com"+endorseUrl;
                }

                try
                {
                    string[] arr = Regex.Split(PageSourceProfile, "fmt__skill_name\":");
                    arr = arr.Skip(1).ToArray();
                    foreach (string item in arr)
                    {
                        string SkillName = string.Empty;
                        string SkillId = string.Empty;
                        if (!item.Contains("viewerEndorsementId\":"))
                        {
                            if (item.Contains("id\":"))
                            {
                                SkillName = Utils.getBetween(item, "", ",").Replace("\\u002d", "-").Replace("\"", "").Replace(",", "").Replace("&amp;", "&").Replace("}", "").Trim();
                                //SkillId = Utils.getBetween(item, "id\":", ",").Replace("\"", "").Replace(",", "").Replace("&amp;", "&").Replace("}", "").Replace("\u002d", "-").Trim();
                                lstskilldata.Add(SkillName, SkillName);
                            }
                        }

                    }
                    if (lstskilldata.Count == 0)
                    {
                        arr = Regex.Split(PageSourceProfile, "data-endorsed-item-name=\"");
                        arr = arr.Skip(1).ToArray();

                        foreach (string item in arr)
                        {

                            if (EndorsePeople.no_of_Skils == lstskilldata.Count)
                            {
                                if (EndorsePeople.no_of_Skils == 0 && lstskilldata.Count == 0)
                                {

                                }
                                else
                                {
                                    break;
                                }
                            }
                                string SkillName = string.Empty;
                                string SkillId = string.Empty;
                                if (!item.Contains("endorse-item has-endorsements endorsed-by-viewer"))
                                {
                                    //if (item.Contains("id\":"))
                                    {
                                        SkillName = Utils.getBetween(item, "", "\"").Replace("\\u002d", "-").Replace("\"", "").Replace(",", "").Replace("&amp;", "&").Replace("}", "").Trim();
                                        //SkillId = Utils.getBetween(item, "id\":", ",").Replace("\"", "").Replace(",", "").Replace("&amp;", "&").Replace("}", "").Replace("\u002d", "-").Trim();
                                        lstskilldata.Add(SkillName, SkillName);
                                    }
                                }

                        }
                    }
                }
                catch (Exception ex)
                {
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error -->EndorsingPeople() --> lstskilldata Data  >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> EndorsingPeople() --> lstskilldata Data >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_EndorsePeople);
                }

                try
                {
                    string _UserId = string.Empty;

                    if (lstskilldata.Count > 0)
                    {

                        foreach (KeyValuePair<string, string> item in lstskilldata)
                        {
                            if (count > 4)
                            {
                                return;
                            }
                            if (!UserId.Contains("http"))
                            {
                                _UserId = UserId;
                            }
                            else
                            {
                                _UserId = Utils.getBetween(UserId+"@", "&id=", "@");
                                if (string.IsNullOrEmpty(_UserId))
                                {
                                    _UserId = Utils.getBetween(UserId + "@", "?id=", "@");
                                }
                                //_UserId = UserId.Substring(UserId.IndexOf("&id=")).Replace("&id=", string.Empty);

                            }

                            postdata = "endorsementCount=1&recipientId-0=" + _UserId + "&recipientType-0=member&endorsedItemName-0=" + Uri.EscapeDataString(item.Key) + "&endorsementId-0=&endorserIds-0=";
                            string PostUrl = "http://www.linkedin.com/profile/endorse?csrfToken=" + csrfToken + "&_ed=" + _ed + "&goback=%2Enpv_" + UserId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_contacts*5contacts*5list*5contact*4name*50_*1";

                            string PostPageSource = HttpHelper.postFormDataRef(new Uri(endorseUrl), postdata, LinkSource, "", "", "", "", "1");

                            if (!PostPageSource.Contains("fail") || !PostPageSource.Contains("failure"))
                            {
                                string[] ArrayPostedData = System.Text.RegularExpressions.Regex.Split(PostPageSource, "}");
                                //ArrayPostedData = ArrayPostedData.Skip(1).ToArray();
                                foreach (string itemdata in ArrayPostedData)
                                {
                                    foreach (KeyValuePair<string, string> item1 in lstskilldata)
                                    {
                                        if (itemdata.Contains(item1.Key))
                                        {
                                            string status = string.Empty;
                                            try
                                            {
                                                //int startindex = itemdata.IndexOf("endorsementStatus\":\"");
                                                int startindex = PostPageSource.IndexOf("status");
                                                if (startindex >= 0)
                                                {
                                                    //string start = itemdata.Substring(startindex).Replace("endorsementStatus\":\"", "");
                                                    //int endIndex = start.IndexOf("\",\"");
                                                    //string end = start.Substring(0, endIndex).Replace("&amp;", "&");
                                                    //status = end;

                                                    string start = PostPageSource.Substring(startindex).Replace("status", "");
                                                    int endIndex = start.IndexOf("}");
                                                    string end = start.Substring(0, endIndex).Replace("\"", string.Empty).Replace(":", string.Empty);
                                                    status = end;

                                                    string CSVHeader = "UserID" + "," + "Skill" + "," + "Status" + "," + "EndorseID";   //New Addedd
                                                    string CSV_Content = Username + "," + item1.Key + "," + status + "," + UserId;       //new adde
                                                    CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_EndorsedPeopleText);
                                                    Log("[ " + DateTime.Now + " ] => [ Status For Skill : " + item1.Key + " ==> " + status + " ]");
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error -->EndorsingPeople() --> PostPageSource posted correct >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> EndorsingPeople() --> PostPageSource posted correct >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_EndorsePeople);
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                string CSVHeader = "UserID" + "," + "Status" + "," + "EndorseID";
                                string CSV_Content = Username + "," + "Failure" + "," + UserId;
                                CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_NotEndorsedPeopleText);
                                GlobusFileHelper.AppendStringToTextfileNewLine(Username + ",Failure", Globals.path_NotEndorsedPeopleText);
                                Log("[ " + DateTime.Now + " ] => [ Failure for User id : " + item.Key + " -> " +  _UserId + " ]");

                            }
                            count++;
                        }
                    }
                    else
                    {
                        Log("[ " + DateTime.Now + " ] => [ No skills found for User id " + _UserId + " ]");
                    }

                }
                catch (Exception ex)
                {
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error -->EndorsingPeople() --> postdata  >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> EndorsingPeople() --> postdata >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_EndorsePeople);
                }

            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> EndorsingPeople() --> Full Data >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> EndorsingPeople() --> Full Data >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_EndorsePeople);
            }
        }