public void SetProfilePic(ref GlobusHttpHelper httpHelper)
        {
            try
            {
                string homePageSource = httpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com"));
                string ProfileID = GetProfileId(ref httpHelper, homePageSource);
                string Url = "http://www.linkedin.com/profile/view?id=" + ProfileID + "&trk=tab_pro";
                string ProfilePageSource = httpHelper.getHtmlfromUrl1(new Uri(Url));

                if (!string.IsNullOrEmpty(homePageSource))
                {
                    try
                    {
                        if (ProfilePageSource.Contains("link__nprofileEdit"))
                        {
                            try
                            {
                                string link__nprofileEdit = httpHelper.GetUniqueKeyBasedValue(ProfilePageSource, "link__nprofileEdit");
                            }
                            catch { }
                        }

                        if (ProfilePageSource.Contains("link__editPictureInfo"))
                        {
                            try
                            {
                                string link__editPictureInfo = httpHelper.GetUniqueKeyBasedValue(ProfilePageSource, "link__editPictureInfo");
                            }
                            catch { }
                        }
                        string refere = string.Empty;
                        try
                        {
                            UploadPic(ref httpHelper, ProfilePageSource, refere);
                        }
                        catch { }

                    }
                    catch { }
                }
            }
            catch { }

            finally
            {
                Log("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                Log("--------------------------------------------------------------------------------------------------------------------------------------------");
            }
        }
Example #2
0
        public bool HotmailWithoutReference(string Email, string Password)
        {
            GlobusHttpHelper HttpHelper = new GlobusHttpHelper();
            bool             activate   = false;

            Chilkat.Http http = new Chilkat.Http();

            #region Hotmail
            try
            {
                if (Email.Contains("@hotmail"))
                {
                    if (popClient.Connected)
                    {
                        popClient.Disconnect();
                    }
                    popClient.Connect("pop3.live.com", int.Parse("995"), true);
                    popClient.Authenticate(Email, Password);
                    int Count = popClient.GetMessageCount();

                    for (int i = Count; i >= 1; i--)
                    {
                        OpenPOP.MIME.Message Message = popClient.GetMessage(i);
                        string subject = string.Empty;
                        subject = Message.Headers.Subject;

                        if (Message.Headers.Subject.Contains("[WordPress] Activate") && Message.Headers.Subject.Contains("wordpress.com"))
                        {
                            foreach (string href in GetUrlsFromStringHotmail(Message.MessageBody[0]))
                            {
                                try
                                {
                                    string staticUrl = string.Empty;
                                    staticUrl = href;

                                    string res = HttpHelper.getHtmlfromUrl1(new Uri(staticUrl));

                                    responce = http.QuickGetStr(staticUrl);
                                    if (responce.Contains("Your account is now active"))
                                    {
                                        Log("Account activated");
                                        activate = true;
                                    }
                                }
                                catch (Exception ex)
                                {
                                }
                            }
                        }
                    }
                }
            }
            catch { };
            #endregion
            return(activate);
        }
        public void PostFinalMsgGroupMember_1By1(ref GlobusHttpHelper HttpHelper, Dictionary<string, string> SlectedContacts,List<string> GrpMemSubjectlist,List<string> GrpMemMessagelist, string msg, string body, string UserName, string FromemailId, string FromEmailNam, string SelectedGrpName, string grpId,bool mesg_with_tag,bool msg_spintaxt, int mindelay, int maxdelay,bool preventMsgSameGroup,bool preventMsgWithoutGroup,bool preventMsgGlobal)
        {
            try
             {
                 MsgGroupMemDbManager objMsgGroupMemDbMgr = new MsgGroupMemDbManager();

                 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;

                 try
                 {
                     string MessageText = string.Empty;
                     string PostedMessage = string.Empty;
                     string senderEmail = string.Empty;
                     string getComposeData = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/inbox/compose"));
                     try
                     {
                         int startindex = getComposeData.IndexOf("\"senderEmail\" value=\"");
                         if (startindex < 0)
                         {
                             startindex = getComposeData.IndexOf("\"senderEmail\",\"value\":\"");
                         }
                         string start = getComposeData.Substring(startindex).Replace("\"senderEmail\" value=\"", string.Empty).Replace("\"senderEmail\",\"value\":\"",string.Empty);
                         int endindex = start.IndexOf("\"/>");
                         if (endindex < 0)
                         {
                             endindex = start.IndexOf("\",\"");
                         }
                         string end = start.Substring(0, endindex).Replace("\"/>", string.Empty).Replace("\",\"",string.Empty);
                         senderEmail = end.Trim();
                     }
                     catch
                     {}
                     string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));
                     if (pageSource.Contains("csrfToken"))
                     {
                         try
                         {
                             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();
                         }
                         catch (Exception ex)
                         {

                         }

                     }

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

                         }
                     }

                     if (pageSource.Contains("goback="))
                     {
                         try
                         {
                         }
                         catch (Exception ex)
                         {

                         }
                     }

                         foreach (KeyValuePair<string, string> itemChecked in SlectedContacts)
                         {
                             try
                             {
                                 DataSet ds = new DataSet();
                                 DataSet ds_bList = new DataSet();
                                 string ContactName = string.Empty;
                                 string Nstring = string.Empty;
                                 string connId = string.Empty;
                                 string FName = string.Empty;
                                 string Lname = string.Empty;
                                 string tempBody = string.Empty;
                                 string n_ame1 = string.Empty;

                                 //grpId = itemChecked.Key.ToString();

                                 try
                                 {
                                    // FName = itemChecked.Value.Split(' ')[0];
                                    // Lname = itemChecked.Value.Split(' ')[1];
                                     try
                                     {
                                         n_ame1 = itemChecked.Value.Split(']')[1].Trim(); ;
                                     }
                                     catch
                                     { }
                                     if (string.IsNullOrEmpty(n_ame1))
                                     {
                                         try
                                         {
                                             n_ame1 = itemChecked.Value;
                                         }
                                         catch
                                         { }
                                     }
                                     string[] n_ame = Regex.Split(n_ame1, " ");
                                     FName = " " + n_ame[0];
                                     Lname = n_ame[1];

                                     if (!string.IsNullOrEmpty(n_ame[2]))
                                     {
                                         Lname = Lname + n_ame[2];
                                     }
                                     if (!string.IsNullOrEmpty(n_ame[3]))
                                     {
                                         Lname = Lname + n_ame[3];
                                     }
                                     if (!string.IsNullOrEmpty(n_ame[4]))
                                     {
                                         Lname = Lname + n_ame[4];
                                     }
                                     if (!string.IsNullOrEmpty(n_ame[5]))
                                     {
                                         Lname = Lname + n_ame[5];
                                     }
                                 }
                                 catch (Exception ex)
                                 {
                                 }

                                 try
                                 {
                                     ContactName = FName + " " + Lname;
                                     ContactName = ContactName.Replace("%20", " ");
                                 }
                                 catch { }

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

                                 string ToCd = itemChecked.Key;
                                 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;
                                     connId += " " + ToCd;
                                 }

                                 Nstring += "}";

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

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

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

                                     if (mesg_with_tag == true)
                                     {
                                         if (string.IsNullOrEmpty(FName))
                                         {
                                             tempBody = body.Replace("<Insert Name>", ContactName);
                                         }
                                         else
                                         {
                                             tempBody = body.Replace("<Insert Name>", FName);
                                         }
                                     }
                                     else
                                     {
                                         if (string.IsNullOrEmpty(FName))
                                         {
                                             tempBody = body.Replace("<Insert Name>", ContactName);
                                         }
                                         else
                                         {
                                             tempBody = body.Replace("<Insert Name>", FName);
                                         }
                                     }

                                         if (SelectedGrpName.Contains(":"))
                                         {
                                             try
                                             {
                                                 string[] arrSelectedGrpName = Regex.Split(SelectedGrpName, ":");
                                                 if (arrSelectedGrpName.Length > 1)
                                                 {
                                                     SelectedGrpName = arrSelectedGrpName[1];
                                                 }
                                             }
                                             catch (Exception ex)
                                             {

                                             }
                                         }

                                         if (mesg_with_tag == true)
                                         {
                                             tempBody = tempBody.Replace("<Insert Group>", SelectedGrpName);
                                             tempBody = tempBody.Replace("<Insert From Email>", FromEmailNam);
                                             tempBody = tempBody.Replace("<Insert Name>", string.Empty).Replace("<Insert Group>", string.Empty).Replace("<Insert From Email>", string.Empty);
                                         }
                                         else
                                         {
                                             tempBody = tempBody.Replace("<Insert Group>", SelectedGrpName);
                                             tempBody = tempBody.Replace("<Insert From Email>", FromEmailNam);
                                             tempBody = tempBody.Replace("<Insert Name>", string.Empty).Replace("<Insert Group>", string.Empty).Replace("<Insert From Email>", string.Empty);
                                         }

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

                                         if (preventMsgSameGroup)
                                         {
                                             try
                                             {
                                                     string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgFrom ='" + UserName + "' and MsgGroupId = " + grpId + " and MsgToId = " + connId + "";
                                                     ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                             }
                                             catch { }
                                         }

                                         if (preventMsgWithoutGroup)
                                         {
                                             try
                                             {
                                                 string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgFrom ='" + UserName + "' and MsgToId = " + connId + "";
                                                 ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                             }
                                             catch { }
                                         }
                                         if (preventMsgGlobal)
                                         {
                                             try
                                             {
                                                 string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgToId = " + connId + "";
                                                 ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                             }
                                             catch { }
                                         }

                                         try
                                         {

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

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

                                                 }
                                                 else
                                                 {
                                                     if (ds_bList.Tables.Count > 0 && ds_bList.Tables[0].Rows.Count > 0)
                                                     {
                                                         Log("[ " + DateTime.Now + " ] => [ User: "******" is Added BlackListed List For Send Messages Pls Check ]");
                                                         ResponseStatusMsg = "BlackListed";
                                                     }
                                                     else
                                                     {
                                                         PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                         ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groupMsg"), PostMessage);
                                                     }
                                                 }
                                             }
                                             else
                                             {
                                                 if (ds_bList.Tables.Count > 0)
                                                 {
                                                     if (ds_bList.Tables[0].Rows.Count > 0)
                                                     {

                                                         Log("[ " + DateTime.Now + " ] => [ User: "******" is Added BlackListed List For Send Messages Pls Check ]");
                                                         ResponseStatusMsg = "BlackListed";
                                                     }
                                                     else
                                                     {
                                                         PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                         ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groupMsg"), PostMessage);
                                                     }
                                                 }
                                             }
                                         }
                                         catch (Exception)
                                         {
                                                 //PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&showRecipeints=showRecipeintsfromName=" + Uri.EscapeDataString(FromEmailNam) + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                 //ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groupMsg"), PostMessage);
                                         }

                                         if ((!ResponseStatusMsg.Contains("Your message was successfully sent.") && !ResponseStatusMsg.Contains("Already Sent")) && (!ResponseStatusMsg.Contains("Se ha enviado tu mensaje satisfactoriamente") && !ResponseStatusMsg.Contains("Ya ha sido enviada") && !ResponseStatusMsg.Contains("Uw bericht is verzonden")))
                                         {

                                             if (ResponseStatusMsg.Contains("Already Sent") || (ResponseStatusMsg.Contains("Ya ha sido enviada") || (ResponseStatusMsg.Contains("BlackListed"))))
                                             {
                                                 continue;
                                             }

                                             try
                                             {
                                                 pageSource = HttpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/groups?viewMembers=&gid=" + grpId));

                                                 if (pageSource.Contains("contentType="))
                                                 {
                                                     try
                                                     {
                                                         string contentType = pageSource.Substring(pageSource.IndexOf("contentType="), pageSource.IndexOf("&", pageSource.IndexOf("contentType=")) - pageSource.IndexOf("contentType=")).Replace("contentType=", string.Empty).Replace("contentType=", string.Empty).Trim();

                                                         string pageSource2 = HttpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/groupMsg?displayCreate=&contentType=" + contentType + "&connId=" + connId + "&groupID=" + grpId + ""));

                                                         PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&showRecipeints=showRecipeints&fromName=" + FromEmailNam + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=" + Uri.EscapeUriString(Nstring) + "&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=" + contentType + "&groupID=" + grpId + "";

                                                     }
                                                     catch (Exception ex)
                                                     {
                                                     }
                                                 }

                                                 ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                             }
                                             catch (Exception ex)
                                             {

                                             }
                                     }

                                         if ((ResponseStatusMsg.Contains("Your message was successfully sent.")) || (ResponseStatusMsg.Contains("Se ha enviado tu mensaje satisfactoriamente") || (ResponseStatusMsg.Contains("Uw bericht is verzonden"))))
                                         {
                                             Log("[ " + DateTime.Now + " ] => [ Subject Posted : " + msg + " ]");
                                             Log("[ " + DateTime.Now + " ] => [ Body Text Posted : " + tempBody.ToString() + " ]");
                                             Log("[ " + DateTime.Now + " ] => [ Message Posted To Account: " + ContactName + " ]");
                                             ReturnString = "Your message was successfully sent.";

                                             #region CSV
                                             string bdy = string.Empty;
                                             try
                                             {
                                                 bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                                             }
                                             catch { }
                                             if (string.IsNullOrEmpty(bdy))
                                             {
                                                 bdy = tempBody.ToString().Replace(",", ":");
                                             }
                                             string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                             string CSV_Content = UserName + "," + msg + "," + bdy.ToString() + "," + ContactName;
                                             CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_MessageSentGroupMember);

                                             try
                                             {
                                                 objMsgGroupMemDbMgr.InsertMsgGroupMemData(UserName, Convert.ToInt32(connId), ContactName, Convert.ToInt32(grpId), SelectedGrpName, msg, tempBody);
                                             }
                                             catch { }

                                             #endregion

                                         }
                                         else if (ResponseStatusMsg.Contains("There was an unexpected problem that prevented us from completing your request"))
                                         {
                                             Log("[ " + DateTime.Now + " ] => [ There was an unexpected problem that prevented us from completing your request ! ]");
                                             GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", Globals.path_MessageGroupMember);
                                         }
                                         else if (ResponseStatusMsg.Contains("You are no longer authorized to message this"))
                                         {
                                             Log("[ " + DateTime.Now + " ] => [ You are no longer authorized to message this ! ]");
                                             GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", Globals.path_MessageGroupMember);
                                         }
                                         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 = tempBody.ToString().Replace(",", ":");
                                             }
                                             string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                             string CSV_Content = UserName + "," + msg + "," + bdy.ToString() + "," + ContactName;
                                             CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_MessageAlreadySentGroupMember);

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

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

                                 }
                                 catch (Exception ex)
                                 {
                                     //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");
                                     GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember);
                                 }
                             }
                             catch (Exception ex)
                             {
                                 //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace);
                                 GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember);
                             }
                         }

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

             }
             catch (Exception ex)
             {
                 GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error -->  PostFinalMsgGroupMember() --> 2 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                 GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> PostFinalMsgGroupMember() --> 2 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinComposeMessageErrorLogs);
             }
        }
        public void GetMultipleRecords(ref GlobusHttpHelper HttpHelper)
        {
            try
            {
                string csrfToken = string.Empty;
                string LastName = string.Empty;
                string FirstName = string.Empty;
                string Industry = string.Empty;
                string Postalcode = string.Empty;
                string Distance = string.Empty;
                string contentSummary = string.Empty;
                string Title = string.Empty;
                string Company = string.Empty;
                string school = string.Empty;
                string Country = string.Empty;
                string countrycode = string.Empty;
                string industrycode = string.Empty;
                string rsid = string.Empty;

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

                try
                {
                    try
                    {
                        string[] Arr_Pst = Regex.Split(postalCode, "(");
                    }
                    catch { }
                    try
                    {
                        Postalcode = postalCode.Substring(0, postalCode.IndexOf(" "));
                        Country = postalCode.Replace(Postalcode, string.Empty).Replace(")", string.Empty).Replace("(", string.Empty).Trim();

                    }
                    catch
                    {
                        if (Postalcode == string.Empty)
                        {
                            Postalcode = postalCode;
                        }
                    }
                }
                catch { }
                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", ":");
                }
                InBoardPro.GetIndustryCode objIndustry = new GetIndustryCode();
                Dictionary<string, string> Dict_IndustryCode = new Dictionary<string, string>();

                Dict_IndustryCode = objIndustry.getIndustry();
                foreach (KeyValuePair<string, string> item in Dict_IndustryCode)
                {
                    try
                    {
                        string toloweritem = item.Value.ToLower();
                        string tolowerindustrytype = industryType.ToLower();
                        if (toloweritem == tolowerindustrytype)
                        {
                            //SearchCriteria.Country = item.Key;
                            industrycode = item.Key;
                            break;
                        }
                    }
                    catch
                    {
                    }
                }

                Dictionary<string, string> Dict_CountryCode = new Dictionary<string, string>();
                Dict_CountryCode = objIndustry.getCountry();
                foreach (KeyValuePair<string, string> item in Dict_CountryCode)
                {
                    try
                    {
                        string toloweritem = item.Value.ToLower();
                        string tolowercountrytype = Country.ToLower();
                        if (toloweritem == tolowercountrytype)
                        {
                            countrycode = item.Key;
                            break;
                        }
                    }
                    catch
                    {
                    }
                }
                string Firstresponse = string.Empty;
                if (string.IsNullOrEmpty(countrycode))
                {
                    countrycode = "us";
                }

                string FirstGetRequestUrl = string.Empty;
                string FirstGetResponse = string.Empty;
                {
                    try
                    {
                        FirstGetRequestUrl = "http://www.linkedin.com/search/fpsearch?lname=" + lastName + "&searchLocationType=I&countryCode=" + countrycode + "&postalCode=" + Postalcode + "&distance=" + distance + "&keepFacets=keepFacets&page_num=1&facet_I=" + industrycode + "&pplSearchOrigin=ADVS&viewCriteria=2&sortCriteria=R&redir=redir";
                        FirstGetResponse = HttpHelper.getHtmlfromUrl1(new Uri(FirstGetRequestUrl));
                    }
                    catch { }
                }

                int RecordCount = 0;
                try
                {
                    RecordCount = objIndustry.GetPageNo(FirstGetResponse);

                    if (RecordCount == 0)
                    {
                        string getAdvPagedata = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/vsearch/f?adv=true&trk=advsrch"), "http://www.linkedin.com/");

                        try
                        {
                            int startindex = getAdvPagedata.IndexOf("rsid=");
                            string start = getAdvPagedata.Substring(startindex).Replace("rsid=", "");
                            int endindex = start.IndexOf("&amp;");
                            string end = start.Substring(0, endindex);
                            rsid = end;
                        }
                        catch (Exception ex)
                        {

                        }

                        try
                        {

                            FirstGetRequestUrl = "http://www.linkedin.com/vsearch/p?lastName=" + lastName + "&postalCode=" + postalCode + "&openAdvancedForm=true&locationType=I&countryCode=" + countrycode + "&distance=" + distance + "&f_I=" + industrycode.Replace(" ", "") + "&rsid=" + rsid + "&orig=ADVS";
                            FirstGetResponse = HttpHelper.getHtmlfromUrl1(new Uri(FirstGetRequestUrl));

                        }
                        catch { }
                    }

                    RecordCount = objIndustry.GetPageNo(FirstGetResponse);

                    if (lastName != string.Empty && industryType == string.Empty)
                    {
                        Loger("[ " + DateTime.Now + " ] => [ Get RecordCount : " + RecordCount + " Using UserName : "******" Zip Code : " + postalCode.ToString() + " Distance : " + distance + " LastName : " + lastName + " ]");
                    }

                    if (industryType != string.Empty && lastName == string.Empty)
                    {
                        Loger("[ " + DateTime.Now + " ] => [ Get RecordCount : " + RecordCount + " Using UserName : "******" Zip Code : " + postalCode.ToString() + " Distance : " + distance + " Industry : " + industryType + " ]");
                    }

                    if (lastName == string.Empty && industryType == string.Empty)
                    {
                        Loger("[ " + DateTime.Now + " ] => [ Get RecordCount : " + RecordCount + " Using UserName : "******" Zip Code : " + postalCode.ToString() + " Distance : " + distance + " ]");
                    }

                }
                catch { }
                try
                {
                    LinkedinScrappDbManager objLsManager = new LinkedinScrappDbManager();
                    objLsManager.InsertScarppRecordData(Postalcode, distance, industryType, lastName, RecordCount);

                }
                catch { }
                try
                {
                    string prxyadress = string.Empty;
                    try
                    {
                        if (!string.IsNullOrEmpty(proxyAddress) && !string.IsNullOrEmpty(proxyPort))
                        {
                            prxyadress = proxyAddress + ":" + proxyPort;
                        }

                    }
                    catch { }

                    if (lastName != string.Empty && industryType == string.Empty)
                    {
                        string CSVHeader = "LastName" + "," + "CentralZipCode" + "," + "DistanceFromZipCode" + "," + "Number Of Result" + "," + "UserName" + "," + "Password" + "," + "Proxy" + "," + "ProxyPwd ";
                        string CSV_Content = lastName.ToString().Replace(",", ";") + "," + postalCode.ToString().Replace(",", ";") + "," + distance.ToString().Replace(",", ";") + "," + RecordCount.ToString().Replace(",", ";") + "," + accountUser.Replace(",", ";") + "," + accountPass.Replace(",", ";") + "," + prxyadress.Replace(",", ";") + "," + proxyPassword.Replace(",", ";");
                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_InBoardProGetDataResultCountLastNameWise);
                    }

                    if (industryType != string.Empty && lastName == string.Empty)
                    {
                        string CSVHeader = "IndustryZone" + "," + "CentralZipCode" + "," + "DistanceFromZipCode" + "," + "Number Of Result" + "," + "UserName" + "," + "Password" + "," + "Proxy" + "," + "ProxyPwd ";
                        string CSV_Content = industryType.ToString().Replace(",", ";") + "," + postalCode.ToString().Replace(",", ";") + "," + distance.ToString().Replace(",", ";") + "," + RecordCount.ToString().Replace(",", ";") + "," + accountUser.Replace(",", ";") + "," + accountPass.Replace(",", ";") + "," + prxyadress.Replace(",", ";") + "," + proxyPassword.Replace(",", ";");
                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_InBoardProGetDataResultCountIndustryZoneWise);
                    }

                    if (lastName == string.Empty && industryType == string.Empty)
                    {
                        string CSVHeader = "CentralZipCode" + "," + "DistanceFromZipCode" + "," + "Number Of Result" + "," + "UserName" + "," + "Password" + "," + "Proxy" + "," + "ProxyPwd ";
                        string CSV_Content = postalCode.ToString().Replace(",", ";") + "," + distance.ToString().Replace(",", ";") + "," + RecordCount.ToString().Replace(",", ";") + "," + accountUser.Replace(",", ";") + "," + accountPass.Replace(",", ";") + "," + prxyadress.Replace(",", ";") + "," + proxyPassword.Replace(",", ";");
                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_InBoardProGetDataResultCountZipCodeWise);
                    }

                }
                catch { }
            }
            catch { }
        }
        public bool CrawlingLinkedInPage(string Url, ref GlobusHttpHelper HttpHelper,string FileName)
        {
            //Url = "http://www.linkedin.com/profile/view?id=44952194&authType=OUT_OF_NETWORK&authToken=DYBR&locale=en_US&srchid=3817933251416230963594&srchindex=2&srchtotal=1949&trk=vsrp_people_res_name&trkInfo=VSRPsearchId%3A3817933251416230963594%2CVSRPtargetId%3A44952194%2CVSRPcmpt%3Aprimary";

            #region Data Initialization
            string GroupMemId = 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 CurrentCompUrl = string.Empty;
            string CurrentCompSite = string.Empty;
            string titlepast1 = string.Empty;
            string companypast1 = string.Empty;
            string titlepast2 = string.Empty;
            string html = 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 DeegreeConn = string.Empty;
            string AccountType = string.Empty;
            bool CheckEmployeeScraper = false;
            string fileName = string.Empty;
            bool CampaignScraper = false;
            #endregion

            #region GetRequest
            if (Url.Contains("CompanyEmployeeScraper"))
            {
                try
                {
                    Url = Url.Replace("CompanyEmployeeScraper", string.Empty);
                    CheckEmployeeScraper = true;
                }
                catch
                { }
            }

            if (Url.Contains("CampaignScraper"))
            {
                try
                {
                    string[] Url_Split = Regex.Split(Url, "CampaignScraper");
                    Url = Url_Split[0];
                    fileName = Url_Split[1];
                    CampaignScraper = true;
                }
                catch
                { }
            }

            string stringSource = HttpHelper.getHtmlfromUrl(new Uri(Url.Replace("http", "https")));
            #endregion

            #region GroupMemId
            try
            {
                string[] gid = Url.Split('&');
                GroupMemId = gid[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("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 { }
                }

                if (string.IsNullOrEmpty(strFamilyName))
                {
                    try
                    {
                        strFamilyName = stringSource.Substring(stringSource.IndexOf("<span class=\"full-name\">"), (stringSource.IndexOf("</span><span></span></span></h1></div></div><div id=\"headline-container\" data-li-template=\"headline\">", stringSource.IndexOf("</span><span></span></span></h1></div></div><div id=\"headline-container\" data-li-template=\"headline\">")) - stringSource.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(strFamilyName))
                {
                    try
                    {
                        int StartIndex = stringSource.IndexOf("profileFullName");
                        string Start = stringSource.Substring(StartIndex).Replace("profileFullName", string.Empty);
                        int EndIndex = Start.IndexOf("slideData");
                        string End = Start.Substring(0, EndIndex).Replace(":", string.Empty).Replace("'",string.Empty).Replace(",",string.Empty).Trim();
                        strFamilyName = End.Trim();
                    }
                    catch
                    { }
                }
            }
            catch { }

            if (string.IsNullOrEmpty(strFamilyName))
            {
                try
                {
                    int StartIndex = stringSource.IndexOf("</script><title>");
                    string Start = stringSource.Substring(StartIndex).Replace("</script><title>", string.Empty);
                    int EndIndex = Start.IndexOf("| LinkedIn</title>");
                    string End = Start.Substring(0, EndIndex).Replace(":", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Trim();
                    strFamilyName = End.Trim();
                }
                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];
            }
            catch { }

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

                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
            try
            {
                try
                {
                    try
                    {
                        //soft engg at TCSi18n__LocationLocationi18n__Linkedin_memberLinkedIn Member
                        //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("   ", string.Empty).Replace("visibletrue", string.Empty).Replace("isLNLedtrue",string.Empty).Replace("isPortfoliofalse",string.Empty).Replace("i18n__Location",string.Empty).Replace("Locationi18n__Linkedin_member",string.Empty).Replace("u002d","-").Replace("LinkedIn Member",string.Empty).Replace("--Location","--").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("   ", string.Empty).Replace("visibletrue", string.Empty).Replace("isLNLedtrue", string.Empty).Replace("isPortfoliofalse", string.Empty).Replace("i18n__Location", string.Empty).Replace("Locationi18n__Linkedin_member", string.Empty).Replace("u002d", "-").Replace("LinkedIn Member", string.Empty).Replace("--Location", "--").ToString().Trim();
                        if (Company.Contains("#Name?"))
                        {
                            Company = "--";
                        }
                        if (Company.Contains("i18n"))
                        {
                            Company = Regex.Split(Company, "i18n")[0];
                        }

                    }
                    catch
                    {
                    }

                    if (string.IsNullOrEmpty(Company))
                    {
                        try
                        {
                            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("visibletrue", string.Empty).Replace("&dsh;", "").Replace("&amp", "").Replace(";", "").Replace("isLNLedtrue", string.Empty).Replace("isPortfoliofalse", string.Empty).Trim();
                        }
                        catch { }

                    }

                    if (string.IsNullOrEmpty(Company))
                    {
                        try
                        {
                            Company = stringSource.Substring(stringSource.IndexOf("class=\"title \">"), (stringSource.IndexOf("</p></div></div><div class=\"demographic-info adr editable-item\" id=\"demographics\">", stringSource.IndexOf("</p></div></div><div class=\"demographic-info adr editable-item\" id=\"demographics\">")) - stringSource.IndexOf("class=\"title \">"))).Replace("class=\"title \">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace("<strong class=highlight>", string.Empty).Replace("</strong>", string.Empty).Trim();
                        }
                        catch { }
                    }

                    string[] strdesigandcompany = new string[4];
                    if (Company.Contains(" at "))
                    {
                        try
                        {
                            strdesigandcompany = Regex.Split(Company, " at ");
                        }
                        catch { }

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

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

                #region Current Company Site
                try
                {
                    try
                    {
                        CurrentCompUrl = stringSource.Substring(stringSource.IndexOf("/companies"), (stringSource.IndexOf("/companies", stringSource.IndexOf("?miniprofile")) - stringSource.IndexOf("?miniprofile"))).Replace("?miniprofi", string.Empty).ToString().Trim();
                        CurrentCompUrl = "https://www.linkedin.com" + CurrentCompUrl;
                    }
                    catch { }

                    string CompanyUrl = HttpHelper.getHtmlfromUrl1(new Uri(CurrentCompUrl));

                    try
                    {
                        CurrentCompSite = CompanyUrl.Substring(CompanyUrl.IndexOf("<dt>Website</dt>"), (CompanyUrl.IndexOf("</dd>", CompanyUrl.IndexOf("<dt>Website</dt>")) - CompanyUrl.IndexOf("<dt>Website</dt>"))).Replace("<dt>Website</dt>", string.Empty).Replace("<dd>", string.Empty).Trim();
                    }
                    catch { }

                    try
                    {
                        CurrentCompSite = CompanyUrl.Substring(CompanyUrl.IndexOf("<h4>Website</h4>"), (CompanyUrl.IndexOf("</p>", CompanyUrl.IndexOf("<h4>Website</h4>")) - CompanyUrl.IndexOf("<h4>Website</h4>"))).Replace("<h4>Website</h4>", string.Empty).Replace("<p>", string.Empty).Trim();

                        if (CurrentCompSite.Contains("a href="))
                        {
                            try
                            {
                                string[] websArr = Regex.Split(CurrentCompSite, ">");
                                CurrentCompSite = websArr[1].Replace("</a", string.Empty).Replace("\n", string.Empty).Trim(); ;
                            }
                            catch { }
                        }
                    }
                    catch { }
                }
                catch { }

                #endregion

                #region PastCompany
                string[] companylist = Regex.Split(stringSource, "companyName\"");
                if (companylist.Count() == 1)
                {
                    companylist = Regex.Split(stringSource, "company-name");
                }
                if (companylist.Count() == 1)
                {
                    //companylist = Regex.Split(stringSource, "Companies");
                }

                string AllComapny = string.Empty;

                string Companyname = string.Empty;
                if (!stringSource.Contains("company-name") && companylist.Count() > 1)
                {
                    foreach (string item in companylist)
                    {
                        try
                        {
                            if (!item.Contains("<!DOCTYPE html>"))
                            {
                                Companyname = item.Substring(item.IndexOf(":"), (item.IndexOf(",", item.IndexOf(":")) - item.IndexOf(":"))).Replace(":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("}", string.Empty).Replace("]", string.Empty).Trim();
                                string items = item;
                                checkerlst.Add(Companyname);
                                checkerlst = checkerlst.Distinct().ToList();
                            }
                        }
                        catch { }
                    }
                }
                else
                {
                    foreach (string item in companylist)
                    {
                        try
                        {
                            if (!item.Contains("<!DOCTYPE html>"))
                            {
                                Companyname = item.Substring(item.IndexOf(">"), (item.IndexOf("<", item.IndexOf(">")) - item.IndexOf(">"))).Replace(">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("}", string.Empty).Replace("]", string.Empty).Trim();
                                string items = item;
                                if (!string.IsNullOrEmpty(Companyname))
                                {
                                    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;", "&");
                    }
                }
                #endregion

            #endregion Company

                #region Company Descripription

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

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

                                if (startindex > 0)
                                {
                                    try
                                    {
                                        string start = item.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("&#x2022;", ";").Replace("<br>", string.Empty).Replace("\\n", string.Empty).Replace("\"u002", "-");
                                        LDS_BackGround_Summary = Current_Company;
                                    }
                                    catch { }
                                }

                            }

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

                                if (startindex > 0)
                                {
                                    try
                                    {
                                        string start = item.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("&#x2022;", string.Empty).Replace(":", string.Empty);
                                        LDS_BackGround_Summary = Current_Company;
                                    }
                                    catch { }
                                }

                            }

                        }
                        catch { }
                    }

                    if (string.IsNullOrEmpty(LDS_BackGround_Summary))
                    {
                        try
                        {
                            LDS_BackGround_Summary = HttpHelper.GetDataWithTagValueByTagAndAttributeNameWithId(stringSource, "div", "summary-item-view");
                            LDS_BackGround_Summary = Regex.Replace(LDS_BackGround_Summary, "<.*?>", string.Empty).Replace(",", "").Replace("\n", "").Replace("<![CDATA[", "").Trim();
                        }
                        catch { }
                    }
                }
                catch { }

                #endregion

                #region Education
                try
                {
                    string[] str_UniversityName = Regex.Split(stringSource, "link__school_name");
                    foreach (string item in str_UniversityName)
                    {
                        try
                        {
                            string School = string.Empty;
                            string Degree = string.Empty;
                            string SessionEnd = string.Empty;
                            string SessionStart = string.Empty;
                            string Education = string.Empty;
                            if (stringSource.Contains("link__school_name"))
                            {
                                if (!item.Contains("<!DOCTYPE html>"))
                                {
                                    try
                                    {
                                        try
                                        {
                                            int startindex = item.IndexOf("fmt__school_highlight");
                                            string start = item.Substring(startindex).Replace("fmt__school_highlight", "");
                                            int endindex = start.IndexOf(",");
                                            School = start.Substring(0, endindex).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("_highlight", string.Empty);
                                        }
                                        catch { }

                                        try
                                        {
                                            int startindex1 = item.IndexOf("degree");
                                            string start1 = item.Substring(startindex1).Replace("degree", "");
                                            int endindex1 = start1.IndexOf(",");
                                            Degree = start1.Substring(0, endindex1).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("_highlight", string.Empty);
                                        }
                                        catch { }

                                        try
                                        {
                                            int startindex2 = item.IndexOf("enddate_my");
                                            string start2 = item.Substring(startindex2).Replace("enddate_my", "");
                                            int endindex2 = start2.IndexOf(",");
                                            SessionEnd = start2.Substring(0, endindex2).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("_highlight", string.Empty);
                                        }
                                        catch { }

                                        try
                                        {
                                            int startindex3 = item.IndexOf("startdate_my");
                                            string start3 = item.Substring(startindex3).Replace("startdate_my", "");
                                            int endindex3 = start3.IndexOf(",");
                                            SessionStart = start3.Substring(0, endindex3).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty);
                                        }
                                        catch { }

                                        if (SessionStart == string.Empty && SessionEnd == string.Empty)
                                        {
                                            Education = " [" + School + "] Degree: " + Degree;
                                        }
                                        else
                                        {
                                            Education = " [" + School + "] Degree: " + Degree + " Session: " + SessionStart + "-" + SessionEnd;
                                        }
                                        //University = item.Substring(item.IndexOf(":"), (item.IndexOf(",", item.IndexOf(":")) - item.IndexOf(":"))).Replace(":", string.Empty).Replace("\\u002d", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                                    }
                                    catch { }
                                    EducationList.Add(Education);

                                }
                            }
                            else
                            {

                                str_UniversityName = Regex.Split(stringSource, "<div class=\"education");
                                foreach (string tempItem in str_UniversityName)
                                {
                                    try
                                    {
                                        if (!tempItem.Contains("<!DOCTYPE html>"))
                                        {
                                            List<string> lstSchool = HttpHelper.GetTextDataByTagAndAttributeName(tempItem, "h4", "summary fn org");
                                            List<string> lstDegree = HttpHelper.GetTextDataByTagAndAttributeName(tempItem, "span", "degree");
                                            List<string> lstSession = HttpHelper.GetTextDataByTagAndAttributeName(tempItem, "span", "education-date");

                                            if (lstSession.Count == 0)
                                            {
                                                Education = " [" + lstSchool[0] + "] Degree: " + lstDegree[0];
                                            }
                                            else
                                            {
                                                Education = " [" + lstSchool[0] + "] Degree: " + lstDegree[0] + " Session: " + lstSession[0].Replace("&#8211;", "-").Replace(",", "").Trim();
                                            }

                                            EducationList.Add(Education);
                                        }
                                    }
                                    catch { }
                                }
                            }
                        }
                        catch { }

                    }

                    EducationList = EducationList.Distinct().ToList();

                    foreach (string item in EducationList)
                    {
                        if (string.IsNullOrEmpty(EducationCollection))
                        {
                            EducationCollection = item.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                        }
                        else
                        {
                            EducationCollection = EducationCollection + "  -  " + item.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                        }
                    }
                    // string University1 = 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).Replace(":", string.Empty).Trim();

                }

                catch { }

                #endregion Education

                #region Email
                try
                {
                    if (stringSource.Contains("mailto:"))
                    {
                        string[] str_Email = Regex.Split(stringSource, "mailto:");
                        USERemail = stringSource.Substring(stringSource.IndexOf("mailto:"), (stringSource.IndexOf(">", stringSource.IndexOf("mailto:")) - stringSource.IndexOf("mailto:"))).Replace("mailto:", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                    }
                    else
                    {
                        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 UserContact
                try
                {
                    if (stringSource.Contains("<div id=\"phone-view\">"))
                    {
                        //string[] str_Contact = Regex.Split(stringSource, "<div id=\"phone-view\">");
                        LDS_UserContact = stringSource.Substring(stringSource.IndexOf("<div id=\"phone-view\">"), (stringSource.IndexOf("</li>", stringSource.IndexOf("<div id=\"phone-view\">")) - stringSource.IndexOf("<div id=\"phone-view\">"))).Replace("<div id=\"phone-view\">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace("<ul><li>", string.Empty).Replace("&nbsp;", "").Trim();
                    }
                    else
                    {
                        //string[] str_Email = Regex.Split(stringSource, "<div id=\"phone-view\">");
                        LDS_UserContact = stringSource.Substring(stringSource.IndexOf("<div id=\"phone-view\">"), (stringSource.IndexOf("</li>", stringSource.IndexOf("<div id=\"phone-view\">")) - stringSource.IndexOf("<div id=\"phone-view\">"))).Replace("<div id=\"phone-view\">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace("<ul><li>", string.Empty).Replace("&nbsp;", "").Trim();

                    }
                }
                catch (Exception ex)
                {

                }
                #endregion Email

                #region Website
                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).Replace("]", string.Empty).Trim();
                }
                catch { }
                if (string.IsNullOrEmpty(Website))
                {
                    try
                    {

                        Website = HttpHelper.GetDataWithTagValueByTagAndAttributeNameWithId(stringSource, "div", "website-view");
                        Website = Regex.Replace(Website, "<[^>]*>", String.Empty).Replace("\n", "").Replace("\r", "").Replace(" ", " ").Trim();
                        Website = Regex.Replace(Website, @"\s+", " ").Replace(",", " ").Trim();
                    }
                    catch { }
                }
                #endregion Website

                #region location
                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();
                    int startindex = stringSource.IndexOf("fmt_location");
                    string start = stringSource.Substring(startindex).Replace("fmt_location\":\"", "");
                    int endindex = start.IndexOf("\"");
                    string end = start.Substring(0, endindex).Replace("\u002d", string.Empty);
                    location = end;
                }
                catch (Exception ex)
                {

                }
                if (string.IsNullOrEmpty(location))
                {
                    try
                    {
                        List<string> lstLocation = HttpHelper.GetTextDataByTagAndAttributeName(stringSource, "span", "locality");
                        if (lstLocation.Count > 0)
                        {
                            location = lstLocation[lstLocation.Count - 1].Trim();
                        }
                    }
                    catch { }
                }
                #endregion location

                #region Country
                try
                {
                    int startindex = stringSource.IndexOf("\"geo_region\":");
                    if (startindex > 0)
                    {
                        string start = stringSource.Substring(startindex).Replace("\"geo_region\":", "");
                        int endindex = start.IndexOf("\"i18n_geo_region\":\"Location\"");
                        string end = start.Substring(0, endindex);
                        country = end;

                        string[] array = Regex.Split(end, "\"name\":\"");
                        array = array.Skip(1).ToArray();
                        foreach (string item in array)
                        {
                            try
                            {
                                int startindex1 = item.IndexOf("\",\"");
                                string strat1 = item.Substring(0, startindex1);
                                country = strat1;
                                break;
                            }
                            catch (Exception ex)
                            {

                            }
                        }

                    }
                }
                catch (Exception ex)
                {

                }
                if (country == string.Empty)
                {
                    try
                    {
                        string[] countLocation = location.Split(',');

                        if (countLocation.Count() == 2)
                        {
                            country = location.Split(',')[1];
                        }
                        else if (countLocation.Count() == 3)
                        {
                            country = location.Split(',')[2];
                        }

                    }
                    catch { }

                }
                #endregion

                #region Industry
                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("\"", string.Empty).Replace("</strong>", string.Empty).Replace("&amp;", "&");
                        if (end.Contains("strong class"))
                        {
                            Industry = end.Split('>')[1];
                        }
                        else
                        {
                            Industry = end;
                        }
                    }
                }
                catch (Exception ex)
                {
                }

                if (string.IsNullOrEmpty(Industry))
                {
                    try
                    {
                        List<string> lstIndustry = HttpHelper.GetTextDataByTagAndAttributeName(stringSource, "dd", "industry");
                        if (lstIndustry.Count > 0)
                        {
                            Industry = lstIndustry[0].Replace(",", ":").Trim();
                        }
                    }
                    catch { }
                }
                #endregion Industry

                #region Connection
                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)
                {
                }

                if (string.IsNullOrEmpty(Connection))
                {
                    try
                    {
                        List<string> lstConnection = HttpHelper.GetTextDataByTagAndAttributeName(stringSource, "div", "member-connections");
                        if (lstConnection.Count > 0)
                        {
                            Connection = lstConnection[0].Replace(",", ":").Trim();
                        }
                    }
                    catch { }
                }
                #endregion Connection

                #region Recommendation

                try
                {
                    string RecomnedUrl = string.Empty;
                    try
                    {
                        int startindex = stringSource.IndexOf("endorsements?id=");
                        string start = stringSource.Substring(startindex);
                        int endIndex = start.IndexOf("\"mem_pic\":");
                        if (endIndex < 0)
                        {
                            endIndex = start.IndexOf(">");
                        }
                        RecomnedUrl = (start.Substring(0, endIndex).Replace(",", string.Empty).Replace("\"", string.Empty).Replace(":", string.Empty));

                    }
                    catch { }

                    string PageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/profile-v2-" + RecomnedUrl + ""));
                    string[] arrayRecommendedName = Regex.Split(PageSource, "headline");

                    if (arrayRecommendedName.Count() == 1)
                    {
                        arrayRecommendedName = Regex.Split(PageSource, "fmt__recommendeeFullName");
                    }

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

                    foreach (var itemRecomName in arrayRecommendedName)
                    {
                        try
                        {
                            if (!itemRecomName.Contains("Endorsements"))
                            {
                                string Heading = string.Empty;
                                string Name = string.Empty;

                                try
                                {

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

                                try
                                {
                                    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));
                                }
                                catch { }

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

                                ListRecommendationName.Add(Name + " : " + Heading);

                            }
                        }
                        catch { }

                    }

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

                }
                catch { }

                #endregion

                #region Following

                #endregion

                #region Experience
                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;
                        if (stringSource.Contains("title_highlight"))
                        {
                            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 { }
                                        if ((exp.Contains("strong class")) || (exp.Contains("highlight")) || (string.IsNullOrEmpty(exp)))
                                        {
                                            try
                                            {
                                                int startindex1 = itemGrps.IndexOf("\"title\":");
                                                string start1 = itemGrps.Substring(startindex1).Replace("\"title\":", string.Empty);
                                                int endIndex1 = start1.IndexOf(",");
                                                exp = (start1.Substring(0, endIndex1).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 { }
                            }

                        }
                        else
                        {
                            array = Regex.Split(stringSource, "<header>");
                            foreach (string tempItem in array)
                            {
                                try
                                {
                                    if (!tempItem.Contains("<!DOCTYPE html>"))
                                    {

                                        List<string> lstExp = objChilkat.GetDataTag(tempItem, "h4");
                                        List<string> lstComp = objChilkat.GetDataTag(tempItem, "h5");
                                        if (lstExp.Count > 0)
                                        {
                                            exp = lstExp[0];
                                        }
                                        if (lstComp.Count > 0)
                                        {
                                            comp = lstComp[0];
                                            if (string.IsNullOrEmpty(comp))
                                            {
                                                comp = lstComp[1];
                                            }
                                        }
                                        if (titlecurrent == string.Empty)
                                        {
                                            titlecurrent = lstExp[0];
                                        }

                                        if (companycurrent == string.Empty)
                                        {
                                            companycurrent = lstComp[0];
                                        }

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

                                    }
                                }
                                catch { }
                            }

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

                    }

                    catch { }

                    try
                    {
                        if (string.IsNullOrEmpty(titlecurrent))
                        {
                            int StartIndex = stringSource.IndexOf("trk=prof-0-ovw-curr_pos\">");
                            string Start = stringSource.Substring(StartIndex).Replace("trk=prof-0-ovw-curr_pos\">", string.Empty);
                            int EndIndex = Start.IndexOf("</a>");
                            string End = Start.Substring(0, EndIndex).Replace("</a>", string.Empty);
                            titlecurrent = End.Trim();
                        }
                    }
                    catch
                    { }

                }

                #endregion

                #region Group

                try
                {
                    string GroupUrl = string.Empty;
                    try
                    {
                        int startindex = stringSource.IndexOf("templateId\":\"profile_v2_connections");
                        string start = stringSource.Substring(startindex);
                        //int endIndex = start.IndexOf("vsrp_people_res_name");
                        int endIndex = start.IndexOf("}");
                        GroupUrl = (start.Substring(0, endIndex).Replace(",", string.Empty).Replace("\"", string.Empty).Replace("templateId:profile_v2_connectionsurl:", string.Empty));

                    }
                    catch { }

                    string PageSource = HttpHelper.getHtmlfromUrl1(new Uri(GroupUrl));

                    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 item in ListGroupName)
                    {
                        if (groupscollectin == string.Empty)
                        {
                            groupscollectin = item;
                        }
                        else
                        {
                            groupscollectin += "  -  " + item;
                        }
                    }

                }
                catch { }

                if (string.IsNullOrEmpty(groupscollectin))
                {
                    List<string> lstGroupData = new List<string>();
                    string[] array1 = Regex.Split(stringSource, "link_groups_settings\":?");
                    array1 = array1.Skip(1).ToArray();
                    foreach (string item in array1)
                    {
                        string _item = Utils.getBetween(item, "name\":", ",").Replace("name\":", "").Replace(":", "").Replace("\"", "");
                        lstGroupData.Add(_item);
                    }

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

                if (string.IsNullOrEmpty(groupscollectin))
                {
                    List<string> lstGroupData = new List<string>();
                    string tempResponse = Utils.getBetween(stringSource, "<div id=\"groups\"", "<div>");
                    lstGroupData = HttpHelper.GetDataTag(tempResponse, "strong");

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

                #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 item in strarr_skill)
                        {
                            try
                            {
                                if (!item.Contains("!DOCTYPE html"))
                                {
                                    try
                                    {
                                        //string Grp = item.Substring(item.IndexOf("<"), (item.IndexOf(">", item.IndexOf("<")) - item.IndexOf("<"))).Replace("<", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("\"u002", "-").Trim();
                                        string Grp = item.Substring(item.IndexOf(">"), (item.IndexOf("<", item.IndexOf(">")) - item.IndexOf(">"))).Replace(">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("\"u002", "-").Trim();
                                        checkgrplist.Add(Grp);
                                        checkgrplist.Distinct().ToList();
                                    }
                                    catch { }
                                }

                            }
                            catch { }
                        }

                        foreach (string item in checkgrplist)
                        {
                            if (string.IsNullOrEmpty(Skill))
                            {
                                Skill = item.Replace("\"u002", "-").Trim();
                            }
                            else
                            {
                                Skill = Skill + "  -  " + item;
                            }
                        }
                    }
                    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 item in checkgrplist)
                                {
                                    if (string.IsNullOrEmpty(Skill))
                                    {
                                        Skill = item;
                                    }
                                    else
                                    {
                                        Skill = Skill + "  -  " + item;
                                    }
                                }
                            }
                            catch (Exception ex)
                            {

                            }
                        }
                    }
                }
                catch (Exception ex)
                {

                }
                Skill = Skill.Replace("a href=\";edu", "").Trim();
                #endregion

                #region Pasttitle
                string[] pasttitles = Regex.Split(stringSource, "title_highlight");
                string pstTitlesitem = string.Empty;
                pasttitles = pasttitles.Skip(1).ToArray();
                foreach (string item in pasttitles)
                {
                    try
                    {

                        if (!item.Contains("<!DOCTYPE html>") && !item.Contains("Tip: You can also search by keyword"))
                        {

                            try
                            {
                                string[] Past_Ttl = Regex.Split(item, ",");
                                pstTitlesitem = Past_Ttl[0].Replace(":", string.Empty).Replace("\"", string.Empty).Replace("\\u002d", "-").Replace("&amp;", "&");
                            }
                            catch { }
                            if ((pstTitlesitem.Contains("strong class")) || (pstTitlesitem.Contains("highlight")) || (string.IsNullOrEmpty(pstTitlesitem)))
                            {
                                try
                                {
                                    int startindex1 = item.IndexOf("\"title\":");
                                    string start1 = item.Substring(startindex1).Replace("\"title\":", string.Empty);
                                    int endIndex1 = start1.IndexOf(",");
                                    pstTitlesitem = (start1.Substring(0, endIndex1).Replace("\"", string.Empty).Replace(":", string.Empty).Replace("&amp", "&").Replace(";", string.Empty).Replace("\\u002d", "-").Replace("name:", string.Empty));
                                }
                                catch
                                { }
                            }

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

                        }

                    }
                    catch
                    {
                    }
                }
                #endregion

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

                            int startindex1 = item.IndexOf("summary_lb\":\"");
                            if (startindex > 0)
                            {
                                string start1 = item.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).Replace("\\", string.Empty).Replace("&#xf0a7;", "@").Replace("&#x2019;", "'").Replace("&#x2022", "@").Replace("&#x25cf;", "@");

                                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 AccountType
                try
                {
                    if (stringSource.Contains("has a Premium Account") || stringSource.Contains("Account Holder"))
                    {
                        AccountType = "Premium Account";
                    }
                    else
                    {
                        AccountType = "Basic Account";
                    }
                }
                catch (Exception ex)
                {

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

                    LDS_UserProfileLink = Url;
                    //  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 = SearchCriteria.LoginID;
                if (string.IsNullOrEmpty(firstname))
                {
                    firstname = "Linkedin Member";
                }

                string endName = firstname + " " + lastname;
                //GroupStatus.GroupSpecMem.Add(GroupMemId, endName);
                if (firstname == string.Empty) firstname = "LinkedIn";
                if (lastname == string.Empty) lastname = "Member";
                if (Company == string.Empty) Company = "--";
                if (titlecurrent == string.Empty) titlecurrent = "--";
                if (companycurrent == string.Empty) companycurrent = "--";
                if (LDS_Desc_AllComp == string.Empty) LDS_Desc_AllComp = "--";
                if (LDS_BackGround_Summary == string.Empty) LDS_BackGround_Summary = "--";
                if (Connection == string.Empty) Connection = "--";
                if (recomandation == string.Empty) recomandation = "--";
                if (Skill == string.Empty) Skill = "--";
                if (LDS_Experience == string.Empty) LDS_Experience = "--";
                if (EducationCollection == string.Empty) EducationCollection = "--";
                if (groupscollectin == string.Empty) groupscollectin = "--";
                if (USERemail == string.Empty) USERemail = "--";
                if (LDS_UserContact == string.Empty) LDS_UserContact = "--";
                if (LDS_PastTitles == string.Empty) LDS_PastTitles = "--";
                if (AllComapny == string.Empty) AllComapny = "--";
                if (location == string.Empty) location = "--";
                if (country == string.Empty) country = "--";
                if (Industry == string.Empty) Industry = "--";
                if (Website == string.Empty) Website = "--";

                string LDS_FinalData = TypeOfProfile + "," + LDS_UserProfileLink + "," + firstname + "," + lastname + "," + Company.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + companycurrent.Replace(",", ";") + "," + CurrentCompSite.Replace(",", ";") + "," + 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(",", ";") + "," + location.Replace(",", ";") + "," + country.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + Website.Replace(",", ";") + "," + LDS_LoginID + "," + AccountType;

                if (!string.IsNullOrEmpty(firstname))
                {
                    //Log("[ " + DateTime.Now + " ] => [ Data : " + LDS_FinalData + " ]");
                }
                else
                {
                    AddToLogger("[ " + DateTime.Now + " ] => [ No Data For URL : " + Url + " ]");
                    GlobusFileHelper.AppendStringToTextfileNewLineWithCarat(Url, Globals.DesktopFolder + "\\UnScrapedList.txt");
                }

                if (SearchCriteria.starter)
                {
                    //string tempFinalData = LDS_FinalData.Replace(";", "").Replace(LDS_UserProfileLink, "").Replace(TypeOfProfile, "").Replace(",", "").Replace(LDS_LoginID, "").Trim();

                    //if (!string.IsNullOrEmpty(tempFinalData))
                    {
                        //if (CheckEmployeeScraper)
                        //{
                        //    string FileName = "CompanyEmployeeScraper";
                        //    AppFileHelper.AddingLinkedInDataToCSVFileCompanyEmployeeScraper(LDS_FinalData, FileName);
                        //    return true;
                        //}
                        //else if (CampaignScraper)
                        {
                            AppFileHelper.AddingLinkedInDataToCSVFile(LDS_FinalData, FileName);
                            return true;
                        }
                        //else
                        //{
                        //    AppFileHelper.AddingLinkedInDataToCSVFile(LDS_FinalData, SearchCriteria.FileName);
                        //    return true;
                        //}
                    }
                }
            }
            catch { }
            return false;
        }
        public void ParsingOfInBoardProGetDataMultipleInput(ref GlobusHttpHelper HttpHelper, string username, string password, string proxyaddress, string proxyport, string proxyUserName, string proxypassword, string postalcode, string distance, string industry, string lastname)
        {
            try
            {
                string csrfToken = string.Empty;
                string LastName = string.Empty;
                string FirstName = string.Empty;
                string Industry = string.Empty;
                string Postalcode = string.Empty;
                string Distance = string.Empty;
                string contentSummary = string.Empty;
                string Title = string.Empty;
                string Company = string.Empty;
                string school = string.Empty;
                string Country = string.Empty;
                string countrycode = string.Empty;
                string industrycode = string.Empty;
                string UserName = string.Empty;
                List<String> LstUrlrecords = new List<string>();
                LastName = lastname;
                Industry = industry;
                UserName = username;
                this.accountUser = username;
                this.accountPass = password;
                this.proxyAddress = proxyaddress;
                this.proxyPort = proxyport;
                this.proxyUserName = proxyUserName;
                this.proxyPassword = proxypassword;
                this.postalCode = postalcode;
                this.distance = distance;
                this.industryType = industry;
                this.lastName = lastname;
                string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));

                try
                {
                    string[] Arr_Pst = Regex.Split(postalCode, "{");
                    try
                    {
                        Postalcode = postalCode.Substring(0, postalCode.IndexOf(" "));
                        Country = postalCode.Replace(Postalcode, string.Empty).Replace(")", string.Empty).Replace("(", string.Empty).Trim();
                    }
                    catch
                    {
                        if (Postalcode == "")
                        {
                            Postalcode = postalCode;
                        }

                        Country = postalCode.Replace(Postalcode, string.Empty).Replace(")", string.Empty).Replace("(", string.Empty).Trim();
                    }
                }
                catch { }
                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", ":");
                }
                InBoardPro.GetIndustryCode objIndustry = new GetIndustryCode();
                Dictionary<string, string> Dict_IndustryCode = new Dictionary<string, string>();
                Dict_IndustryCode = objIndustry.getIndustry();
                foreach (KeyValuePair<string, string> item in Dict_IndustryCode)
                {
                    try
                    {
                        string toloweritem = item.Value.ToLower();
                        string tolowerindustrytype = industryType.ToLower();
                        if (toloweritem == tolowerindustrytype)
                        {
                            industrycode = item.Key;
                            break;
                        }
                    }
                    catch
                    {
                    }
                }

                Dictionary<string, string> Dict_CountryCode = new Dictionary<string, string>();
                Dict_CountryCode = objIndustry.getCountry();
                foreach (KeyValuePair<string, string> item in Dict_CountryCode)
                {
                    try
                    {
                        string toloweritem = item.Value.ToLower();
                        string tolowercountrytype = Country.ToLower();
                        if (toloweritem == tolowercountrytype)
                        {
                            countrycode = item.Key;
                            break;
                        }
                    }
                    catch
                    {
                    }
                }
                string Firstresponse = string.Empty;
                if (string.IsNullOrEmpty(countrycode))
                {
                    countrycode = "us";
                }
                try
                {
                    string FirstPostUrl = "http://www.linkedin.com/search/fpsearch";
                    string FirstPostData = "csrfToken=" + csrfToken + "&keepFacets=true&pplSearchOrigin=ADVS&keywords=&fname=" + FirstName + "&lname=" + lastName + "&searchLocationType=I&countryCode=" + countrycode + "&postalCode=" + Postalcode + "&distance=" + distance + "&title=" + Title + "&company=" + Company + "&school=" + school + "&facet_I=" + industrycode + "&N=&L=&sortCriteria=R&viewCriteria=2&%2Fsearch%2Ffpsearch=Search";
                    Firstresponse = HttpHelper.postFormData(new Uri(FirstPostUrl), FirstPostData);
                }
                catch { }
                string FirstGetRequestUrl = string.Empty;
                string FirstGetResponse = string.Empty;
                try
                {
                    FirstGetRequestUrl = "http://www.linkedin.com/search/fpsearch?lname=" + LastName + "&searchLocationType=I&countryCode=" + countrycode + "&postalCode=" + Postalcode + "&distance=" + distance + "&keepFacets=keepFacets&page_num=1&facet_I=" + industrycode + "&pplSearchOrigin=ADVS&viewCriteria=2&sortCriteria=R&redir=redir";
                    FirstGetResponse = HttpHelper.getHtmlfromUrl1(new Uri(FirstGetRequestUrl));
                }
                catch { }
                int RecordCount = 0;
                try
                {
                    RecordCount = objIndustry.GetPageNo(Firstresponse);
                }
                catch { }

                try
                {
                    LstUrlrecords = ScarppLinkedinDataByPageNumber(RecordCount, ref HttpHelper, Firstresponse, industrycode, Postalcode, countrycode);
                    LstUrlrecords = LstUrlrecords.Distinct().ToList();
                }
                catch { }
                List<string> lstshorturl = new List<string>();
                foreach (string itemurl in LstUrlrecords)
                {
                    try
                    {
                        lstshorturl.Add(itemurl);
                    }
                    catch { }

                }
                lstshorturl = lstshorturl.Distinct().ToList();

                LinkedinScrappDbManager objLsManager = new LinkedinScrappDbManager();
                int count = 1;
                foreach (string LinkUrl in LstUrlrecords)
                {
                    try
                    {

                        //string[] LinkUrll=Regex.Split(LinkUrl, "&authType");
                        objLsManager.InsertIntoLinkedInSearchUrlResult(postalCode, distance, industryType, lastName, accountUser, accountPass, proxyAddress, proxyPassword, RecordCount, LinkUrl);
                        Log("[ " + DateTime.Now + " ] => [ " + count + "Url Record Insert In Table ! ]");
                        count++;
                    }
                    catch { }

                }

                foreach (string LinkUrlParse in LstUrlrecords)
                {
                    lock (locker_pauseDialog)
                    {
                        try
                        {
                            CrawlingLinkedInPage(LinkUrlParse, ref HttpHelper);
                            objLsManager.Updatetb_LinkedinSearchUrlResult(postalCode, distance, industryType, lastName, accountUser, accountPass, proxyAddress, proxyPassword, RecordCount, LinkUrlParse);
                            counterforpause++;
                            if (counterforpause <= processNumber)
                            {

                            }
                            else
                            {

                                if (autopause)
                                {
                                    DialogResult dlgResult = MessageBox.Show("Do you want to continue?", "Continue?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                                    if (dlgResult == DialogResult.Yes)
                                    {
                                        foreach (Thread itempause in lstNumberOfThreads)
                                        {
                                            try
                                            {
                                                itempause.Resume();
                                            }
                                            catch { }
                                        }
                                        Log("[ " + DateTime.Now + " ] => [ PROCESS START ]");
                                        counterforpause = 1;
                                    }
                                    else if (dlgResult == DialogResult.No)
                                    {
                                      {
                                            foreach (Thread item in lstNumberOfThreads)
                                            {
                                                try
                                                {
                                                    item.Abort();
                                                }
                                                catch { }
                                            }
                                            Log("[ " + DateTime.Now + " ] => [ PROCESS STOP ]");
                                            counterforpause = 1;
                                       }

                                    }

                                }

                                if (autopauseandresume)
                                {
                                    try
                                    {

                                        try
                                        {
                                            int delayInSeconds = RandomNumberGenerator.GenerateRandom(Mindelay * 1000, Maxdelay * 1000);
                                            Log("[ " + DateTime.Now + " ] => [ Delaying for " + delayInSeconds / 1000 + " Seconds ]");
                                            Thread.Sleep(delayInSeconds);

                                        }
                                        catch { }
                                        counterforpause = 1;
                                    }
                                    catch { }
                               }
                            }
                        }
                        catch { }
                    }
                }
            }
            catch { }

            finally
            {
                Log("[ " + DateTime.Now + " ] => [ PROCESS COMPLETE ]");
            }
        }
Example #7
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 { }
        }
Example #8
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 { }
        }
Example #9
0
        public void ScrapeFriendsGroup(ref GlobusHttpHelper HttpHelper, List<string> FriendsProfileIDs, string username)
        {
            try
            {
                string MainUrl = string.Empty;

                FriendsProfileIDs = FriendsProfileIDs.Distinct().ToList();

                foreach (var friendID in FriendsProfileIDs)
                {
                    try
                    {
                        MainUrl = "http://www.linkedin.com/profile/view?id=" + friendID;
                        string pageSourceforGroup = HttpHelper.getHtmlfromUrl1(new Uri(MainUrl));

                        if (pageSourceforGroup.Contains("Your address book is currently unavailable. Please check again later"))
                        {
                            Logger("[ " + DateTime.Now + " ] => [ Your address book is currently unavailable. Please check again later ! ]");
                            Logger("[ " + DateTime.Now + " ] => [ Please Wait for sometimes ! ]");
                            System.Threading.Thread.Sleep(1 * 60 * 1000);

                            pageSourceforGroup = HttpHelper.getHtmlfromUrl1(new Uri(MainUrl));
                        }

                        if (pageSourceforGroup.Contains("You and this LinkedIn user don’t know anyone in common") || pageSourceforGroup.Contains("You and this LinkedIn user don&#8217;t know anyone in common"))
                        {
                            Logger("[ " + DateTime.Now + " ] => [ You and this LinkedIn user don’t know anyone in common With Profile URL >>> " + "http://www.linkedin.com/profile/view?id=" + friendID + " ]");
                            continue;
                        }

                        string[] RgxGroupDataforGroup = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "link_groupRegistration");
                        string[] RgxGroupDataName = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "fmt__profileUserFullName");

                        #region CodeChabgeBysanjeev
                        string MemberName = string.Empty;
                        try
                        {
                            int startIndex = pageSourceforGroup.IndexOf("<span class=\"full-name\">");
                            string start = pageSourceforGroup.Substring(startIndex).Replace("<span class=\"full-name\">", string.Empty);
                            int endIndex = start.IndexOf("</span>");
                            string end = start.Substring(0, endIndex).Replace("</span>", string.Empty);
                            MemberName = end.Trim();

                            //MemberName = pageSourceforGroup.Substring(pageSourceforGroup.IndexOf("<span class=\"full-name\">"), (pageSourceforGroup.IndexOf("</span>", pageSourceforGroup.IndexOf("fmt__profileUserFullName")) - pageSourceforGroup.IndexOf("<span class=\"full-name\">"))).Replace("<span class=\"full-name\">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(":", string.Empty).Trim();
                            //MemberName = MemberName.Replace(" ", "-");
                        }
                        catch { }

                        if (RgxGroupDataforGroup.Count() < 2)
                        {
                            try
                            {
                                pageSourceforGroup = 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=" + friendID + "&locale=&snapshotID=&authToken=&authType=name&invAcpt=&notContactable=&primaryAction=&isPublic=false&sfd=true&_=1366115853014"));

                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine("Error >>> " + ex.StackTrace);
                            }
                        }
                        if (pageSourceforGroup.Contains("link_groupRegistration"))
                        {
                            RgxGroupDataforGroup = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "link_groupRegistration");
                            RgxGroupDataName = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "class=\"full-name\">");

                            foreach (string item in RgxGroupDataforGroup)
                            {
                                string GroupUrl = string.Empty;
                                string GroupNames = string.Empty;
                                string GroupIds = string.Empty;

                                try
                                {
                                    if (!item.Contains("<!DOCTYPE html>") && item.Contains("\"name\":\""))
                                    {
                                        try
                                        {
                                            GroupNames = item.Substring(item.IndexOf("\"name\":\""), (item.IndexOf("\",\"", item.IndexOf("\"name\":\"")) - item.IndexOf("\"name\":\""))).Replace("\"name\":\"", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();

                                        }
                                        catch { }

                                        try
                                        {
                                            //int startindex = item.IndexOf("groups?gid=");
                                            //if (startindex > 0)
                                            //{
                                            //    string start = item.Substring(startindex).Replace("groups?gid=","&");
                                            //    int endindex = start.IndexOf("&");
                                            //    string end = start.Substring(0, endindex);
                                            //    GroupIds = end;

                                            //}
                                            GroupIds = getBetween(item, "groups?gid=", "&");
                                        }
                                        catch { }

                                        if (string.IsNullOrEmpty(GroupIds))
                                        {
                                            try
                                            {
                                                GroupIds = item.Substring(item.IndexOf("groupRegistration?gid="), (item.IndexOf("&", item.IndexOf("groupRegistration?gid=")) - item.IndexOf("groupRegistration?gid="))).Replace("groupRegistration?gid=", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("&amp", "").Trim();

                                            }
                                            catch { }
                                        }

                                        if (string.IsNullOrEmpty(GroupIds))
                                        {
                                            try
                                            {
                                                //GroupIds = item.Substring(item.IndexOf("groupRegistration?gid="), (item.IndexOf("&", item.IndexOf("groupRegistration?gid=")) - item.IndexOf("groupRegistration?gid="))).Replace("groupRegistration?gid=", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("&amp", "").Trim();
                                                int startIndex = item.IndexOf("groupRegistration?gid=");
                                                string start = item.Substring(startIndex);
                                                int endIndex = start.IndexOf("&");
                                                string end = start.Substring(0, endIndex).Replace("&", string.Empty);
                                                GroupIds = end.Trim();
                                            }
                                            catch { }
                                        }

                                        GroupUrl = "http://www.linkedin.com/groups?gid=" + GroupIds;

                                        try
                                        {
                                            #region Data Saved In CSV File

                                            if (!string.IsNullOrEmpty(GroupNames))
                                            {
                                                try
                                                {
                                                    string CSVHeader = "GroupUrl" + "," + "GroupName" + "," + "FriendName" + "," + "SearchByID";
                                                    string CSV_Content = GroupUrl.Replace(",", ";") + "," + GroupNames.Replace(",", ";") + "," + MemberName.Replace(",", ";") + "," + username;
                                                    CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_LinkedinFriendsGroupScraper);
                                                    Logger("[ " + DateTime.Now + " ] => [ GroupUrl: " + GroupUrl + " ]");
                                                    Logger("[ " + DateTime.Now + " ] => [ GroupName: " + GroupNames + " ]");
                                                    Logger("[ " + DateTime.Now + " ] => [ FriendName: " + MemberName +" ]");
                                                    Logger("[ " + DateTime.Now + " ] => [ SearchByID: " + username + " ]");
                                                    Logger("[ " + DateTime.Now + " ] => [ Data Saved In CSV File ! ]");

                                                }
                                                catch { }

                                            }
                                            #endregion
                                        }
                                        catch { }
                                    }
                                }
                                catch { }
                            }
                        }
                        else
                        {
                            RgxGroupDataforGroup = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "link_media");
                            RgxGroupDataName = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "class=\"full-name\">");

                            foreach (string item in RgxGroupDataforGroup)
                            {
                                string GroupUrl = string.Empty;
                                string GroupNames = string.Empty;
                                string GroupIds = string.Empty;

                                try
                                {
                                    if (!item.Contains("<!DOCTYPE html>") && item.Contains("\"name\":\""))
                                    {
                                        try
                                        {
                                            //GroupNames = item.Substring(item.IndexOf("\"name\":\""), (item.IndexOf("\",\"", item.IndexOf("\"name\":\"")) - item.IndexOf("\"name\":\""))).Replace("\"name\":\"", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
                                            int startindex = item.IndexOf("\"name\"");
                                            string start = item.Substring(startindex).Replace("\"name\"",string.Empty).Replace(":", string.Empty);
                                            int endindex = start.IndexOf(",");
                                            string end = start.Substring(0, endindex).Replace("\"",string.Empty);
                                            GroupNames = end.Trim();
                                        }
                                        catch { }

                                        try
                                        {
                                                int startindex1 = item.IndexOf("\"groupID\"");
                                                string start = item.Substring(startindex1).Replace("\"groupID\"",string.Empty).Replace(":", string.Empty);
                                                int endindex = start.IndexOf(",");
                                                string end = start.Substring(0, endindex);
                                                GroupIds = end.Trim();

                                        }
                                        catch { }

                                        if (string.IsNullOrEmpty(GroupIds))
                                        {
                                            try
                                            {
                                                GroupIds = item.Substring(item.IndexOf("groupRegistration?gid="), (item.IndexOf("&", item.IndexOf("groupRegistration?gid=")) - item.IndexOf("groupRegistration?gid="))).Replace("groupRegistration?gid=", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("&amp", "").Trim();

                                            }
                                            catch { }
                                        }

                                        GroupUrl = "http://www.linkedin.com/groups?gid=" + GroupIds;

                                        try
                                        {
                                            #region Data Saved In CSV File

                                            if (!string.IsNullOrEmpty(GroupNames))
                                            {
                                                try
                                                {
                                                    string CSVHeader = "GroupUrl" + "," + "GroupName" + "," + "FriendName" + "," + "SearchByID";
                                                    string CSV_Content = GroupUrl.Replace(",", ";") + "," + GroupNames.Replace(",", ";") + "," + MemberName.Replace(",", ";") + "," + username;
                                                    CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_LinkedinFriendsGroupScraper);
                                                    Logger("[ " + DateTime.Now + " ] => [ GroupUrl: " + GroupUrl.Replace(",", ";") + " ]");
                                                    Logger("[ " + DateTime.Now + " ] => [ GroupName: " + GroupNames.Replace(",", ";") + " ]");
                                                    Logger("[ " + DateTime.Now + " ] => [ FriendName: " + MemberName.Replace(",", ";") + " ]");
                                                    Logger("[ " + DateTime.Now + " ] => [ SearchByID: " + username + " ]");
                                                    Logger("[ " + DateTime.Now + " ] => [ Data Saved In CSV File ! ]");

                                                }
                                                catch { }

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

            }
            catch (Exception ex)
            {

            }
        }
Example #10
0
        public string FromEmailCodeComposeMsg(ref GlobusHttpHelper HttpHelper, string email)
        {
            string FromId = string.Empty;
            //string FromNm = string.Empty;
            string namewithid = string.Empty;
            string pageSource = string.Empty;
            string[] RgxGroupData = new string[] { };

            if (string.IsNullOrEmpty(namewithid))
            {
                try
                {

                    pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/inbox/compose?trk=inbox_messages-comm-left_nav-compose"));
                    RgxGroupData = Regex.Split(pageSource, "\"name\":\"senderEmail\"");

                    try
                    {
                        if (RgxGroupData[1].Contains("\"value\":"))
                        {
                            try
                            {
                                int StartIndex = RgxGroupData[1].IndexOf("\"value\":");
                                string start = RgxGroupData[1].Substring(StartIndex);
                                int endIndex = start.IndexOf(",");
                                FromId = start.Substring(0, endIndex).Replace("\"", string.Empty).Replace("value:", string.Empty).Replace("}", string.Empty).Trim();

                            }
                            catch
                            {
                            }

                            //try
                            //{
                            //    int StartIndex1 = RgxGroupData[1].IndexOf("label\":");
                            //    string start = RgxGroupData[1].Substring(StartIndex1);
                            //    int endIndex1 = start.IndexOf("<");
                            //    FromNm = start.Substring(0, endIndex1).Replace("\"", string.Empty).Replace("label:", string.Empty).Trim();

                            //}
                            //catch
                            //{
                            //}

                        }

                        //namewithid = FromId + ":" + FromNm;
                        namewithid = FromId;

                    }
                    catch { }

                }
                catch (Exception ex)
                {
                    return namewithid;
                }
            }

            return namewithid;
        }
Example #11
0
        public void SendInvitation(ref GlobusHttpHelper HttpHelper, string grpURL, string grpId)
        {
            try
            {
                string FString = string.Empty;
                string Nstring = string.Empty;
                string connId = string.Empty;
                string FullName = string.Empty;
                string ToMsg = string.Empty;
                string ContactName = string.Empty;

                string URL = "http://www.linkedin.com/manageGroup?dispAddMbrs=&gid=" + grpId + "&invtActn=im-invite&cntactSrc=cs-connections";

                string grpPageSource = HttpHelper.getHtmlfromUrl1(new Uri(URL));

                //string csrfToken = GetCsrfToken(grpPageSource);
                try
                {
                    int startindex = grpPageSource.IndexOf("csrfToken=");
                    string start = grpPageSource.Substring(startindex).Replace("csrfToken=",string.Empty);
                    int endindex = start.IndexOf("\"");
                    string end = start.Substring(0, endindex).Replace("\"", string.Empty);
                    csrfToken = end.Trim();
                }
                catch
                { }
                ClsLinkedinMain clsLinkedinMain = new ClsLinkedinMain();
                Dictionary<string, string> dTotalFriends = clsLinkedinMain.PostAddMembers(ref HttpHelper, accountUser);

                // To manage the code for friends in which invitation already sent

                // SucessfullySendInvitationToFriend();

                //int counter = 1;

                foreach (KeyValuePair<string, string> itemChecked in dTotalFriends)
                {
                    try
                    {
                        //if (!IsAllAccounts)
                        //{
                        //    if (counter > 50)
                        //    {
                        //        break;
                        //    }
                        //}

                        //counter++;

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

                        FName = itemChecked.Value.Split(' ')[0];
                        Lname = itemChecked.Value.Split(' ')[1];

                        FullName = FName + " " + Lname;
                        try
                        {
                            ContactName = ContactName + "  :  " + FullName;
                        }
                        catch { }
                        if (ToMsg == string.Empty)
                        {
                            ToMsg += FullName;
                        }
                        else
                        {
                            ToMsg += ";" + FullName;
                        }

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

                        string ToCd = itemChecked.Key;

                        if (ToCd.Contains(":"))
                        {
                            try
                            {
                                ToCd = ToCd.Substring(ToCd.IndexOf(":"), ToCd.Length - ToCd.IndexOf(":")).Replace(":", string.Empty).Trim();
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine("Error >>> " + ex.StackTrace);
                            }

                        }

                        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;
                            connId += " " + ToCd;
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("ex.Message >>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + "  ex.Stack Trace >>> " + ex.StackTrace);
                    }

                    //}
                    Nstring += "}";

                    string postData = "csrfToken=" + csrfToken + "&emailRecipients=&subAddMbrs=Send+Invitations&gid=" + grpId + "&invtActn=im-invite&cntactSrc=cs-connections&remIntives=999&connectionIds=" + connId + "&connectionNames=" + Uri.EscapeUriString(Nstring) + "&contactIDs=&newGroup=false";

                    string response = HttpHelper.postFormData(new Uri("http://www.linkedin.com/manageGroup"), postData);

                    //if (response.Contains("You have successfully sent invitations to this group") || response.Contains("Upgrade Your Account"))
                        if (response.Contains("You have successfully sent invitations to this group"))
                    {
                        Log("[ " + DateTime.Now + " ] => [ You have successfully sent invitations to Group : " + grpURL + " With Username : "******"Invite user : "******" ]");
                        string CSVHeader = "GroupUrl" + "," + "UserName" + "," + "Invite User" ;
                        string CSVContent = grpURL + "," + accountUser + "," + FullName;
                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSVContent, Globals.path_SentInvitationGroup);
                       // GlobusFileHelper.AppendStringToTextfileNewLine(content, Globals.path_SentInvitationGroup);

                    }
                    else
                    {
                        Log("[ " + DateTime.Now + " ] => [ Couldn't Send Invitation With Username : "******" ]");
                        string CSVHeader = "GroupUrl" + "," + "UserName";
                        string CSVContent = grpURL + "," + accountUser;
                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSVContent, Globals.path_NotSentInvitationGroup);
                        //GlobusFileHelper.AppendStringToTextfileNewLine(content, Globals.path_NotSentInvitationGroup);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error >>> " + ex.StackTrace);
            }
        }
Example #12
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
            {
            }
        }
Example #13
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)
            {
            }
        }
Example #14
0
        public void LoginHttpHelper(ref GlobusHttpHelper HttpHelper, string userName, string password, string Proxyaddress, string ProxyUserName, string ProxyPass, string port)
        {
            try
            {
                this.accountUser = userName;
                this.accountPass = password;
                this.proxyAddress = Proxyaddress;
                this.proxyPassword = ProxyPass;
                this.proxyUserName = ProxyUserName;
                this.proxyPort = port;
                Log("[ " + DateTime.Now + " ] => [ Logging In With : " + accountUser + " ]");
                Log("[ " + DateTime.Now + " ] => [ Login Process is Running... ]");
                Url = "https://www.linkedin.com/";
                string pageSrcLogin = string.Empty;
                if (string.IsNullOrEmpty(proxyPort))
                {
                    proxyPort = (0).ToString();
                }
                pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, Convert.ToInt32(proxyPort), proxyUserName, proxyPassword);

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

                if (pageSrcLogin.Contains("csrfToken"))
                {
                    int startCsrfToken = pageSrcLogin.IndexOf("name=\"csrfToken\"");
                    if (startCsrfToken > 0)
                    {
                        string startcsrfToken = pageSrcLogin.Substring(startCsrfToken).Replace("name=\"csrfToken\"", "").Replace("value=\"", "");
                        int endCsrfToken = startcsrfToken.IndexOf("\"");
                        string endcsrftoken = startcsrfToken.Substring(0, endCsrfToken);
                        csrfToken = endcsrftoken.Replace(@"\", string.Empty).Replace("//", string.Empty).Replace(" ", "");
                    }
                }

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

                postUrl = "https://www.linkedin.com/uas/login-submit";
                postdata = "session_key=" + accountUser + "&session_password="******"&source_app=&trk=guest_home_login&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;

                //ResLogin = HttpHelper.postFormData(new Uri(postUrl), postdata);

                ResLogin = HttpHelper.postFormDataProxy(new Uri(postUrl), postdata, proxyAddress, int.Parse(proxyPort), proxyUserName, proxyPassword);

                if (ResLogin.Contains("Sign Out") && ResLogin.Contains("class=\"signout\""))
                {
                    IsLoggedIn = true;
                    Log("[ " + DateTime.Now + " ] => [ Logged In With Account : " + accountUser + " ]");
                    string Search = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/search?trk=advsrch"));
                    SearchCriteria.loginREsponce = Search;
                }

                #region MyRegion
                //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);
                #endregion
            }
            catch (Exception ex)
            {

            }
        }
        private void CrawlingLinkedInPage(string Url, ref GlobusHttpHelper HttpHelper)
        {
            //Log("Start Parsing Process");
            //  Workbooks myExcelWorkbooks = ClsExcelData.myExcelWorkbooks;
            #region Data Initialization
            string GroupMemId = string.Empty;
            string Industry = string.Empty;
            string URLprofile = string.Empty;
            string firstname = string.Empty;
            string lastname = string.Empty;
            string location = string.Empty;
            string state = 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 html = 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 website1 = string.Empty;

            string titleCurrenttitle = string.Empty;
            string titleCurrenttitle2 = string.Empty;
            string titleCurrenttitle3 = string.Empty;
            string titleCurrenttitle4 = string.Empty;
            string Skill = string.Empty;
            string LDS_HeadLineTitle = 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> Checklist = 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 Company = string.Empty;
            List<string> lstpasttitle = new List<string>();
            List<string> checkpasttitle = new List<string>();
            List<string>titleList = new List<string>();
            List<string> companyList = new List<string>();
            #endregion

            #region

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

            #endregion

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

            #region Name
            try
            {
                try
                {
                    int startindex = stringSource.IndexOf("<span class=\"full-name\">");
                    if (startindex > 0)
                    {
                        string start = stringSource.Substring(startindex).Replace("<span class=\"full-name\">",string.Empty);
                        int endindex = start.IndexOf("</span>");
                        string end = start.Substring(0, endindex);
                        strFamilyName = end.Trim();
                    }
                }
                catch
                { }
                if (string.IsNullOrEmpty(strFamilyName))
                {
                    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("fmt__full_name\":"), (stringSource.IndexOf(",", stringSource.IndexOf("fmt__full_name\":")) - stringSource.IndexOf("fmt__full_name\":"))).Replace("fmt__full_name\":", string.Empty).Replace("\\u002d", "-").Replace("\"", string.Empty).Replace(",", string.Empty).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 (Exception ex)
            {
                Console.WriteLine("Error >>> " + ex.StackTrace);
            }
            #endregion

            #region LastName

            lastname = NameArr[1];

            try
            {
                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

                try
                {

                        string[] cmpny = Regex.Split(stringSource, "trk=prof-exp-title' name='title' title='Find others with this title'>");
                        foreach (string item in cmpny)
                        {
                            try
                            {
                                try
                                {
                                    if (!item.Contains("<!DOCTYPE html>"))
                                    {
                                        int startindex = item.IndexOf("");
                                        string start = item.Substring(startindex);
                                        int endindex = start.IndexOf("</a>");
                                        string end = start.Substring(0, endindex).Replace("</a>", String.Empty);
                                        string titles = end.Trim();
                                        titleList.Add(titles);
                                        titleList = titleList.Distinct().ToList();
                                    }
                                }
                                catch
                                {

                                }
                            }
                            catch
                            { }
                        }

                    if (string.IsNullOrEmpty(Company))
                    {
                        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("\\u002d", "-").Replace("   ", string.Empty).Trim();
                        }
                        catch { }
                    }

                    if (string.IsNullOrEmpty(Company))
                    {

                        try
                        {
                            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("\\u002d", "-").Replace("   ", string.Empty).Replace("u002d",string.Empty).Trim();
                        }
                        catch { }

                    }

                    string[] strdesigandcompany = new string[4];
                    if (Company.Contains(" at "))
                    {
                        try
                        {
                            strdesigandcompany = Regex.Split(Company, " at ");
                        }
                        catch { }

                        #region Title
                        try
                        {
                            if(!string.IsNullOrEmpty(strdesigandcompany[0]))
                            titlecurrent = strdesigandcompany[0];
                        }
                        catch { }
                        //if (string.IsNullOrEmpty(titlecurrent))
                        //{
                        //    titlecurrent = titleList[0];
                        //}
                        #endregion

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

                    if (string.IsNullOrEmpty(titlecurrent))
                    {
                        titlecurrent = titleList[0];
                    }
                }
                catch { }

                #region PastCompany
                string[] companylist = new string[] { };
                string[] companyUrlList = new string[] { };

                try
                {
                    companylist = Regex.Split(stringSource, "title_highlight");
                }
                catch { }

                string AllComapny = string.Empty;

                string Companyname = string.Empty;
                string ComapnyUrl = string.Empty;
                foreach (string item in companylist)
                {
                    try
                    {
                        if (!item.Contains("<!DOCTYPE html>"))
                        {

                            try
                            {
                                int startindex = item.IndexOf("company_name");
                                string start = item.Substring(startindex);
                                int endIndex = start.IndexOf(",");
                                Companyname = (start.Substring(0, endIndex).Replace("\"", string.Empty).Replace(":", string.Empty).Replace("&amp", "&").Replace("company_name", string.Empty).Replace(";", string.Empty).Replace("\\u002d", "-").Replace("name:", string.Empty));

                                int startindex1 = item.IndexOf("biz_logo");
                                string start1 = item.Substring(startindex1);
                                int endIndex1 = start1.IndexOf("&trk");
                                ComapnyUrl = (start1.Substring(0, endIndex1).Replace("\"", string.Empty).Replace(":", string.Empty).Replace("&amp", "&").Replace("company_name", string.Empty).Replace(";", string.Empty).Replace("\\u002d", "-").Replace("name:", string.Empty).Replace("biz_logo","http://www.linkedin.com"));

                            }
                            catch { }

                            ////company_name":"Fathom: A Digital Marketing &amp; Analytics Agency","positionId":355409459
                            //Companyname = item.Substring(item.IndexOf("company_name"), (item.IndexOf(",", item.IndexOf(":")) - item.IndexOf(":"))).Replace(":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("]", string.Empty).Replace("}", string.Empty).Trim();
                            //string items = Companyname.Replace("company_name", string.Empty).Replace("positionId",string.Empty);
                            //checkerlst = checkerlst.Distinct().ToList();
                            checkerlst.Add(Companyname + "@" + ComapnyUrl);
                            checkerlst.Distinct().ToList();

                        }
                    }
                    catch { }
                }
                foreach (string item1 in checkerlst)
                {
                    try
                    {
                        string tempCompanylist = string.Empty;
                        tempCompanylist = item1.Split('@')[0];
                        companyList.Add(tempCompanylist);
                        companyList = companyList.Distinct().ToList();

                        #region Commented code
                        //string compUrl = item1.Split('@')[1];
                        //string stringSourceCompUrl = HttpHelper.getHtmlfromUrl1(new Uri(compUrl));
                        //string companyUrl = string.Empty;

                        //try
                        //{
                        //    companyUrl = stringSourceCompUrl.Substring(stringSourceCompUrl.IndexOf("<h4>Website</h4>"), (stringSourceCompUrl.IndexOf("</a>", stringSourceCompUrl.IndexOf("<h4>Website</h4>")) - stringSourceCompUrl.IndexOf("<h4>Website</h4>"))).Replace("<h4>Website</h4>", string.Empty).Replace("</a>", string.Empty).Trim();
                        //    companyUrl = Regex.Split(companyUrl,"target=\"_blank\">")[1];
                        //}
                        //catch { }

                        //if (AllComapny == string.Empty)
                        //{
                        //AllComapny = item1.Split('@')[0] + "@" + companyUrl;
                        //tempCompanylist = item1.Split('@')[0];
                        //companyList.Add(tempCompanylist);
                        //companyList.Distinct().ToList();
                        //}
                        //else
                        //{
                        //    //AllComapny = AllComapny + " : " + item1.Split('@')[0] + "@" + companyUrl;
                        //    tempCompanylist = AllComapny + " : " + item1.Split('@')[0];
                        //    companyList.Add(tempCompanylist);
                        //    companyList.Distinct().ToList();
                        //}
                        #endregion

                    }
                    catch { }
                }
                //if (string.IsNullOrEmpty(AllComapny) || AllComapny.Contains("<a href="))
                try
                {
                    string[] allCompany = Regex.Split(stringSource, "trk=prof-exp-company-name\" name=\"company\" title=\"Find others who have worked at this company\">");
                    foreach (string item in allCompany)
                    {
                        if (!item.Contains("<!DOCTYPE html>"))
                        {
                            try
                            {
                                int startindex = item.IndexOf("");
                                string start = item.Substring(startindex);
                                int endindex = start.IndexOf("</a>");
                                string end = start.Substring(0, endindex).Replace("</a>", string.Empty).Replace("<strong class=", string.Empty).Replace("</strong>", " ").Replace("\"highlight\"", string.Empty).Replace(">",string.Empty);
                                string companies = end.Trim();
                                companyList.Add(companies);
                                companyList = companyList.Distinct().ToList();
                            }
                            catch
                            {

                            }
                        }
                    }
                    string[] allcompany1 = Regex.Split(stringSource, "trk=prof-exp-company-name\">");
                    foreach (string item in allcompany1)
                    {
                        if (!item.Contains("<!DOCTYPE html>") && !item.Contains("<span data-tracking=\"mcp_profile_sum\""))
                        {
                            try
                            {
                                int startindex = item.IndexOf("");
                                string start = item.Substring(startindex);
                                int endindex = start.IndexOf("</a>");
                                string end = start.Substring(0, endindex).Replace("</a>", string.Empty);
                                string companies = end.Replace("&amp", "&").Trim();
                                companyList.Add(companies);
                                companyList = companyList.Distinct().ToList();
                            }
                            catch
                            {

                            }
                        }
                    }
                    if (Company.Contains("<span") || string.IsNullOrEmpty(Company))
                    {
                        int startindex = stringSource.IndexOf("<p class=\"title \">");
                        string Start = stringSource.Substring(startindex).Replace("<p class=\"title \">", string.Empty);
                        int EndIndex = Start.IndexOf("</p>");
                        string End = Start.Substring(0, EndIndex).Replace("</p>", string.Empty).Replace("<strong class=\"highlight\">", string.Empty).Replace("</strong>", string.Empty).Replace("&#39;","'");
                        Company = End.Trim();
                    }
                    if (companyList.Count > 0)
                    {
                        AllComapny = string.Empty;
                        foreach (string item1 in companyList)
                        {
                            try
                            {
                                if (string.IsNullOrEmpty(AllComapny))
                                {
                                    AllComapny = item1.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                                }
                                else
                                {
                                    AllComapny = AllComapny + " : " + item1.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                                }
                            }
                            catch
                            {

                            }
                        }
                    }

                }
                catch { }
                #endregion

            #endregion Company

            #region Education
                try
                {
                    string[] str_UniversityName = Regex.Split(stringSource, "link__school_name");
                    foreach (string item in str_UniversityName)
                    {
                        try
                        {
                            string School = string.Empty;
                            string Degree = string.Empty;
                            string SessionEnd = string.Empty;
                            string SessionStart = string.Empty;
                            string Education = string.Empty;

                            if (!item.Contains("<!DOCTYPE html>"))
                            {
                                try
                                {
                                    try
                                    {
                                        int startindex = item.IndexOf("fmt__school_highlight");
                                        string start = item.Substring(startindex).Replace("fmt__school_highlight", "");
                                        int endindex = start.IndexOf(",");
                                        School = start.Substring(0, endindex).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty);
                                    }
                                    catch { }

                                    try
                                    {
                                        int startindex1 = item.IndexOf("degree");
                                        string start1 = item.Substring(startindex1).Replace("degree", "");
                                        int endindex1 = start1.IndexOf(",");
                                        Degree = start1.Substring(0, endindex1).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty);
                                    }
                                    catch { }

                                    try
                                    {
                                        int startindex2 = item.IndexOf("enddate_my");
                                        string start2 = item.Substring(startindex2).Replace("enddate_my", "");
                                        int endindex2 = start2.IndexOf(",");
                                        SessionEnd = start2.Substring(0, endindex2).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty);
                                    }
                                    catch { }

                                    try
                                    {
                                        int startindex3 = item.IndexOf("startdate_my");
                                        string start3 = item.Substring(startindex3).Replace("startdate_my", "");
                                        int endindex3 = start3.IndexOf(",");
                                        SessionStart = start3.Substring(0, endindex3).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty);
                                    }
                                    catch { }

                                    if (SessionStart == string.Empty && SessionEnd == string.Empty)
                                    {
                                        Education = " [" + School + "] Degree: " + Degree;
                                    }
                                    else
                                    {
                                        Education = " [" + School + "] Degree: " + Degree + " Session: " + SessionStart + "-" + SessionEnd;
                                    }
                                    //University = item.Substring(item.IndexOf(":"), (item.IndexOf(",", item.IndexOf(":")) - item.IndexOf(":"))).Replace(":", string.Empty).Replace("\\u002d", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                                }
                                catch { }
                                EducationList.Add(Education);

                            }
                        }
                        catch { }
                    }

                    EducationList = EducationList.Distinct().ToList();

                    if (EducationList.Count == 0)
                    {
                        string[] uniName1 = Regex.Split(stringSource, "trk=prof-edu-school-name' title=");
                        foreach (string item in uniName1)
                        {
                            try
                            {
                                string School = string.Empty;
                                string Degree = string.Empty;
                                string SessionEnd = string.Empty;
                                string SessionStart = string.Empty;
                                string Education = string.Empty;
                                if (!item.Contains("<!DOCTYPE html>"))
                                {
                                    try
                                    {
                                        try
                                        {
                                            int startindex = item.IndexOf(">");
                                            string start = item.Substring(startindex);
                                            int endindex = start.IndexOf("</a>");
                                            School = start.Substring(0, endindex).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("\\t", string.Empty).Replace(">", string.Empty).Trim();
                                        }
                                        catch
                                        { }

                                        try
                                        {
                                            int startindex1 = item.IndexOf("degree");
                                            string start1 = item.Substring(startindex1).Replace("degree", "");
                                            int endindex1 = start1.IndexOf(",");
                                            Degree = start1.Substring(0, endindex1).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("_highlight", string.Empty).Replace(">", string.Empty);
                                            if (Degree.Contains("connection") || Degree.Contains("title") || Degree.Contains("firstName") || Degree.Contains("authToken"))
                                            {
                                                Degree = string.Empty;
                                            }

                                        }
                                        catch { }

                                        try
                                        {
                                            int startindex2 = item.IndexOf("<time datetime=");
                                            string start2 = item.Substring(startindex2).Replace("<time datetime=", string.Empty);
                                            int endindex2 = start2.IndexOf(">");
                                            SessionStart = start2.Substring(0, endindex2).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("'", string.Empty);
                                        }
                                        catch { }

                                        try
                                        {
                                            int startindex2 = item.IndexOf("</time><time datetime=");
                                            string start2 = item.Substring(startindex2).Replace("</time><time datetime=", string.Empty);
                                            int endindex2 = start2.IndexOf(">");
                                            SessionEnd = start2.Substring(0, endindex2).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty);
                                        }
                                        catch { }

                                        if (SessionStart == string.Empty && SessionEnd == string.Empty)
                                        {
                                            Education = " [" + School + "] Degree: " + Degree;
                                        }
                                        else
                                        {
                                            if (Degree == string.Empty)
                                            {
                                                Education = " [" + School + "] Session: " + SessionStart + "-" + SessionEnd;
                                            }
                                            else
                                            {
                                                Education = " [" + School + "] Degree: " + Degree + " Session: " + SessionStart + "-" + SessionEnd;
                                            }

                                        }
                                    }

                                    catch
                                    { }
                                    EducationList.Add(Education);

                                }
                            }
                            catch { }

                        }
                    }
                    foreach (string item in EducationList)
                    {
                        if (string.IsNullOrEmpty(EducationCollection))
                        {
                            EducationCollection = item.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                        }
                        else
                        {
                            EducationCollection = EducationCollection + "  -  " + item.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                        }
                    }
                    // string University1 = 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).Replace(":", string.Empty).Trim();

                }

                catch { }

                #endregion Education

            #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).Replace("\\u002d", "-").Trim();
                }

                catch { }
                if (string.IsNullOrEmpty(USERemail))
                {
                    try
                    {
                        int startindex = stringSource.IndexOf("Email:");
                        string start = stringSource.Substring(startindex).Replace("Email:", "");
                        int endindex = start.IndexOf("Phone");
                        string end = start.Substring(0, endindex).Replace("\u003cbr", "").Replace("\\u003cbr\\u003e", "").Replace("\\n", "").Replace(" ", "");
                        USERemail = end;
                    }
                    catch
                    {
                    }
                }

                #endregion Email

            #region Contact
                try
                {
                    int startindex = stringSource.IndexOf("Phone:");
                    string start = stringSource.Substring(startindex).Replace("Phone:", "");
                    int endindex = start.IndexOf("Skype");
                    string end = start.Substring(0, endindex).Replace("\\u003cbr\\u003e", "").Replace("\\u002d", "").Replace("\\n", "");
                    LDS_UserContact = end;
                }
                catch { }
                if (string.IsNullOrEmpty(LDS_UserContact))
                {
                    try
                    {
                        int startindex = stringSource.IndexOf("[{\"number\":\"");
                        string start = stringSource.Substring(startindex).Replace("[{\"number\":\"", "");
                        int endindex = start.IndexOf("\"}]");
                        string end = start.Substring(0, endindex).Replace("\\u003cbr\\u003e", "").Replace("\\u002d", "").Replace("\\n", "");
                        LDS_UserContact = end;

                    }
                    catch { }
                }

                #endregion

            #region Website

               #region Website
                //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).Replace("}", string.Empty).Trim();
                //}
                //catch { }
                string Web1 = string.Empty;
                List<string> Websites = new List<string>();
                try
                {
                    int startindex = stringSource.IndexOf("\"websites\":");
                    string start = stringSource.Substring(startindex).Replace("\"websites\":", "");
                    int endindex = start.IndexOf("\"showTencent\":");
                    string end = start.Substring(0, endindex).Replace("[{\"", string.Empty).Replace("{", string.Empty).Trim();
                    Web1 = end;
                }
                catch
                { }
                string[] web = Regex.Split(Web1, "\"URL\":\"");
                foreach (var items in web)
                {
                    /*     try
                         {
                             int startindex = stringSource.IndexOf("\"websites\":[{\"name\":\"");
                             string start = stringSource.Substring(startindex).Replace("\"websites\":[{\"name\":\"", "");
                             int endindex = start.IndexOf("\",\"");
                             string end = start.Substring(0, endindex);
                             Website = end;
                         }
                         catch
                         { }  */
                    //  if (string.IsNullOrEmpty(Website))

                    try
                    {
                        int startindex = items.IndexOf("");
                        string start = items.Substring(startindex).Replace("\"", "");
                        int endindex = start.IndexOf("}");
                        string end = start.Substring(0, endindex).Replace("\\u002d", string.Empty).Replace("URL:", string.Empty);
                        Website = end;
                    }
                    catch { }

                    //  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("\\u002d", string.Empty).Trim();
                    //  }
                    //  catch { }

                    try
                    {
                        if (Website.Contains("]") || Website.Contains("}") || Website.Contains("[") || Website.Contains("}"))
                        {
                            Website = Website.Replace("]", string.Empty).Replace("}", string.Empty).Replace("\\u002d", string.Empty).Replace("[", string.Empty).Replace("{", string.Empty).Trim();
                        }
                    }
                    catch { }
                    Websites.Add(Website);
                }
                string item2 = string.Empty;
                website1 = Websites[0];
                //foreach (var item in Websites)
                int size = Websites.Count;

                for (int i = 1; i <= size; i++)
                {
                    try
                    {
                        website1 += " - " + Websites[i];
                    }
                    catch { }
                }
                #endregion Website

            #endregion Website

            #region location
                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).Replace("\\u002d", "-").Trim();
                }
                catch { }
                // fmt_location

                if (string.IsNullOrEmpty(location))
                {
                    try
                    {
                        location = stringSource.Substring(stringSource.IndexOf("fmt_location\":"), (stringSource.IndexOf(",", stringSource.IndexOf("fmt_location\":")) - stringSource.IndexOf("fmt_location\":"))).Replace("fmt_location\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("\\u002d", "-").Trim();

                    }
                    catch { }
                }
                if (location == string.Empty)
                {
                    try
                    {
                        int startindex = stringSource.IndexOf("name='location' title=\"Find other members");
                        string start = stringSource.Substring(startindex).Replace("name='location' title=\"Find other members", string.Empty);
                        int startindex1 = start.IndexOf("\">");
                        string start1 = start.Substring(startindex1);
                        int endindex = start1.IndexOf("</a>");
                        string end = start1.Substring(0, endindex).Replace("\u002d", string.Empty).Replace("Å", "A").Replace("\\u002d", "-").Replace(">", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Replace("<strong class=",string.Empty).Replace("highlight",string.Empty).Replace("<strong",string.Empty);
                        location = end;
                    }
                    catch
                    { }
                }

                #endregion location

            #region state
                try
                {
                int startindexState = stringSource.IndexOf("location_highlight");
                string Statestart = stringSource.Substring(startindexState);
                int StateendIndex = Statestart.IndexOf("industry_highlight");
                state = (Statestart.Substring(0, StateendIndex).Replace("location_highlight",string.Empty).Replace(":",string.Empty).Replace("\"",string.Empty).Replace("deferImgtrue,",string.Empty));

                state = state.Split(',')[1].Replace("Area", string.Empty).Trim();
                }
                catch { }

                #endregion

            #region Country
                try
                {
                int startindexCountry = stringSource.IndexOf("displayCountry");
                string Countrystart = stringSource.Substring(startindexCountry);
                int CountryendIndex = Countrystart.IndexOf("displayLanguage");
                country = (Countrystart.Substring(0, CountryendIndex).Replace("displayCountry", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty));

                }
                catch { }
            if (string.IsNullOrEmpty(country))
            {
                try
                {
                    int startindex = stringSource.IndexOf("\"geo_region\":");
                    if (startindex > 0)
                    {
                        string start = stringSource.Substring(startindex).Replace("\"geo_region\":", "");
                        int endindex = start.IndexOf("\"i18n_geo_region\":\"Location\"");
                        string end = start.Substring(0, endindex);
                        country = end;

                        string[] array = Regex.Split(end, "\"name\":\"");
                        array = array.Skip(1).ToArray();
                        foreach (string item in array)
                        {
                            try
                            {
                                int startindex1 = item.IndexOf("\",\"");
                                string strat1 = item.Substring(0, startindex1);
                                country = strat1;
                                break;
                            }
                            catch (Exception ex)
                            {

                            }
                        }

                    }
                }

                catch (Exception ex)
                {

                }
            }
                if (country == string.Empty)
                {
                    try
                    {
                        string[] countLocation = location.Split(',');

                        if (countLocation.Count() == 2)
                        {
                            country = location.Split(',')[1];
                        }
                        else if (countLocation.Count() == 3)
                        {
                            country = location.Split(',')[2];
                        }

                    }
                    catch { }

                }

                #endregion

            #region Industry
                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).Replace("<strong class=highlight>", string.Empty).Replace("</strong>", string.Empty).Replace("\\u002d", "-").Trim();
                }
                catch { }

                if (string.IsNullOrEmpty(Industry))
                {
                    try
                    {
                        Industry = stringSource.Substring(stringSource.IndexOf("industry_highlight\":"), (stringSource.IndexOf(",", stringSource.IndexOf("industry_highlight\":")) - stringSource.IndexOf("industry_highlight\":"))).Replace("industry_highlight\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("<strong class=highlight>", string.Empty).Replace("</strong>", string.Empty).Replace("\\u002d", "-").Trim();
                    }
                    catch { }
                    //industry_highlight":
                }
                if (string.IsNullOrEmpty(Industry))
                {
                    try
                    {
                        int startindex = stringSource.IndexOf("name=\"industry\" title=\"Find other members in this industry\">");
                        string start = stringSource.Substring(startindex).Replace("name=\"industry\" title=\"Find other members in this industry\">", string.Empty);
                        int endindex = start.IndexOf("</a>");
                        string end = start.Substring(0, endindex).Replace("</a>", string.Empty).Replace("&amp;", "&").Replace("<strong class=", string.Empty).Replace("\"highlight\"", string.Empty).Replace("</strong>", string.Empty).Replace(">", string.Empty);
                        Industry = end;
                    }
                    catch
                    { }
                }
                #endregion Industry

            #region Connection
                //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();
                //}
                //catch { }
                ////numberOfConnections":
                //if (string.IsNullOrEmpty(Connection))
                //{
                //    try
                //    {
                //        Connection = stringSource.Substring(stringSource.IndexOf("numberOfConnections\":"), (stringSource.IndexOf("}", stringSource.IndexOf("numberOfConnections\":")) - stringSource.IndexOf("numberOfConnections\":"))).Replace("numberOfConnections\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("\\u002d", "-").Replace("connectionsBrowseabletrue",string.Empty).Trim();

                //    }
                //    catch { }
                //}
                ////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();
                ////}
                ////catch { }
                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("\"", "").Replace("connectionsBrowseable:true", "").Replace(",", "");
                        Connection = end;
                    }

                    if (startindex < 0)
                    {
                        int startindex1 = stringSource.IndexOf("overview-connections");
                        if (startindex1 > 0)
                        {
                            string start = stringSource.Substring(startindex1).Replace("overview-connections", "").Replace("\n", string.Empty).Replace("<p>", string.Empty).Replace("</p>", string.Empty);
                            int endindex = start.IndexOf("</strong>");
                            string end = start.Substring(0, endindex).Replace("&amp;", "&").Replace("\"", string.Empty).Replace("<strong>", string.Empty).Replace(">", string.Empty).Trim();
                            Connection = end;
                        }
                    }
                    if (string.IsNullOrEmpty(Connection))
                    {
                        try
                        {
                            int startindex1 = stringSource.IndexOf("class=\"member-connections\"><strong>");
                            string start = stringSource.Substring(startindex1).Replace("class=\"member-connections\"><strong>", "").Replace("\n", string.Empty).Replace("<p>", string.Empty).Replace("</p>", string.Empty);
                            int endindex = start.IndexOf("</strong>");
                            string end = start.Substring(0, endindex).Replace("&amp;", "&").Replace("\"", string.Empty).Replace("<strong>", string.Empty).Replace(">", string.Empty).Trim();
                            Connection = end;
                        }
                        catch
                        { }
                    }

                }
                catch (Exception ex)
                {
                }

                #endregion Connection

            #region Recommendation

                try
                {
                    string RecomnedUrl = string.Empty;
                    try
                    {
                        int startindex = stringSource.IndexOf("endorsements?id=");
                        string start = stringSource.Substring(startindex);
                        int endIndex = start.IndexOf("\"mem_pic\":");
                        RecomnedUrl = (start.Substring(0, endIndex).Replace(",",string.Empty).Replace("\"", string.Empty).Replace(":", string.Empty));

                    }
                    catch { }

                    string PageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/profile-v2-" + RecomnedUrl + ""));
                    string[] arrayRecommendedName = Regex.Split(PageSource, "headline");

                    if (arrayRecommendedName.Count() == 1)
                    {
                        arrayRecommendedName = Regex.Split(PageSource, "fmt__recommendeeFullName");
                    }

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

                    foreach (var itemRecomName in arrayRecommendedName)
                    {
                        try
                        {
                            if (!itemRecomName.Contains("Endorsements"))
                            {
                                string Heading = string.Empty;
                                string Name = string.Empty;

                                try
                                {

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

                                try
                                {
                                    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));
                                }
                                catch { }

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

                                ListRecommendationName.Add(Name + " : " + Heading);

                            }
                        }
                        catch { }

                    }

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

                }
                catch { }
                if (string.IsNullOrEmpty(Recommendations))
                {
                    List<string> ListRecommendationName = new List<string>();
                    string[] recommend = Regex.Split(stringSource, "trk=prof-exp-snippet-endorsement-name'>");
                    foreach (string item in recommend)
                    {
                        if (!item.Contains("<!DOCTYPE html>"))
                            try
                            {
                                int startindex = item.IndexOf("");
                                string start = item.Substring(startindex);
                                int endindex = start.IndexOf("</a>");
                                string end = start.Substring(0, endindex).Replace("</a>", string.Empty);
                                string recmnd = end.Trim();
                                ListRecommendationName.Add(recmnd);
                            }
                            catch
                            { }
                    }
                    foreach (string item in ListRecommendationName)
                    {
                        if (recomandation == string.Empty)
                        {
                            recomandation = item;
                        }
                        else
                        {
                            recomandation += "  -  " + item;
                        }
                    }
                }

                #endregion

            #region Experience
                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 item in ListExperince)
                        {
                            if (LDS_Experience == string.Empty)
                            {
                                LDS_Experience = item;
                            }
                            else
                            {
                                LDS_Experience += "  -  " + item;
                            }
                        }

                    }
                    catch { }
                    try
                    {
                        string[] array = Regex.Split(stringSource, "name='title' title='Find others with this title'>");
                        string exp = string.Empty;
                        string comp = string.Empty;
                        List<string> ListExperince = new List<string>();
                        List<string> ListCompany = new List<string>();
                        string SelItem = string.Empty;

                        foreach (var itemGrps in array)
                        {
                            try
                            {
                                if (!itemGrps.Contains("<!DOCTYPE html")) //">Join
                                {
                                    try
                                    {
                                        int startindex = itemGrps.IndexOf("");
                                        string start = itemGrps.Substring(startindex);
                                        int endIndex = start.IndexOf("</a>");
                                        exp = (start.Substring(0, endIndex).Replace("\"", string.Empty).Replace(":", string.Empty).Replace("&amp", "&").Replace(";", string.Empty).Replace("\\u002d", "-").Replace("</a>", string.Empty).Replace("name:", string.Empty));

                                    }
                                    catch { }

                                    try
                                    {
                                        int startindex1 = itemGrps.IndexOf("trk=prof-exp-company-name\">");
                                        string start1 = itemGrps.Substring(startindex1);
                                        int endIndex1 = start1.IndexOf("</a>");
                                        comp = (start1.Substring(0, endIndex1).Replace("trk=prof-exp-company-name\">", string.Empty).Replace(":", string.Empty).Replace(";", string.Empty).Replace("\\u002d", "-").Replace("</a>", string.Empty).Replace("name:", string.Empty)).Replace("\"", string.Empty);
                                        if (comp.Contains("<span"))
                                        {
                                            try
                                            {
                                                startindex1 = itemGrps.IndexOf("Find others who have worked at this company\">");
                                                start1 = itemGrps.Substring(startindex1);
                                                endIndex1 = start1.IndexOf("</a>");
                                                comp = (start1.Substring(0, endIndex1).Replace("Find others who have worked at this company\">",string.Empty).Replace("trk=prof-exp-company-name\">", string.Empty).Replace(":", string.Empty).Replace(";", string.Empty).Replace("\\u002d", "-").Replace("</a>", string.Empty).Replace("name:", string.Empty)).Replace("\"", string.Empty).Replace("<strong class=\"highlight\">", string.Empty).Replace("</strong>", string.Empty).Trim().Replace("<strong class=highlight>", string.Empty);
                                            }
                                            catch { }
                                        }
                                    }
                                    catch { }

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

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

                                    ListExperince.Add(exp + ":" + comp);
                                    ListCompany.Add(comp);
                                    companycurrent = ListCompany[0];
                                    if (companycurrent.Contains("span data-tracking") || string.IsNullOrEmpty(companycurrent))
                                    {
                                        try
                                        {
                                            if (companyList.Count > 0)
                                            {
                                                companycurrent = companyList[0];
                                            }
                                        }
                                        catch
                                        { }
                                    }

                                }
                            }
                            catch { }
                        }
                        if (ListExperince.Count > 0)
                        {
                            foreach (var item in ListExperince)
                            {
                                if (LDS_Experience == string.Empty)
                                {
                                    LDS_Experience = item;
                                }
                                else
                                {
                                    LDS_Experience += "  -  " + item;
                                }
                            }
                        }

                    }
                    catch { }

                }

                #endregion

            #region Group

               try
                {
                    string GroupUrl = string.Empty;
                    try
                    {
                        int startindex = stringSource.IndexOf("templateId\":\"profile_v2_connections");
                        string start = stringSource.Substring(startindex);
                        int endIndex = start.IndexOf("&goback");
                        GroupUrl = (start.Substring(0, endIndex).Replace(",", string.Empty).Replace("\"", string.Empty).Replace("templateId:profile_v2_connectionsurl:",string.Empty));

                    }
                    catch { }

                    string PageSource = HttpHelper.getHtmlfromUrl1(new Uri(GroupUrl));

                    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 item in ListGroupName)
                    {
                        if (groupscollectin == string.Empty)
                        {
                            groupscollectin = item;
                        }
                        else
                        {
                            groupscollectin += "  -  " + item;
                        }
                    }

                }
                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 item in strarr_skill)
                        {
                            try
                            {
                                if (!item.Contains("!DOCTYPE html"))
                                {
                                    try
                                    {
                                        string Grp = item.Substring(item.IndexOf(">"), (item.IndexOf("<", item.IndexOf(">")) - item.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 item in checkgrplist)
                        {
                            try
                            {
                                if (Skill == string.Empty)
                                {
                                    Skill = item;
                                }
                                else
                                {
                                    Skill = Skill + "  :  " + item;
                                }
                            }
                            catch { }

                        }
                    }
                    else
                    {
                        if (strarr_skill1.Count() >= 2)
                        {
                            try
                            {

                                foreach (string skillitem in strarr_skill1)
                                {
                                    try
                                    {
                                        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();
                                                int startindex = skillitem.IndexOf(":\"");
                                                string start = skillitem.Substring(startindex);
                                                int endindex = start.IndexOf("viewerEndorsementId");
                                                if (!start.Contains("viewerEndorsementId"))
                                                {
                                                    int endindex1 = start.IndexOf("\"}");
                                                    string end1 = skillitem.Substring(0, endindex1).Replace("\"}", "").Replace("\"", "").Replace("\":", "").Replace(",", "").Replace(":", "").Replace("\\u002d", "");
                                                    string Grp1 = end1;
                                                    checkgrplist.Add(Grp1);
                                                    checkgrplist.Distinct().ToList();
                                                }
                                                else
                                                {
                                                    string end = skillitem.Substring(0, endindex).Replace("viewerEndorsementId", string.Empty).Replace("\"", "").Replace("\":", "").Replace(",", "").Replace(":", "").Replace("\\u002d", "");
                                                    string Grp = end;
                                                    checkgrplist.Add(Grp);
                                                    checkgrplist.Distinct().ToList();
                                                }
                                            }
                                            catch { }
                                        }

                                    }
                                    catch { }

                                }

                                foreach (string item in checkgrplist)
                                {
                                    try
                                    {
                                        if (Skill == string.Empty)
                                        {
                                            Skill = item;
                                        }
                                        else
                                        {
                                            Skill = Skill + "  :  " + item;
                                        }
                                    }
                                    catch { }

                                }
                            }
                            catch { }
                        }
                    }
                }
                catch { }

                #endregion

            #region Pasttitle
                string[] pasttitles = Regex.Split(stringSource, "title_highlight");
                string pstTitlesitem = string.Empty;
                pasttitles = pasttitles.Skip(1).ToArray();
                foreach (string item in pasttitles)
                {
                    try
                    {

                        if (!item.Contains("<!DOCTYPE html>") && !item.Contains("Tip: You can also search by keyword"))
                        {

                            try
                            {
                                string[] Past_Ttl = Regex.Split(item, ",");
                                pstTitlesitem = Past_Ttl[0].Replace(":",string.Empty).Replace("\"",string.Empty).Replace("\\u002d", "-").Replace("&amp;","&");
                            }
                            catch { }

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

                        }

                    }
                    catch
                    {
                    }
                }
                #endregion

            #region ProfileUrl

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

                }
                catch { }
                #endregion

            #region Data Saved In CSV File

                companycurrent = companycurrent.Replace("&amp;","&").Replace("<strong class=highlight>", string.Empty).Replace("</strong>", string.Empty);
                LDS_Experience = LDS_Experience.Replace("&amp;","&").Replace("<strong class=highlight>", string.Empty).Replace("</strong>", string.Empty);
                AllComapny = AllComapny.Replace("&amp;","&").Replace("<strong class=highlight>", string.Empty).Replace("</strong>", string.Empty);
                LDS_PastTitles = LDS_PastTitles.Replace("<strong class=\"highlight\">", string.Empty).Replace("<strong class=highlight>", string.Empty);

                if (!string.IsNullOrEmpty(firstname) || !string.IsNullOrEmpty(lastname) || !string.IsNullOrEmpty(Company))
                {
                    if (postalCode == string.Empty) postalCode = "--";
                    if (distance == string.Empty) distance = "--";
                    if (Company == string.Empty) Company = "--";
                    if (titlecurrent == string.Empty) titlecurrent = "--";
                    if (companycurrent == string.Empty) companycurrent = "--";
                    if (Connection == string.Empty) Connection = "--";
                    if (recomandation == string.Empty) recomandation = "--";
                    if (Skill == string.Empty) Skill = "--";
                    if (LDS_Experience == string.Empty) LDS_Experience = "--";
                    if (EducationCollection == string.Empty) EducationCollection = "--";
                    if (groupscollectin == string.Empty) groupscollectin = "--";
                    if (USERemail == string.Empty) USERemail = "--";
                    if (LDS_UserContact == string.Empty) LDS_UserContact = "--";
                    if (LDS_PastTitles == string.Empty) LDS_PastTitles = "--";
                    if (AllComapny == string.Empty) AllComapny = "--";
                    if (location == string.Empty) location = "--";
                    if (state == string.Empty) state = "--";
                    if (country == string.Empty) country = "--";
                    if (Industry == string.Empty) Industry = "--";
                    if (website1 == string.Empty) website1 = "--";
                    try
                    {
                           string CSVHeader = "ProfileType" + "," + "UserProfileLink" + "," + "FirstName" + "," + "LastName" + "," + "PostalCode" + "," + "Distance From Postal" + "," + "HeadLineTitle" + "," + "CurrentTitle " + "," + "Company" + "," + "Connection" + "," + "Recommendations " + "," + "SkillAndExpertise " + "," + "Experience " + "," + " Education" + "," + "Groups" + "," + "UserEmail" + "," + "UserContactNumber" + "," + "PastTitles" + "," + "PastCompany" + "," + "City" + "," + "State" + "," + "Country" + "," + "Industry" + "," + "WebSites" + "," + "LinkedInLoginID" + "," + "DateTimeOfCrawl" +",";
                           string CSV_Content = TypeOfProfile + "," + LDS_UserProfileLink + "," + firstname.Replace(",", ";").Trim() + "," + lastname.Replace(",", ";").Trim() + "," + postalCode + "," + distance + "," + Company.Replace("&amp;", "&").Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + companycurrent.Replace("&amp;", "&").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(",", ";") + "," + location.Replace(",", ";") + "," + state.Replace(",", ";") + "," + country.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + website1.Replace(",", ";") + "," + accountUser + "," + DateTime.Now;// +TypeOfProfile + ",";
                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_InBoardProGetDataResultUrlData);
                        Log("[ " + DateTime.Now + " ] => [ Data Saved In CSV File ! ]");
                    }
                    catch { }
                }

                #endregion
        }
        public void CrawlingPageDataSource(string Url, ref GlobusHttpHelper HttpHelper)
        {
            // if (SearchCriteria.starter)
            {
                // if (SearchCriteria.starter)
                {
                    try
                    {
                        Log("[ " + DateTime.Now + " ] => [ Start Parsing Process ]");

                        #region Data Initialization

                        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 html = 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 = "Public1";

                        string Finaldata = string.Empty;
                        #endregion

                        #region LDS_DataInitialization
                        string LDS_FirstName = string.Empty;
                        string LDS_LastName = string.Empty;
                        string LDS_UserProfileLink = string.Empty;
                        string LDS_HeadLineTitle = string.Empty;
                        string LDS_CurrentTitle = string.Empty;
                        string LDS_PastTitles = string.Empty;
                        string LDS_Loction = string.Empty;
                        string LDS_Country = string.Empty;
                        string LDS_Connection = string.Empty;
                        string LDS_Recommendations = string.Empty;
                        string LDS_SkillAndExpertise = string.Empty;
                        string LDS_Education = string.Empty;
                        string LDS_Experience = string.Empty;
                        string LDS_ProfileType = "Public";
                        string LDS_Groups = string.Empty;
                        string LDS_UserEmail = string.Empty;
                        string LDS_UserContactNumber = string.Empty;
                        string LDS_CurrentCompany = string.Empty;
                        string LDS_PastCompany = string.Empty;
                        string LDS_LoginID = string.Empty;
                        string LDS_Websites = string.Empty;
                        string LDS_Industry = string.Empty;
                        #endregion

                        #region Chilkat Initialization

                        Chilkat.Http http = new Chilkat.Http();

                        ///Chilkat Http Request to be used in Http Post...
                        Chilkat.HttpRequest req = new Chilkat.HttpRequest();
                        Chilkat.HtmlUtil htmlUtil = new Chilkat.HtmlUtil();

                        // Any string unlocks the component for the 1st 30-days.
                        bool success = http.UnlockComponent("THEBACHttp_b3C9o9QvZQ06");
                        if (success != true)
                        {
                            Console.WriteLine(http.LastErrorText);
                            return;
                        }

                        http.CookieDir = "memory";
                        http.SendCookies = true;
                        http.SaveCookies = true;

                        html = HttpHelper.getHtmlfromUrl1(new Uri(Url));

                        html = htmlUtil.EntityDecode(html);

                        ////  Convert the HTML to XML:
                        Chilkat.HtmlToXml htmlToXml = new Chilkat.HtmlToXml();
                        Chilkat.HtmlToXml htmlToXml1 = new Chilkat.HtmlToXml();
                        Chilkat.HtmlToXml htmlToXml2 = new Chilkat.HtmlToXml();
                        success = htmlToXml.UnlockComponent("THEBACHtmlToXml_7WY3A57sZH3O");
                        if ((success != true))
                        {
                            Console.WriteLine(htmlToXml.LastErrorText);
                            return;
                        }

                        string xHtml = null;
                        string xHtml1 = null;
                        //string xHtml2 = null;

                        htmlToXml.Html = html;
                        xHtml = htmlToXml.ToXml();

                        Chilkat.Xml xml = new Chilkat.Xml();
                        xml.LoadXml(xHtml);

                        ////  Iterate over all h1 tags:
                        Chilkat.Xml xNode = default(Chilkat.Xml);
                        Chilkat.Xml xBeginSearchAfter = default(Chilkat.Xml);

                        #endregion

                        #region for paRSING
                        List<string> list = new List<string>();
                        List<string> Grouplist = new List<string>();
                        List<string> listtitle = new List<string>();
                        List<string> Currentlist = new List<string>();
                        List<string> Skilllst = new List<string>();
                        list.Clear();

                        //new parshing code

                        List<string> TempFirstName = objChilkat.GetDataTagAttributewithId(html, "div", "name-container");

                        xBeginSearchAfter = null;

                        xNode = xml.SearchForTag(xBeginSearchAfter, "dt");

                        Grouplist.Clear();
                        xBeginSearchAfter = null;
                        #region parsergroup
                        xNode = xml.SearchForAttribute(xBeginSearchAfter, "div", "class", "group-data");

                        while ((xNode != null))
                        {
                            Finaldata = xNode.AccumulateTagContent("text", "/text");

                            Grouplist.Add(Finaldata);

                            string[] tempC1 = Regex.Split(Finaldata, " at ");

                            xBeginSearchAfter = xNode;
                            xNode = xml.SearchForAttribute(xBeginSearchAfter, "div", "class", "group-data");

                        }

                        int groupcounter = 0;
                        string AllGRoup = string.Empty;
                        foreach (string item in Grouplist)
                        {
                            if (item.Contains("Join"))
                            {
                                if (groupcounter == 0)
                                {
                                    LDS_Groups = item;
                                    groupcounter++;
                                }
                                else
                                {
                                    LDS_Groups = AllGRoup + ";" + item;
                                }

                            }

                        }
                        #endregion

                        #region parserSkill
                        xNode = xml.SearchForTag(xBeginSearchAfter, "dt");

                        Skilllst.Clear();
                        xBeginSearchAfter = null;

                        xNode = xml.SearchForAttribute(xBeginSearchAfter, "div", "id", "profile-skills");

                        while ((xNode != null))
                        {
                            Finaldata = xNode.AccumulateTagContent("text", "/text");
                            if (Finaldata.Contains("extlib: _toggleclass"))
                            {
                                try
                                {
                                    string[] Temp = Finaldata.Split(';');
                                    LDS_SkillAndExpertise = Temp[4];
                                }
                                catch { }

                            }
                            else
                            {
                                try
                                {
                                    LDS_SkillAndExpertise = Finaldata.Replace("Skills & Expertise", " ");
                                    Skilllst.Add(Finaldata);
                                }
                                catch { }
                            }

                            xBeginSearchAfter = xNode;
                            xNode = xml.SearchForAttribute(xBeginSearchAfter, "div", "id", "profile-skills");

                        }

                        if (LDS_SkillAndExpertise.Contains(" Endorsements LI.i18n.register('section_skills_person_endorsed_tmpl"))
                        {
                            LDS_SkillAndExpertise = string.Empty;
                        }

                        Skilllst.Distinct();
                        #endregion

                        #region UrlProfile
                        try
                        {
                            if (html.Contains("webProfileURL"))
                            {
                                int FirstPointForProfileURL = html.IndexOf("webProfileURL");
                                string FirstSubStringForProfileURL = html.Substring(FirstPointForProfileURL);
                                int SecondPointForProfileURL = FirstSubStringForProfileURL.IndexOf(">");
                                int ThirdPointForProfileURL = FirstSubStringForProfileURL.IndexOf("</a>");

                                string SecondSubStringForProfileURL = FirstSubStringForProfileURL.Substring(SecondPointForProfileURL, ThirdPointForProfileURL - SecondPointForProfileURL);
                                LDS_UserProfileLink = SecondSubStringForProfileURL.Replace(">", string.Empty);
                                //qm.AddProfileUrl(URLprofile, DateTime.Now.ToString(), "0");
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                        }

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

                            LDS_UserProfileLink = Url;
                        }
                        catch { }
                        #endregion

                        #region Connection
                        if (html.Contains("overview-connections"))
                        {
                            try
                            {
                                Connection = html.Substring(html.IndexOf("leo-module mod-util connections"), 500);
                                string[] Arr = Connection.Split('>');
                                string tempConnection = Arr[5].Replace("</strong", "").Replace(")</h3", "").Replace("(", "");
                                if (tempConnection.Length < 8)
                                {
                                    LDS_Connection = tempConnection + "Connection";
                                }
                                else
                                {
                                    LDS_Connection = string.Empty;
                                }

                            }
                            catch (Exception ex)
                            {
                                //overview-connections
                                try
                                {
                                    LDS_Connection = html.Substring(html.IndexOf("overview-connections"), 50);
                                    string[] Arr = Connection.Split('>');
                                    string tempConnection = Arr[3].Replace("</strong", "").Replace(")</h3", "").Replace("(", "");
                                    LDS_Connection = tempConnection + "Connection";
                                }
                                catch { }
                            }
                        }
                        #endregion

                        #region Recommendation
                        if (html.Contains("Recommendations"))
                        {

                            try
                            {
                                string[] rList = System.Text.RegularExpressions.Regex.Split(html, "Recommendations");
                                string[] R3List = rList[2].Split('\n');
                                string temprecomandation = R3List[4].Replace("</strong>", "").Replace("<strong>", "");
                                if (temprecomandation.Contains("recommended"))
                                {
                                    LDS_Recommendations = temprecomandation;
                                }
                                else
                                {
                                    LDS_Recommendations = "";
                                }

                            }
                            catch (Exception ex)
                            {
                                LDS_Recommendations = string.Empty;
                            }
                        }
                        #endregion

                        #region Websites
                        if (html.Contains("websites"))
                        {
                            try
                            {
                                string websitedem = html.Substring(html.IndexOf("websites"), 500);

                                string[] Arr = Regex.Split(websitedem, "href");
                                foreach (string item in Arr)
                                {
                                    if (item.Contains("redir/redirect?url"))
                                    {
                                        string tempArr = item.Substring(item.IndexOf("name="), 50);
                                        string[] temarr = tempArr.Split('\n');
                                        LDS_Websites = temarr[1];
                                    }
                                }

                            }
                            catch (Exception ex)
                            {
                                LDS_Websites = string.Empty;
                            }
                        }
                        #endregion

                        #region Getting Industry
                        try
                        {

                            string Industrytemp = html.Substring(html.IndexOf("Find users in this industry"), 100);
                            string[] TempIndustery = Industrytemp.Split('>');
                            LDS_Industry = TempIndustery[1].Replace("</strong", "").Replace("</a", "");

                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                        }
                        #endregion

                        #region Getting First Name
                        try
                        {
                            if (html.Contains("given-name"))
                            {
                                int FirstPointForProfilename = html.IndexOf("given-name");
                                string FirstSubStringForProfilename = html.Substring(FirstPointForProfilename);
                                int SecondPointForProfilename = FirstSubStringForProfilename.IndexOf(">");
                                int ThirdPointForProfilename = FirstSubStringForProfilename.IndexOf("</span>");

                                string SecondSubStringForProfilename = FirstSubStringForProfilename.Substring(SecondPointForProfilename, ThirdPointForProfilename - SecondPointForProfilename);
                                LDS_FirstName = SecondSubStringForProfilename.Replace(">", string.Empty);
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                        }
                        #endregion

                        #region LastName
                        try
                        {
                            if (html.Contains("family-name"))
                            {
                                int FirstPointForProfilelastname = html.IndexOf("family-name");
                                string FirstSubStringForProfilelastname = html.Substring(FirstPointForProfilelastname);
                                int SecondPointForProfilelastname = FirstSubStringForProfilelastname.IndexOf(">");
                                int ThirdPointForProfilelastname = FirstSubStringForProfilelastname.IndexOf("</span>");

                                string SecondSubStringForProfilelastname = FirstSubStringForProfilelastname.Substring(SecondPointForProfilelastname, ThirdPointForProfilelastname - SecondPointForProfilelastname);
                                string templastname = SecondSubStringForProfilelastname.Replace(">", string.Empty);
                                if (templastname.Contains(","))
                                {
                                    string[] arrylastname = templastname.Split(',');
                                    LDS_LastName = arrylastname[0];
                                }
                                else
                                {
                                    LDS_LastName = templastname;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                        }

                        #endregion

                        #region Designation Company Current
                        try
                        {
                            if (html.Contains("phonetic-full-name"))
                            {
                                int FirstPointForProfileCurrent = html.IndexOf("phonetic-full-name");
                                string FirstSubStringForProfileCurrent = html.Substring(FirstPointForProfileCurrent);
                                int SecondPointForProfileCurrent = FirstSubStringForProfileCurrent.IndexOf("display:block");
                                int ThirdPointForProfileCurrent = FirstSubStringForProfileCurrent.IndexOf("</p>");

                                string SecondSubStringForProfileCurrent = FirstSubStringForProfileCurrent.Substring(SecondPointForProfileCurrent, ThirdPointForProfileCurrent - SecondPointForProfileCurrent);
                                titlecurrent = SecondSubStringForProfileCurrent.Replace("\">", "").Replace("display:block", string.Empty).Replace("<strong class=\"highlight\"", string.Empty).Replace("</strong", string.Empty).Trim();
                                string[] tempCCurent = Regex.Split(titlecurrent, " at ");
                                LDS_HeadLineTitle = titlecurrent.Replace(",", ";");
                                LDS_CurrentCompany = tempCCurent[1].Replace(",", ";");

                            }

                            else if (html.Contains("<p class=\"title\""))
                            {
                                LDS_HeadLineTitle = html.Substring(html.IndexOf("<p class=\"title\""), 150);
                                string[] HeadLineTitle = LDS_HeadLineTitle.Split('>');
                                string tempHeadLineTitle = HeadLineTitle[1].Replace("\n", "").Replace(")</h3", "").Replace("</p", "");
                                LDS_HeadLineTitle = tempHeadLineTitle;
                                try
                                {
                                    string[] tempCCurent = Regex.Split(tempHeadLineTitle, " at ");
                                    LDS_HeadLineTitle = tempCCurent[0];
                                    LDS_CurrentCompany = tempCCurent[1];
                                }
                                catch { }
                            }

                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                        }
                        #endregion

                        #region Education
                        try
                        {
                            if (html.Contains("summary-education"))
                            {
                                int FirstPointForProfileeducation1 = html.IndexOf("summary-education");
                                string FirstSubStringForProfileeducation1 = html.Substring(FirstPointForProfileeducation1);
                                int SecondPointForProfileeducation1 = FirstSubStringForProfileeducation1.IndexOf("<li>");
                                int ThirdPointForProfileeducation1 = FirstSubStringForProfileeducation1.IndexOf("</li>");

                                string SecondSubStringForProfileeducation1 = FirstSubStringForProfileeducation1.Substring(SecondPointForProfileeducation1, ThirdPointForProfileeducation1 - SecondPointForProfileeducation1);
                                education1 = SecondSubStringForProfileeducation1.Replace("<li>", string.Empty).Replace(",", string.Empty).Trim();
                            }

                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                        }

                        #endregion

                        #region Country
                        try
                        {
                            if (html.Contains("locality"))
                            {
                                int FirstPointForlocality = html.IndexOf("locality");
                                string FirstSubStringForlocality = html.Substring(FirstPointForlocality);
                                int SecondPointForlocality = FirstSubStringForlocality.IndexOf("location");
                                int ThirdPointForlocality = FirstSubStringForlocality.IndexOf("</a>");

                                string SecondSubStringForlocality = FirstSubStringForlocality.Substring(SecondPointForlocality, ThirdPointForlocality - SecondPointForlocality);
                                string temlocation = SecondSubStringForlocality.Replace("location", string.Empty).Replace(">", string.Empty).Replace('"', ' ');
                                string[] temp = temlocation.Split(',');
                                LDS_Loction = temp[0].Replace("<strong class= highlight", string.Empty).Replace("</strong", string.Empty);
                                LDS_Country = temp[1].Replace("<strong class= highlight", string.Empty).Replace("</strong", string.Empty);
                                // country = temp[1].Replace("</strong", string.Empty);
                            }

                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                        }
                        #endregion

                        #region User Email
                        try
                        {
                            if (html.Contains("Email & Phone:"))
                            {
                                int FirstPointFortitlepast1 = html.IndexOf("abook-email");
                                string FirstSubStringFortitlepast1 = html.Substring(FirstPointFortitlepast1);
                                int SecondPointFortitlepast1 = FirstSubStringFortitlepast1.IndexOf("<a");
                                int ThirdPointFortitlepast1 = FirstSubStringFortitlepast1.IndexOf("</a>");

                                string SecondSubStringFortitlepast1 = FirstSubStringFortitlepast1.Substring(SecondPointFortitlepast1, ThirdPointFortitlepast1 - SecondPointFortitlepast1);
                                string[] tempEmail = SecondSubStringFortitlepast1.Split('>');
                                LDS_UserEmail = tempEmail[1];

                            }

                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                        }

                        #endregion

                        #region Type Of profile
                        try
                        {
                            if (html.Contains("profile-header"))
                            {
                                int FirstPointForProfileType = html.IndexOf("profile-header");
                                string FirstSubStringForProfileType = html.Substring(FirstPointForProfileType);
                                int SecondPointForProfileType = FirstSubStringForProfileType.IndexOf("class=\"n fn\"");
                                int ThirdPointForProfileType = FirstSubStringForProfileType.IndexOf("</span>");

                                string SecondSubStringForProfileType = FirstSubStringForProfileType.Substring(SecondPointForProfileType, ThirdPointForProfileType - SecondPointForProfileType);
                                string[] tempProfileType = SecondSubStringForProfileType.Split('>');
                                string ProfileType = tempProfileType[1];
                                LDS_ProfileType = ProfileType;
                            }
                            //<h1><span id="name" class="n fn">Private</span>
                            else if (html.Contains(" class=\"n fn\""))
                            {
                                try
                                {
                                    string ProfileTypetemp = html.Substring(html.IndexOf("class=\"n fn\""), 20);
                                    string[] TempProfileType = ProfileTypetemp.Split('>');
                                    LDS_ProfileType = TempProfileType[1].Replace("</strong", "").Replace("</a", "");
                                }
                                catch { }
                            }

                            if (LDS_ProfileType != "Public")
                            {
                                LDS_ProfileType = "Private";
                            }

                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                        }
                        #endregion

                        #region PhonNumber
                        try
                        {
                            if (html.Contains("<dt>Phone:</dt>"))
                            {
                                int FirstPointFortitlepast1 = html.IndexOf("profile-personal");
                                string FirstSubStringFortitlepast1 = html.Substring(FirstPointFortitlepast1);
                                int SecondPointFortitlepast1 = FirstSubStringFortitlepast1.IndexOf("<p>");
                                int ThirdPointFortitlepast1 = FirstSubStringFortitlepast1.IndexOf("<span");

                                string SecondSubStringFortitlepast1 = FirstSubStringFortitlepast1.Substring(SecondPointFortitlepast1, ThirdPointFortitlepast1 - SecondPointFortitlepast1);
                                LDS_UserContactNumber = SecondSubStringFortitlepast1.Replace("<p>", string.Empty);
                            }

                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                        }
                        #endregion

                        xNode = xml.SearchForTag(xBeginSearchAfter, "dt");
                        xBeginSearchAfter = xNode;

                        list.Clear();

                        #endregion

                        #region Regionfor PastCompney
                        try
                        {
                            if (html.Contains("summary-past"))
                            {

                                int FirstPointForPasttitle = html.IndexOf("summary-past");
                                string FirstSubStringForPasttitle = html.Substring(FirstPointForPasttitle);
                                int SecondPointForPasttitle = FirstSubStringForPasttitle.IndexOf("<li>");
                                int ThirdPointForPasttitle = FirstSubStringForPasttitle.IndexOf("summary-education");
                                string SecondSubStringForPasttitle = FirstSubStringForPasttitle.Substring(SecondPointForPasttitle, ThirdPointForPasttitle - SecondPointForPasttitle);
                                string FirstSubStringForPasttitlelast = htmlUtil.EntityDecode(SecondSubStringForPasttitle);

                                htmlToXml1.Html = FirstSubStringForPasttitlelast;
                                xHtml1 = htmlToXml1.ToXml();

                                Chilkat.Xml xml1 = new Chilkat.Xml();
                                xml1.LoadXml(xHtml1);

                                ////  Iterate over all h1 tags:
                                Chilkat.Xml xNode1 = default(Chilkat.Xml);
                                Chilkat.Xml xBeginSearchAfter1 = default(Chilkat.Xml);

                                list.Clear();
                                string[] tempC1 = null;
                                xNode1 = xml1.SearchForTag(xBeginSearchAfter1, "li");

                                while ((xNode1 != null))
                                {
                                    Finaldata = xNode1.AccumulateTagContent("text", "/text");
                                    listtitle.Add(Finaldata);
                                    // list.Add(Finaldata);

                                    try
                                    {
                                        tempC1 = Regex.Split(Finaldata, " at ");
                                    }
                                    catch { }
                                    if (tempC1 != null)
                                    {
                                        try
                                        {
                                            list.Add(tempC1[1]);
                                        }
                                        catch { }

                                    }

                                    xNode1 = xml1.SearchForTag(xBeginSearchAfter1, "li");
                                    xBeginSearchAfter1 = xNode1;
                                }

                                if (listtitle.Count > 0 || list.Count > 0)
                                {
                                    try
                                    {
                                        titlepast1 = listtitle[0] != null ? listtitle[0] : string.Empty;
                                        titlepast2 = listtitle[1] != null ? listtitle[1] : string.Empty;
                                        titlepast3 = listtitle[2] != null ? listtitle[2] : string.Empty;
                                        titlepast4 = listtitle[3] != null ? listtitle[3] : string.Empty;
                                    }
                                    catch { }

                                    try
                                    {
                                        companypast1 = list[0] != null ? list[0] : string.Empty;

                                        companypast2 = list[1] != null ? list[1] : string.Empty;

                                        companypast3 = list[2] != null ? list[2] : string.Empty;

                                        companypast4 = list[3] != null ? list[3] : string.Empty;
                                    }
                                    catch { }
                                }

                            }
                        }
                        catch { };

                        list.Clear();
                        #endregion

                        string companyCurrenttitle1 = string.Empty;

                        string companyCurrenttitle2 = string.Empty;

                        string companyCurrenttitle3 = string.Empty;

                        string companyCurrenttitle4 = string.Empty;

                        #region Regionfor summary-current
                        try
                        {
                            if (html.Contains("summary-current"))
                            {

                                int FirstPointForCurrenttitle = html.IndexOf("summary-current");
                                string FirstSubStringForCurrenttitle = html.Substring(FirstPointForCurrenttitle);
                                int SecondPointForCurrenttitle = FirstSubStringForCurrenttitle.IndexOf("<li>");
                                int ThirdPointForCurrenttitle = FirstSubStringForCurrenttitle.IndexOf("summary-past");
                                string SecondSubStringForCurrenttitle = FirstSubStringForCurrenttitle.Substring(SecondPointForCurrenttitle, ThirdPointForCurrenttitle - SecondPointForCurrenttitle);
                                string FirstSubStringForCurrenttitlelast = htmlUtil.EntityDecode(SecondSubStringForCurrenttitle);

                                htmlToXml1.Html = FirstSubStringForCurrenttitlelast;
                                xHtml1 = htmlToXml1.ToXml();

                                Chilkat.Xml xml1 = new Chilkat.Xml();
                                xml1.LoadXml(xHtml1);

                                ////  Iterate over all h1 tags:
                                Chilkat.Xml xNode1 = default(Chilkat.Xml);
                                Chilkat.Xml xBeginSearchAfter1 = default(Chilkat.Xml);

                                Currentlist.Clear();
                                list.Clear();
                                string[] tempC1 = null;
                                xNode1 = xml1.SearchForTag(xBeginSearchAfter1, "li");

                                while ((xNode1 != null))
                                {
                                    Finaldata = xNode1.AccumulateTagContent("text", "/text");
                                    Currentlist.Add(Finaldata);
                                    // list.Add(Finaldata);

                                    try
                                    {
                                        tempC1 = Regex.Split(Finaldata, " at ");
                                    }
                                    catch { }
                                    if (tempC1 != null)
                                    {
                                        try
                                        {
                                            list.Add(tempC1[1]);
                                        }
                                        catch { }

                                    }

                                    xNode1 = xml1.SearchForTag(xBeginSearchAfter1, "li");
                                    xBeginSearchAfter1 = xNode1;
                                }

                                if (Currentlist.Count > 0 || list.Count > 0)
                                {
                                    try
                                    {
                                        titleCurrenttitle = Currentlist[0] != null ? Currentlist[0] : string.Empty;
                                        titleCurrenttitle2 = Currentlist[1] != null ? Currentlist[1] : string.Empty;
                                        titleCurrenttitle3 = Currentlist[2] != null ? Currentlist[2] : string.Empty;
                                        titleCurrenttitle4 = Currentlist[3] != null ? Currentlist[3] : string.Empty;
                                    }
                                    catch { }

                                    try
                                    {
                                        companyCurrenttitle1 = list[0] != null ? list[0] : string.Empty;

                                        companyCurrenttitle2 = list[1] != null ? list[1] : string.Empty;

                                        companyCurrenttitle3 = list[2] != null ? list[2] : string.Empty;

                                        companyCurrenttitle4 = list[3] != null ? list[3] : string.Empty;
                                    }
                                    catch { }
                                }

                            }
                        }
                        catch { };

                        list.Clear();
                        #endregion

                        #region RegionForEDUCATION
                        try
                        {
                            if (html.Contains("summary-education"))
                            {

                                int FirstPointForEDUCATION = html.IndexOf("summary-education");
                                string FirstSubStringForEDUCATION = html.Substring(FirstPointForEDUCATION);
                                int SecondPointForEDUCATION = FirstSubStringForEDUCATION.IndexOf("<li>");
                                int ThirdPointForEDUCATION = FirstSubStringForEDUCATION.IndexOf("</ul>");
                                string SecondSubStringForEDUCATION = FirstSubStringForEDUCATION.Substring(SecondPointForEDUCATION, ThirdPointForEDUCATION - SecondPointForEDUCATION);
                                //string tempEDu = SecondSubStringForEDUCATION.Replace("<li>", string.Empty).Replace("</li>", string.Empty).Replace("  ", string.Empty).Replace("\n", string.Empty).Replace("\t", string.Empty).Trim();
                                string temptg = SecondSubStringForEDUCATION.Replace("<li>", "");

                                string[] templis6t = temptg.Split('/');
                                education1 = templis6t[0].Replace("\n", string.Empty).Replace("\t", string.Empty).Replace("<", string.Empty).Replace("span>", string.Empty).Replace(",", string.Empty).Trim();
                                education2 = templis6t[1].Replace("\n", string.Empty).Replace("\t", string.Empty).Replace("li>", string.Empty).Replace("<", string.Empty).Replace("span>", string.Empty).Replace(",", string.Empty).Trim();
                            }
                        }

                        catch { };

                        list.Clear();
                        #endregion

                        string GroupPastJob = string.Empty;
                        string GroupEduction = string.Empty;
                        LDS_PastTitles = titlepast1 + ";" + titlepast3;
                        LDS_PastCompany = companypast1 + ";" + companypast3;
                        LDS_Education = education1 + ";" + education2;
                        LDS_CurrentTitle = titleCurrenttitle;
                        LDS_LoginID = _UserName;//SearchCriteria.LoginID;                                                                                                                       //"ProfileType" + "," + "UserProfileLink" + "," + "FirstName" + "," + "LastName" + "," + "HeadLineTitle" + "," + "CurrentTitle " + "," + "Company" + "," + "Connection" + "," + "Recommendations " + "," + "SkillAndExpertise " + "," + "Experience " + "," + " Education" + "," + "Groups" + "," + "UserEmail" + "," + "UserContactNumbe" + "," + "PastTitles" + "," + "PastCompany" + "," + "Loction" + "," + "Country" + "," + "titlepast3" + "," + "companypast3" + "," + "titlepast4" + "," + "companypast4" + ",";
                        string LDS_FinalData = LDS_ProfileType.Replace(",", ";") + "," + LDS_UserProfileLink.Replace(",", ";") + "," + LDS_FirstName.Replace(",", ";") + "," + LDS_LastName.Replace(",", ";") + "," + LDS_HeadLineTitle.Replace(",", ";") + "," + LDS_CurrentTitle.Replace(",", ";") + "," + LDS_CurrentCompany.Replace(",", ";") + "," + LDS_Connection.Replace(",", ";") + "," + LDS_Recommendations.Replace(",", ";") + "," + LDS_SkillAndExpertise.Replace(",", ";") + "," + LDS_Experience.Replace(",", ";") + "," + LDS_Education.Replace(",", ";") + "," + LDS_Groups.Replace(",", ";") + "," + LDS_UserEmail.Replace(",", ";") + "," + LDS_UserContactNumber.Replace(",", ";") + "," + LDS_PastTitles.Replace(",", ";") + "," + LDS_PastCompany.Replace(",", ";") + "," + LDS_Loction.Replace(",", ";") + "," + LDS_Country.Replace(",", ";") + "," + LDS_Industry.Replace(",", ";") + "," + LDS_Websites.Replace(",", ";") + "," + LDS_LoginID.Replace(",", ";") + ",";

                        if (LDS_FinalData.Contains("<strong class=\"highlight\"") || LDS_FinalData.Contains("<span class=\"full-name\"") || LDS_FinalData.Contains("<strong class=\"highlight\"") || LDS_FinalData.Contains("overview-connections\">"))
                        {
                            LDS_FinalData = LDS_FinalData.Replace("<span class=\"full-name\"", "").Replace("\n", "").Replace("<strong class=\"highlight\"", "").Replace("overview-connections\">", "").Replace("</strong>", "").Replace("<strong>", "");
                        }
                        if (!string.IsNullOrEmpty(LDS_FirstName) || !string.IsNullOrEmpty(LDS_FirstName))
                        {
                            Log(LDS_FinalData);
                        }
                        // if (SearchCriteria.starter)
                        {

                            string tempFinalData = LDS_FinalData.Replace(";", "").Replace(LDS_UserProfileLink, "").Replace("Public", "").Replace(",", "").Replace(LDS_LoginID, "").Trim();

                            if (!string.IsNullOrEmpty(tempFinalData))
                            {
                                //AppFileHelper.AddingLinkedInDataToCSVFile(LDS_FinalData, Globals.path_ScrappedMembersFromGroup);

                                string CSVHeader = "ProfileType" + "," + "UserProfileLink" + "," + "FirstName" + "," + "LastName" + "," + "HeadLineTitle" + "," + "Current Title " + "," + "Current Company" + "," + "Connection" + "," + "Recommendations " + "," + "SkillAndExpertise " + "," + "Experience " + "," + " Education" + "," + "Groups" + "," + "UserEmail" + "," + "UserContactNumber" + "," + "PastTitles" + "," + "PastCompany" + "," + "Location" + "," + "Country" + "," + "Industry" + "," + "WebSites" + "," + "LinkedInLoginID" + ",";
                                string CSV_Content = TypeOfProfile.Replace(",", ";") + "," + LDS_UserProfileLink.Replace(",", ";") + "," + LDS_FirstName.Replace(",", ";") + "," + LDS_LastName.Replace(",", ";") + "," + LDS_HeadLineTitle.Replace(",", ";") + "," + LDS_CurrentTitle.Replace(",", ";") + "," + LDS_CurrentCompany.Replace(",", ";") + "," + LDS_Connection.Replace(",", ";") + "," + LDS_Recommendations.Replace(",", ";") + "," + LDS_SkillAndExpertise.Replace(",", ";") + "," + LDS_Experience.Replace(",", ";") + "," + LDS_Education.Replace(",", ";") + "," + LDS_Groups.Replace(",", ";") + "," + LDS_UserEmail.Replace(",", ";") + "," + LDS_UserContactNumber.Replace(",", ";") + "," + LDS_PastTitles.Replace(",", ";") + "," + LDS_PastCompany.Replace(",", ";") + "," + LDS_Loction.Replace(",", ";") + "," + LDS_Country.Replace(",", ";") + "," + LDS_Industry.Replace(",", ";") + "," + LDS_Websites.Replace(",", ";") + "," + LDS_LoginID.Replace(",", ";");

                                //string CSV_Content = TypeOfProfile + "," + LDS_UserProfileLink + "," + firstname + "," + lastname + "," + Company.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + companycurrent.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 + ",";// +TypeOfProfile + ",";

                                CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_ScrappedMembersFromGroup);
                                Log("[ " + DateTime.Now + " ] => [ Data Saved In CSV File With URL >>> " + LDS_UserProfileLink + " ]");
                            }

                            //if (!string.IsNullOrEmpty(LDS_FirstName) || !string.IsNullOrEmpty(LDS_FirstName))
                            //{
                            //    AppFileHelper.AddingLinkedInDataToCSVFile(LDS_FinalData, SearchCriteria.FileName);
                            //}
                        }

                    }
                    catch (Exception ex) { };

                }

            }
        }
Example #17
0
        public bool EmailVerification(string Email, string Password, ref GlobusHttpHelper globushttpHelper)
        {
            bool IsActivated = false;

            try
            {
                Log("[ " + DateTime.Now + " ] => [ Please Wait Account Verification Start... ]");

                System.Windows.Forms.Application.DoEvents();
                Chilkat.Http http = new Chilkat.Http();

                if (Email.Contains("@yahoo"))
                {
                    #region Yahoo Verification Steps

                    GlobusHttpHelper HttpHelper = new GlobusHttpHelper();
                    bool             activate   = false;
                    try
                    {
                        bool emaildata = false;
                        //Chilkat.Http http = new Chilkat.Http();
                        ///Chilkat Http Request to be used in Http Post...
                        Chilkat.HttpRequest req = new Chilkat.HttpRequest();
                        bool success;

                        // Any string unlocks the component for the 1st 30-days.
                        success = http.UnlockComponent("THEBACHttp_b3C9o9QvZQ06");
                        if (success != true)
                        {
                            Console.WriteLine(http.LastErrorText);
                            return(false);
                        }

                        http.CookieDir   = "memory";
                        http.SendCookies = true;
                        http.SaveCookies = true;

                        //http.ProxyDomain = "127.0.0.1";
                        //http.ProxyPort = 8888;
                        http.SetRequestHeader("Accept-Encoding", "gzip,deflate");
                        Chilkat.Imap iMap     = new Imap();
                        string       Username = Email;

                        iMap.UnlockComponent("THEBACIMAPMAILQ_OtWKOHoF1R0Q");
                        //iMap.
                        //iMap.HttpProxyHostname = "127.0.0.1";
                        //iMap.HttpProxyPort = 8888;

                        iMap.Port = 993;
                        iMap.Connect("imap.n.mail.yahoo.com");
                        iMap.Login(Email, Password);
                        iMap.SelectMailbox("Inbox");

                        // Get a message set containing all the message IDs
                        // in the selected mailbox.
                        Chilkat.MessageSet msgSet;
                        //msgSet = iMap.Search("FROM \"facebookmail.com\"", true);

                        msgSet = iMap.GetAllUids();


                        if (msgSet.Count <= 0)
                        {
                            msgSet = iMap.GetAllUids();
                        }

                        // Fetch all the mail into a bundle object.
                        Chilkat.Email email = new Chilkat.Email();
                        //bundle = iMap.FetchBundle(msgSet);
                        string        strEmail = string.Empty;
                        List <string> lstData  = new List <string>();
                        if (msgSet != null)
                        {
                            for (int i = 0; i < msgSet.Count; i++)
                            {
                                try
                                {
                                    email    = iMap.FetchSingle(msgSet.GetId(i), true);
                                    strEmail = email.Subject;
                                    string emailHtml = email.GetHtmlBody();
                                    lstData.Add(strEmail);

                                    string from = email.From.ToString().ToLower();

                                    if (from.Contains("@linkedin.com"))
                                    {
                                        foreach (string href in GetUrlsFromString(email.Body))
                                        {
                                            try
                                            {
                                                if (href.Contains("http://www.linkedin.com/e/csrf") || href.Contains("http://www.linkedin.com/e/ato") || href.Contains("http://www.linkedin.com/e/v2?e"))
                                                {
                                                    string EscapeEmail = Uri.EscapeDataString(Email).Replace(".", "%2E").Trim();
                                                    {
                                                        string ConfirmationResponse = globushttpHelper.getHtmlfromUrl1(new Uri(href));
                                                        IsActivated = true;
                                                        break;
                                                    }
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                Console.WriteLine("6 :" + ex.StackTrace);
                                            }
                                        }
                                    }
                                    if (IsActivated)
                                    {
                                        Log("[ " + DateTime.Now + " ] => [ Account : " + Email + " verified ]");
                                        break;
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine("Error >>> " + ex.StackTrace);
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("7 :" + ex.StackTrace);
                        Log("[ " + DateTime.Now + " ] => [ Email Verification Exception : " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " with : " + Email + " ]");
                        Log("[ " + DateTime.Now + " ] => [ Please check your Login Id and Password ]");
                    }
                    return(IsActivated);

                    #endregion
                }
                else
                {
                    string Host = string.Empty;
                    int    Port = 0;
                    if (Email.Contains("@gmail"))
                    {
                        Host = "pop.gmail.com";
                        Port = 995;
                    }
                    else if (Email.Contains("@hotmail"))
                    {
                        Host = "pop3.live.com";
                        Port = 995;
                    }
                    else if (Email.Contains("@gmx"))
                    {
                        Host = "pop.gmx.com";
                        Port = 995;
                    }
                    if (!string.IsNullOrEmpty(Host))
                    {
                        try
                        {
                            if (popClient.Connected)
                            {
                                popClient.Disconnect();
                            }
                            popClient.Connect(Host, Port, true);
                            popClient.Authenticate(Email, Password);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);

                            //retry once
                            System.Threading.Thread.Sleep(1000);

                            if (popClient.Connected)
                            {
                                popClient.Disconnect();
                            }
                            popClient.Connect(Host, Port, true);
                            popClient.Authenticate(Email, Password);
                        }


                        //if (!)
                        //{

                        //}

                        int Count = popClient.GetMessageCount();

                        for (int i = Count; i >= 1; i--)
                        {
                            try
                            {
                                OpenPOP.MIME.Message Message = popClient.GetMessage(i);
                                string subject = string.Empty;
                                subject = Message.Headers.Subject;
                                string frowwm      = Message.Headers.From.ToString();
                                bool   GoIntoEmail = false;

                                if (string.IsNullOrEmpty(subject))
                                {
                                    string from = Message.Headers.From.ToString().ToLower();
                                    if (from.Contains("linkedin.com"))
                                    {
                                        GoIntoEmail = true;
                                    }
                                }
                                try
                                {
                                    if (frowwm.Contains("linkedin.com"))
                                    //if(GoIntoEmail)
                                    {
                                        string Messagebody = Message.MessageBody[0];

                                        foreach (string href in GetUrlsFromStringGmail(Messagebody))
                                        {
                                            try
                                            {
                                                if (href.Contains("http://www.linkedin.com/e/csrf") || href.Contains("http://www.linkedin.com/e/ato") || href.Contains("http://www.linkedin.com/e/v2?e"))
                                                {
                                                    string href1       = href.Replace("amp;", string.Empty);
                                                    string EscapeEmail = Uri.EscapeDataString(Email).Replace(".", "%2E").Trim();
                                                    {
                                                        string ConfirmationResponse = globushttpHelper.getHtmlfromUrl1(new Uri(href1));
                                                        IsActivated = true;
                                                        break;
                                                    }
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                Console.WriteLine("5 :" + ex.StackTrace);
                                            };
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine("10 :" + ex.StackTrace);
                                    Log("[ " + DateTime.Now + " ] => [ Email Verification Exception : " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " with : " + Email + " ]");
                                }
                                if (IsActivated)
                                {
                                    break;
                                }
                            }
                            catch (Exception ex)
                            {
                                {
                                    Log("[ " + DateTime.Now + " ] => [ Email Verification Exception : " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " with : " + Email + " ]");
                                    Log("[ " + DateTime.Now + " ] => [ Please check your Login Id and Password ]");
                                }
                            }
                        }
                    }
                }
                return(IsActivated);
            }
            catch (Exception ex)
            {
                Console.WriteLine("4 :" + ex.StackTrace);
                return(IsActivated);
            }
        }
Example #18
0
        public string FromName(ref GlobusHttpHelper HttpHelper)
        {
            try
            {
                string FromNm = string.Empty;

                string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/edit?trk=nav_responsive_sub_nav_edit_profile"));

                string[] RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "fmt_full_display_name");

                foreach (var fromname in RgxGroupData)
                {
                    if (fromname.Contains("\":\""))
                    {
                        try
                        {
                            if (!(fromname.Contains("<!DOCTYPE html>")))
                            {
                                try
                                {
                                    int StartIndex = fromname.IndexOf("\":\"");
                                    string start = fromname.Substring(StartIndex);
                                    int endIndex = start.IndexOf("i18n_optional_not_pinyin");
                                    FromNm = start.Substring(0, endIndex).Replace("\"", string.Empty).Replace("\":\"", string.Empty);
                                    FromNam = FromNm.Split(',')[0].Replace(":", string.Empty).Replace("\\u002d","-");
                                }
                                catch
                                { }
                                try
                                {
                                    if (string.IsNullOrEmpty(FromNm) || FromNm.Contains("LastName"))
                                    {
                                    int StartIndex = fromname.IndexOf("\":\"");
                                    string start = fromname.Substring(StartIndex);
                                    int endIndex = start.IndexOf(",");
                                    FromNm = start.Substring(0, endIndex).Replace("\"", string.Empty).Replace("\":\"", string.Empty);
                                    FromNam = FromNm.Split(',')[0].Replace(":", string.Empty);
                                    }
                                }
                                catch
                                { }
                            }
                        }
                        catch { }
                    }
                }

                return FromNam;

            }
            catch (Exception ex)
            {
                return FromNam;
            }
        }
Example #19
0
        // public void PostStatusMsg(ref GlobusHttpHelper HttpHelper, Boolean Statuswithurl, int mindelay, int maxdelay)
        public void PostStatusMsg(ref GlobusHttpHelper HttpHelper, Boolean Statuswithurl, int mindelay, int maxdelay, string spinnedStatus, Boolean isSpinTrue)
        {
            try
            {
                string csrfToken = string.Empty;
                string sourceAlias = string.Empty;
                string ImgCount = string.Empty;
                string LogoUrl = string.Empty;
                string EntityId = string.Empty;
                string contentTitle = string.Empty;
                string contentSummary = string.Empty;
                int port = 0;

                if (NumberHelper.ValidateNumber(proxyPort))
                {
                    port = Convert.ToInt32(proxyPort);
                }

                string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));
                if (pageSource.Contains("session_full_logout=&amp;"))
                {
                    try
                    {
                        csrfToken = pageSource.Substring(pageSource.IndexOf("session_full_logout=&amp;"), 500);
                        string[] Arr = csrfToken.Split('&');
                        csrfToken = Arr[1];
                        csrfToken = csrfToken.Replace("csrfToken=", "");
                        csrfToken = csrfToken.Replace("%3A", ":").Replace("\n", string.Empty).Replace("\"", string.Empty).Replace("amp;",string.Empty).Replace(">", string.Empty).Trim();
                    }
                    catch (Exception)
                    {

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

                    }
                }

                try
                {
                    string ReqUrl = Post;
                    string GetStatus = string.Empty;
                    //if (Statuswithurl == false)
                    //{
                    //    spinnedStatus = GlobusSpinHelper.spinLargeText(new Random(), spinnedStatus);
                    //    Post = spinnedStatus;
                    //}
                    if (isSpinTrue == true)
                    {
                        spinnedStatus = GlobusSpinHelper.spinLargeText(new Random(), spinnedStatus);
                        Post = spinnedStatus;
                    }
                    if (Post.Contains("//") || Post.Contains("www") || Post.Contains(".com") || Post.Contains("http://") || Post.Contains("https://"))
                    {
                        ReqUrl = ReqUrl.Replace(":", "%3A").Replace("//", "%2F%2F");
                        ReqUrl = ReqUrl.Replace(":", "%3A").Replace("/", "%2F");
                        GetStatus = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/share?getPreview=&url=" + ReqUrl));
                    }
                    if (!(GetStatus.Contains("<WSResponse>")))
                    {
                        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).Replace("url=\"", "");
                            //int EndIndexImgUrl = startImgUrl.IndexOf("\"");
                            //string EndImgUrl = startImgUrl.Substring(0, EndIndexImgUrl).Replace("value\":", "").Replace("\"", "");
                            //LogoUrl = EndImgUrl.Replace("url=", string.Empty);
                            int startindexImgurl = GetStatus.IndexOf("origImages:");
                            string startImgurl = GetStatus.Substring(startindexImgurl).Replace("origImages:", string.Empty);
                            int endindexImgurl = startImgurl.IndexOf("]");
                            string endImgUrl = startImgurl.Substring(0, endindexImgurl).Replace("\\", string.Empty).Replace("[", string.Empty).Replace("\"", string.Empty).Trim();
                            LogoUrl = endImgUrl;
                            LogoUrl = LogoUrl.Replace(":", "%3A").Replace("/", "%2F");
                        }
                        catch { }

                        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);
                        }
                        catch { }

                        try
                        {
                            int StartinContent = GetStatus.IndexOf("share-view-title");
                            string startContent = GetStatus.Substring(StartinContent);
                            int EndIndexContent = startContent.IndexOf("<p id");
                            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("</h4", string.Empty);
                        }
                        catch { }

                        try
                        {
                            int StartinConSumm = GetStatus.IndexOf("share-view-summary\">");
                            string startConSumm = GetStatus.Substring(StartinConSumm);
                            int EndIndexConSumm = startConSumm.IndexOf("<");
                            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");
                        }
                        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=&postVisibility2=EVERYONE&submitPost=&tetherAccountID=&tweetThisOn=false&postToMFeedDefaultPublic=true&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias + "";
                        }
                        else
                        {
                            PostStatusData = "ajax=true&contentImageCount=" + ImgCount + "&contentImageIndex=0&contentImage=" + LogoUrl + "&contentEntityID=" + EntityId + "&contentUrl=" + ReqUrl + "&postText=" + Uri.EscapeDataString(Post) + "&contentTitle=" + contentTitle + "&contentSummary=" + contentSummary + "&contentImageIncluded=true&%23=&postVisibility2=EVERYONE&submitPost=&tetherAccountID=&tweetThisOn=false&postToMFeedDefaultPublic=true&csrfToken=" + Uri.EscapeDataString(csrfToken) + "&sourceAlias=" + sourceAlias + "";
                            // PostStatusData = "ajax=true&contentImageCount=" + ImgCount + "&contentImageIndex=0&contentImage=http%3A%2F%2Ftimesofindia.indiatimes.com%2Fphoto%2F37174983.cms&contentEntityID=" + EntityId + "&contentUrl=http%3A%2F%2Ftimesofindia.indiatimes.com%2Ftech%2Ftech-news%2FGoogles-Skybox-deal-raises-regulatory-concern%2Farticleshow%2F37174862.cms&mentions=%5B%5D&postText=" + Uri.EscapeDataString(Post) + "&contentTitle=" + contentTitle + "&contentSummary=" + contentSummary + "&contentImageIncluded=true&%23=&postVisibility2=EVERYONE&submitPost=&tetherAccountID=&tweetThisOn=false&postToMFeedDefaultPublic=true&csrfToken=" + Uri.EscapeDataString(csrfToken) + "&sourceAlias=" + sourceAlias + "";
                            //PostStatusData = "ajax=true&contentImageCount=1&contentImageIndex=0&contentImage=http%3A%2F%2Ftimesofindia.indiatimes.com%2Fphoto%2F37174983.cms&contentEntityID=ARTC_8537949489495079643&contentUrl=http%3A%2F%2Ftimesofindia.indiatimes.com%2Ftech%2Ftech-news%2FGoogles-Skybox-deal-raises-regulatory-concern%2Farticleshow%2F37174862.cms&mentions=%5B%5D&postText=http%3A%2F%2Ftimesofindia.indiatimes.com%2Ftech%2Ftech-news%2FGoogles-Skybox-deal-raises-regulatory-concern%2Farticleshow%2F37174862.cms&share-entity-typeahead=&contentUrl=http%3A%2F%2Ftimesofindia.indiatimes.com%2Ftech%2Ftech-news%2FGoogles-Skybox-deal-raises-regulatory-concern%2Farticleshow%2F37174862.cms&contentImageIncluded=true&contentTitle=Google's%20Skybox%20deal%20raises%20regulatory%20concern%20-%20The%20Times%20of%20India&contentSummary=Consumer%20watchdog%20Public%20Citizen%20has%20called%20on%20US%20regulators%20to%20conduct%20a%20review%20of%20Google%20Inc's%20recent%20acquisition%20of%20aerospace%20startup%20Skybox%20Imaging.&postVisibility2=EVERYONE&tetherAccountID=139016702&submitPost=&isDark=false&tweetThisOn=false&postToMFeedDefaultPublic=true&csrfToken=ajax%3A5539773821497530765&sourceAlias=0_0aUs533-gpztrJxp65YSDh&pageKey=member-home";
                        }

                        PostStatusData = PostStatusData.Replace(" ", "");
                        string ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/nhome/submit-post"), PostStatusData);
                        Thread.Sleep(2000);

                        if (ResponseStatusMsg.Contains("There was a problem performing this action, please try again later."))
                        {
                            string firstRepsonse = HttpHelper.getHtmlfromUrlProxy(new Uri("http://www.linkedin.com/share?getPreview=&url=" + Uri.EscapeDataString(Post)), proxyAddress, port, proxyUserName, proxyPassword);
                            string posturldata = "ajax=true&contentImageCount=0&contentImageIndex=0&contentImage=false&contentEntityID=" + EntityId + "&contentUrl=" + ReqUrl + "&postText=" + Uri.EscapeDataString(Post) + "&contentUrl=" + Uri.EscapeDataString(Post) + "&contentTitle=" + contentTitle + "&contentSummary=" + contentSummary + "&postVisibility2=EVERYONE&submitPost=&tetherAccountID=&tweetThisOn=false&postToMFeedDefaultPublic=true&csrfToken=" + Uri.EscapeDataString(csrfToken) + "&sourceAlias=" + sourceAlias;
                            ResponseStatusMsg = HttpHelper.postFormDataProxy(new Uri("http://www.linkedin.com/nhome/submit-post"), posturldata, proxyAddress, port, proxyUserName, proxyPassword);
                        }

                        if (ResponseStatusMsg.Contains("Your update has been posted") || ResponseStatusMsg.Contains("success"))
                        {
                            if (Statuswithurl == true)
                            {
                                Log("[ " + DateTime.Now + " ] => [ URL Status Updated With: " + accountUser + " ]");
                                Log("[ " + DateTime.Now + " ] => [ URL Status Posted: " + Post + " ]");
                                Log("[ " + DateTime.Now + " ] => [ URL Status : Updated Successfully. ]");
                            }
                            else
                            {
                                Log("[ " + DateTime.Now + " ] => [ Status Updated With: " + accountUser + " ]");
                                Log("[ " + DateTime.Now + " ] => [ Status Posted: " + Post + " ]");
                                Log("[ " + DateTime.Now + " ] => [ 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). ]");
                            GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + Post, Globals.path_NonPostStatus);
                        }
                        else if (ResponseStatusMsg.Contains("We were unable to post your update since it is a duplicate of your most recent update"))
                        {
                            Log("[ " + DateTime.Now + " ] => [ " + accountUser + " We were unable to post your update since it is a duplicate of your most recent update ]");
                            GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + Post, Globals.path_NonPostStatus);
                        }
                        else
                        {
                            if (Statuswithurl == true)
                            {
                                Log("[ " + DateTime.Now + " ] => [ " + accountUser + " URL Status Not Posted ]");
                            }
                            else
                            {
                                Log("[ " + DateTime.Now + " ] => [ " + accountUser + " Status Not Posted ]");
                            }
                            GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + Post, Globals.path_NonPostStatus);
                        }

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

                    else
                    {
                        Log("[ " + DateTime.Now + " ] => [ " + accountUser + " Error in status update. Please try again ]");
                    }
                }
                catch (Exception ex)
                {
                    GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + Post, Globals.path_NonPostStatus);
                }

                finally
                {

                }
            }
            catch { }
        }
Example #20
0
        public List<string> GetAllGrpMember(ref GlobusHttpHelper httpHelper, string grpId)
        {
            List<string> lstFriendProfileURLs = new List<string>();
            try
            {
                String pageSource = string.Empty;
                int endPageNo = 26;
                int count = 0;
                bool Repeat = false;
                bool countRepeat = false;
                int repeatCount = 0;
                string repeatMember = string.Empty;

                for (int i = 1; i < endPageNo; i++)
                {
                    int countRepeaT = 0;
                    try
                    {
                        string addedurl = "http://www.linkedin.com/groups?viewMembers=&gid=" + grpId + "&split_page=" + i + "";

                        pageSource = httpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/groups?viewMembers=&gid=" + grpId + "&split_page=" + i + ""));

                        if (string.IsNullOrEmpty(pageSource) || pageSource.Contains("Sorry you are not authorized to perform this action"))
                        {
                            pageSource = httpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/groups?viewMembers=&gid=" + grpId + "&split_page=" + i + ""));

                            if (string.IsNullOrEmpty(pageSource) || pageSource.Contains("Sorry you are not authorized to perform this action"))
                            {
                                break;
                            }
                        }

                        if (i >= 25)
                        {
                            if ((i >= 25) && (!pageSource.Contains("<strong>next&nbsp;&#")) && (!pageSource.Contains("siguiente&nbsp;&#187;")))
                            {
                                break;
                            }
                            else
                            {
                                endPageNo++;
                            }
                        }

                        // string[] RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"member\" id=\"");
                        string[] RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<span class=\"new-miniprofile-container");
                        int aa = RgxGroupData.Count();
                        if (aa < 2)
                        {
                            RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<span class=\"miniprofile-container");
                            aa = RgxGroupData.Count();
                        }

                        if (aa > 1)

                            foreach (string item in RgxGroupData)
                            {

                                try
                                {

                                    if (!(item.Contains("<!DOCTYPE html>")))
                                    {
                                        if (item.Contains("/profile/view?id="))
                                        {
                                            string profileURL = item.Substring(item.IndexOf("/profile/view?id="), item.IndexOf("\"", item.IndexOf("/profile/view?id=")) - item.IndexOf("/profile/view?id=")).Replace("\"", string.Empty).Trim();
                                            string[] checkdup = Regex.Split(profileURL, "&goback");
                                            string itemForScrap = "http://www.linkedin.com" + checkdup[0] + "&goback";

                                            count++;
                                            Log("[ " + DateTime.Now + " ] => [ Added URL for Scrape : " + itemForScrap + " ]");
                                            lstFriendProfileURLs.Add(itemForScrap);
                                            if (!obj_ClsScrapGroupMember.CrawlingLinkedInPage(itemForScrap, ref httpHelper))
                                            {
                                                obj_ClsScrapGroupMember.CrawlingPageDataSource(itemForScrap, ref httpHelper);

                                            }
                                        }
                                    }
                                }
                                catch { }
                            }

                        if (!pageSource.Contains("next&nbsp;&#187;") && !pageSource.Contains("siguiente&nbsp;&#187;"))
                        {
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                    }

                }
            }
            catch (Exception ex)
            {
            }

            lstFriendProfileURLs = lstFriendProfileURLs.Distinct().ToList();

            return lstFriendProfileURLs;
        }
        private void Connect(ref GlobusHttpHelper httpHelper, string profileURL)
        {
            try
            {
                Log("[ " + DateTime.Now + " ] => [ Start Sending Connect With Username >>> " + _UserName + " ]");

                string key = string.Empty;
                string firstName_Guest = string.Empty;
                string lastName_Guest = string.Empty;
                string authToken = string.Empty;
                string goback = string.Empty;
                string fullName = string.Empty;

                string pageSource = httpHelper.getHtmlfromUrl1(new Uri(profileURL));

                //if (!pageSource.Contains("\"i18n__Connect\":\"Connect\",\"deferImg\":true"))
                //{
                //    Log("[ " + DateTime.Now + " ] => [ You can not send invitation to profile url >>> " + profileURL + " with username >>> " + _UserName + " ]");
                //    return;

                //}

                if (string.IsNullOrEmpty(pageSource))
                {
                    Thread.Sleep(1 * 1000);

                    pageSource = httpHelper.getHtmlfromUrl1(new Uri(profileURL));
                }

                if (string.IsNullOrEmpty(pageSource))
                {
                    Log("[ " + DateTime.Now + " ] => [ Page Source Is Null ! ]");

                    Log("[ " + DateTime.Now + " ] => [ Process Completed With Username >>> " + _UserName + " ]");

                    return;
                }

                if (pageSource.Contains("memberId:"))
                {
                    key = pageSource.Substring(pageSource.IndexOf("memberId:"), pageSource.IndexOf("</script>", pageSource.IndexOf("memberId:")) - pageSource.IndexOf("memberId:")).Replace("memberId:", string.Empty).Replace("\"", string.Empty).Replace("};", string.Empty).Trim();
                }

                if (pageSource.Contains("snapshotID=&authToken="))
                {
                    authToken = pageSource.Substring(pageSource.IndexOf("snapshotID=&authToken=") + 22, pageSource.IndexOf("&", (pageSource.IndexOf("snapshotID=&authToken=") + 22)) - (pageSource.IndexOf("snapshotID=&authToken=") + 22)).Replace("snapshotID=&authToken=", string.Empty).Replace("\"", string.Empty).Trim();
                }

                if (String.IsNullOrEmpty(authToken) && pageSource.Contains("authToken="))
                {
                    authToken = pageSource.Substring(pageSource.IndexOf("authToken="), pageSource.IndexOf(",", (pageSource.IndexOf("authToken="))) - (pageSource.IndexOf("authToken="))).Replace("authToken=", string.Empty).Replace("\"", string.Empty).Trim();

                    if (authToken.Contains("authType"))
                    {
                        try
                        {
                            authToken = authToken.Split('&')[0];
                        }
                        catch { }

                    }
                    if (authToken.Contains("&"))
                    {
                        try
                        {
                            authToken = authToken.Split('&')[0];
                        }
                        catch { }
                    }
                }

                if (pageSource.Contains("goback="))
                {
                    goback = pageSource.Substring(pageSource.IndexOf("goback="), pageSource.IndexOf("\"", pageSource.IndexOf("goback=")) - pageSource.IndexOf("goback=")).Replace("goback=", string.Empty).Replace("\"", string.Empty).Trim();
                }
                if (string.IsNullOrEmpty(goback))
                {
                    string[] gobck = Regex.Split(pageSource, "&goback=");
                    int startindex = gobck[2].IndexOf("");
                    string start = gobck[2].Substring(startindex);
                    int endindex = start.IndexOf(",");
                    string end = start.Substring(0, endindex).Replace("\"",string.Empty);
                    goback = end.Trim();
                }

                if (pageSource.Contains("class=\"full-name\""))
                {
                    fullName = pageSource.Substring(pageSource.IndexOf("class=\"full-name\""), pageSource.IndexOf("<", pageSource.IndexOf("class=\"full-name\"")) - pageSource.IndexOf("class=\"full-name\"")).Replace("class=\"full-name\"", string.Empty).Replace("\"", string.Empty).Replace("dir=auto>", string.Empty).Trim();
                }

                if (string.IsNullOrEmpty(fullName))
                {
                    try
                    {
                        int startindex = pageSource.IndexOf("<span class=\"full-name\">");
                        string start = pageSource.Substring(startindex).Replace("<span class=\"full-name\">", string.Empty);
                        int endindex = start.IndexOf("</span>");
                        string end = start.Substring(0, endindex).Replace("</span>", string.Empty);
                        fullName = end.Trim();
                    }
                    catch
                    { }
                }
                if (fullName.Contains(" "))
                {
                    firstName_Guest = fullName.Substring(0, fullName.LastIndexOf(" ")).Replace("&quot;", "\"").Trim();

                    lastName_Guest = fullName.Substring(fullName.LastIndexOf(" "), fullName.Length - fullName.LastIndexOf(" ")).Replace("&quot;", "\"").Trim();

                }

                string pageSource1 = httpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/people/invite?from=profile&key=" + key + "&firstName=" + firstName_Guest + "&lastName=" + lastName_Guest + "&authToken=" + authToken + "&authType=name&goback=" + goback + "&trk=prof-0-sb-connect-button"));

                if (string.IsNullOrEmpty(pageSource1))
                {
                    Thread.Sleep(1 * 1000);

                    pageSource1 = httpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/people/invite?from=profile&key=" + key + "&firstName=" + firstName_Guest + "&lastName=" + lastName_Guest + "&authToken=" + authToken + "&authType=name&goback=" + goback + "&trk=prof-0-sb-connect-button"));
                }

                if (string.IsNullOrEmpty(pageSource1))
                {
                    Log("[ " + DateTime.Now + " ] => [ Page Source Is Null ! ]");

                    Log("[ " + DateTime.Now + " ] => [ Process Completed With Username >>> " + _UserName + " ]");

                    return;
                }
                if (!pageSource1.Contains("emailAddress-invitee-invitation"))
                {
                    SendInvitation(ref httpHelper, pageSource1, key, authToken, goback, firstName_Guest, lastName_Guest);
                }

                if (pageSource1.Contains("emailAddress-invitee-invitation"))
                {
                    Log("[ " + DateTime.Now + " ] => [ Invitation already sent to " + firstName_Guest + lastName_Guest + " from >>> " + _UserName + " ]");
                    Log("[ " + DateTime.Now + " ] => [ -----------------------------------------------------------------------------------------------]");
                }
            }
            catch (Exception ex)
            {
                //Log("[ " + DateTime.Now + " ] => [ Error >>> ex.Message >>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ex.StackTrace >>> " + ex.StackTrace + " ]");
            }
        }
Example #22
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;
        }
        private void CrawlingLinkedInPage(string Url, ref GlobusHttpHelper HttpHelper)
        {
            #region Data Initialization
            string GroupMemId = string.Empty;
            string Industry = string.Empty;
            string URLprofile = string.Empty;
            string firstname = string.Empty;
            string lastname = string.Empty;
            string location = string.Empty;
            string state = 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 html = 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> Checklist = 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 Company = string.Empty;
            List<string> lstpasttitle = new List<string>();
            List<string> checkpasttitle = new List<string>();
            #endregion

            #region

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

            #endregion

            #region GroupMemId
            try
            {
                string[] gid = Url.Split('&');
                GroupMemId = gid[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("fmt__full_name\":"), (stringSource.IndexOf(",", stringSource.IndexOf("fmt__full_name\":")) - stringSource.IndexOf("fmt__full_name\":"))).Replace("fmt__full_name\":", string.Empty).Replace("\\u002d", "-").Replace("\"", string.Empty).Replace(",", string.Empty).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 (Exception ex)
            {
                Console.WriteLine("Error >>> " + ex.StackTrace);
            }
            #endregion

            #region LastName

            lastname = NameArr[1];

            try
            {
                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

            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("\\u002d", "-").Replace("   ", string.Empty).Trim();
                }
                catch { }

                if (string.IsNullOrEmpty(Company))
                {

                    try
                    {
                        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("\\u002d", "-").Replace("   ", string.Empty).Replace("u002d", string.Empty).Trim();
                    }
                    catch { }

                }

                string[] strdesigandcompany = new string[4];
                if (Company.Contains(" at "))
                {
                    try
                    {
                        strdesigandcompany = Regex.Split(Company, " at ");
                    }
                    catch { }

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

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

            #region PastCompany
            string[] companylist = new string[] { };
            string[] companyUrlList = new string[] { };

            try
            {
                companylist = Regex.Split(stringSource, "title_highlight");
            }
            catch { }

            string AllComapny = string.Empty;

            string Companyname = string.Empty;
            string ComapnyUrl = string.Empty;
            foreach (string item in companylist)
            {
                try
                {
                    if (!item.Contains("<!DOCTYPE html>"))
                    {

                        try
                        {
                            int startindex = item.IndexOf("company_name");
                            string start = item.Substring(startindex);
                            int endIndex = start.IndexOf(",");
                            Companyname = (start.Substring(0, endIndex).Replace("\"", string.Empty).Replace(":", string.Empty).Replace("&amp", "&").Replace("company_name", string.Empty).Replace(";", string.Empty).Replace("\\u002d", "-").Replace("name:", string.Empty));

                            int startindex1 = item.IndexOf("biz_logo");
                            string start1 = item.Substring(startindex1);
                            int endIndex1 = start1.IndexOf("&trk");
                            ComapnyUrl = (start1.Substring(0, endIndex1).Replace("\"", string.Empty).Replace(":", string.Empty).Replace("&amp", "&").Replace("company_name", string.Empty).Replace(";", string.Empty).Replace("\\u002d", "-").Replace("name:", string.Empty).Replace("biz_logo", "http://www.linkedin.com"));

                        }
                        catch { }

                        checkerlst.Add(Companyname + "@" + ComapnyUrl);

                    }
                }
                catch { }
            }
            foreach (string item1 in checkerlst)
            {
                try
                {
                    string compUrl = item1.Split('@')[1];
                    string stringSourceCompUrl = HttpHelper.getHtmlfromUrl1(new Uri(compUrl));
                    string companyUrl = string.Empty;

                    try
                    {
                        companyUrl = stringSourceCompUrl.Substring(stringSourceCompUrl.IndexOf("<h4>Website</h4>"), (stringSourceCompUrl.IndexOf("</a>", stringSourceCompUrl.IndexOf("<h4>Website</h4>")) - stringSourceCompUrl.IndexOf("<h4>Website</h4>"))).Replace("<h4>Website</h4>", string.Empty).Replace("</a>", string.Empty).Trim();
                        companyUrl = Regex.Split(companyUrl, "target=\"_blank\">")[1];
                    }
                    catch { }

                    if (AllComapny == string.Empty)
                    {
                        AllComapny = item1.Split('@')[0] + "@" + companyUrl;
                    }
                    else
                    {
                        AllComapny = AllComapny + " : " + item1.Split('@')[0] + "@" + companyUrl;
                    }

                }
                catch { }
            }
            #endregion

            #endregion Company

            #region Education
            try
            {
                string[] str_UniversityName = Regex.Split(stringSource, "link__school_name");
                foreach (string item in str_UniversityName)
                {
                    try
                    {
                        string School = string.Empty;
                        string Degree = string.Empty;
                        string SessionEnd = string.Empty;
                        string SessionStart = string.Empty;
                        string Education = string.Empty;

                        if (!item.Contains("<!DOCTYPE html>"))
                        {
                            try
                            {
                                try
                                {
                                    int startindex = item.IndexOf("fmt__school_highlight");
                                    string start = item.Substring(startindex).Replace("fmt__school_highlight", "");
                                    int endindex = start.IndexOf(",");
                                    School = start.Substring(0, endindex).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty);
                                }
                                catch { }

                                try
                                {
                                    int startindex1 = item.IndexOf("degree");
                                    string start1 = item.Substring(startindex1).Replace("degree", "");
                                    int endindex1 = start1.IndexOf(",");
                                    Degree = start1.Substring(0, endindex1).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty);
                                }
                                catch { }

                                try
                                {
                                    int startindex2 = item.IndexOf("enddate_my");
                                    string start2 = item.Substring(startindex2).Replace("enddate_my", "");
                                    int endindex2 = start2.IndexOf(",");
                                    SessionEnd = start2.Substring(0, endindex2).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty);
                                }
                                catch { }

                                try
                                {
                                    int startindex3 = item.IndexOf("startdate_my");
                                    string start3 = item.Substring(startindex3).Replace("startdate_my", "");
                                    int endindex3 = start3.IndexOf(",");
                                    SessionStart = start3.Substring(0, endindex3).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty);
                                }
                                catch { }

                                if (SessionStart == string.Empty && SessionEnd == string.Empty)
                                {
                                    Education = " [" + School + "] Degree: " + Degree;
                                }
                                else
                                {
                                    Education = " [" + School + "] Degree: " + Degree + " Session: " + SessionStart + "-" + SessionEnd;
                                }
                                //University = item.Substring(item.IndexOf(":"), (item.IndexOf(",", item.IndexOf(":")) - item.IndexOf(":"))).Replace(":", string.Empty).Replace("\\u002d", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                            }
                            catch { }
                            EducationList.Add(Education);

                        }
                    }
                    catch { }
                }

                EducationList = EducationList.Distinct().ToList();

                foreach (string item in EducationList)
                {
                    if (string.IsNullOrEmpty(EducationCollection))
                    {
                        EducationCollection = item.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                    }
                    else
                    {
                        EducationCollection = EducationCollection + "  -  " + item.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                    }
                }
                // string University1 = 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).Replace(":", string.Empty).Trim();

            }

            catch { }

            #endregion Education

            #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).Replace("\\u002d", "-").Trim();
            }

            catch { }

            #endregion Email

            #region Website

            #region Website
            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).Replace("}", string.Empty).Trim();
            }
            catch { }
            #endregion Website

            #endregion Website

            #region location
            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).Replace("\\u002d", "-").Replace("]", string.Empty).Replace("}", string.Empty).Trim();
            }
            catch { }
            // fmt_location

            if (string.IsNullOrEmpty(location))
            {
                try
                {
                    location = stringSource.Substring(stringSource.IndexOf("fmt_location\":"), (stringSource.IndexOf(",", stringSource.IndexOf("fmt_location\":")) - stringSource.IndexOf("fmt_location\":"))).Replace("fmt_location\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("\\u002d", "-").Replace("]", string.Empty).Replace("}", string.Empty).Trim();

                }
                catch { }
            }

            #endregion location

            #region state

            int startindexState = stringSource.IndexOf("location_highlight");
            string Statestart = stringSource.Substring(startindexState);
            int StateendIndex = Statestart.IndexOf("industry_highlight");
            state = (Statestart.Substring(0, StateendIndex).Replace("location_highlight", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("deferImgtrue,", string.Empty));
            try
            {
                state = state.Split(',')[1].Replace("Area", string.Empty).Replace("]", string.Empty).Replace("}", string.Empty).Trim();
            }
            catch { }

            #endregion

            #region Country
            try
            {
                int startindexCountry = stringSource.IndexOf("displayCountry");
                string Countrystart = stringSource.Substring(startindexCountry);
                int CountryendIndex = Countrystart.IndexOf("displayLanguage");
                country = (Countrystart.Substring(0, CountryendIndex).Replace("displayCountry", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace("]", string.Empty).Replace("}", string.Empty));

            }
            catch { }

            #endregion

            #region Industry
            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).Replace("<strong class=highlight>", string.Empty).Replace("</strong>", string.Empty).Replace("\\u002d", "-").Replace("]", string.Empty).Replace("}", string.Empty).Trim();
            }
            catch { }

            if (string.IsNullOrEmpty(Industry))
            {
                try
                {
                    Industry = stringSource.Substring(stringSource.IndexOf("industry_highlight\":"), (stringSource.IndexOf(",", stringSource.IndexOf("industry_highlight\":")) - stringSource.IndexOf("industry_highlight\":"))).Replace("industry_highlight\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("<strong class=highlight>", string.Empty).Replace("</strong>", string.Empty).Replace("\\u002d", "-").Replace("]", string.Empty).Replace("}", string.Empty).Trim();
                }
                catch { }
                //industry_highlight":
            }
            #endregion Industry

            #region Connection
            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();
            }
            catch { }
            //numberOfConnections":
            if (string.IsNullOrEmpty(Connection))
            {
                try
                {
                    Connection = stringSource.Substring(stringSource.IndexOf("numberOfConnections\":"), (stringSource.IndexOf("}", stringSource.IndexOf("numberOfConnections\":")) - stringSource.IndexOf("numberOfConnections\":"))).Replace("numberOfConnections\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("\\u002d", "-").Replace("connectionsBrowseabletrue", string.Empty).Trim();

                }
                catch { }
            }

            #endregion Connection

            #region Recommendation

            try
            {
                string RecomnedUrl = string.Empty;
                try
                {
                    int startindex = stringSource.IndexOf("endorsements?id=");
                    string start = stringSource.Substring(startindex);
                    int endIndex = start.IndexOf("\"mem_pic\":");
                    RecomnedUrl = (start.Substring(0, endIndex).Replace(",", string.Empty).Replace("\"", string.Empty).Replace(":", string.Empty).Replace("]", string.Empty).Replace("}", string.Empty));

                }
                catch { }

                string PageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/profile-v2-" + RecomnedUrl + ""));
                string[] arrayRecommendedName = Regex.Split(PageSource, "headline");

                if (arrayRecommendedName.Count() == 1)
                {
                    arrayRecommendedName = Regex.Split(PageSource, "fmt__recommendeeFullName");
                }

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

                foreach (var itemRecomName in arrayRecommendedName)
                {
                    try
                    {
                        if (!itemRecomName.Contains("Endorsements"))
                        {
                            string Heading = string.Empty;
                            string Name = string.Empty;

                            try
                            {

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

                            try
                            {
                                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));
                            }
                            catch { }

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

                            ListRecommendationName.Add(Name + " : " + Heading);

                        }
                    }
                    catch { }

                }

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

            }
            catch { }

            #endregion

            #region Experience
            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 item in ListExperince)
                    {
                        if (LDS_Experience == string.Empty)
                        {
                            LDS_Experience = item;
                        }
                        else
                        {
                            LDS_Experience += "  -  " + item;
                        }
                    }

                }
                catch { }
            }

            #endregion

            #region Group

            try
            {
                string GroupUrl = string.Empty;
                try
                {
                    int startindex = stringSource.IndexOf("templateId\":\"profile_v2_connections");
                    string start = stringSource.Substring(startindex);
                    int endIndex = start.IndexOf("&goback");
                    GroupUrl = (start.Substring(0, endIndex).Replace(",", string.Empty).Replace("\"", string.Empty).Replace("templateId:profile_v2_connectionsurl:", string.Empty));

                }
                catch { }

                string PageSource = HttpHelper.getHtmlfromUrl1(new Uri(GroupUrl));

                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 item in ListGroupName)
                {
                    if (groupscollectin == string.Empty)
                    {
                        groupscollectin = item;
                    }
                    else
                    {
                        groupscollectin += "  -  " + item;
                    }
                }

            }
            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 item in strarr_skill)
                    {
                        try
                        {
                            if (!item.Contains("!DOCTYPE html"))
                            {
                                try
                                {
                                    string Grp = item.Substring(item.IndexOf("<"), (item.IndexOf(">", item.IndexOf("<")) - item.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 item in checkgrplist)
                    {
                        try
                        {
                            if (Skill == string.Empty)
                            {
                                Skill = item;
                            }
                            else
                            {
                                Skill = Skill + "  :  " + item;
                            }
                        }
                        catch { }

                    }
                }
                else
                {
                    if (strarr_skill1.Count() >= 2)
                    {
                        try
                        {

                            foreach (string skillitem in strarr_skill1)
                            {
                                try
                                {
                                    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 { }
                                    }

                                }
                                catch { }

                            }

                            foreach (string item in checkgrplist)
                            {
                                try
                                {
                                    if (Skill == string.Empty)
                                    {
                                        Skill = item;
                                    }
                                    else
                                    {
                                        Skill = Skill + "  :  " + item;
                                    }
                                }
                                catch { }

                            }
                        }
                        catch { }
                    }
                }
            }
            catch { }

            #endregion

            #region Pasttitle
            string[] pasttitles = Regex.Split(stringSource, "title_highlight");
            string pstTitlesitem = string.Empty;
            pasttitles = pasttitles.Skip(1).ToArray();
            foreach (string item in pasttitles)
            {
                try
                {

                    if (!item.Contains("<!DOCTYPE html>") && !item.Contains("Tip: You can also search by keyword"))
                    {

                        try
                        {
                            string[] Past_Ttl = Regex.Split(item, ",");
                            pstTitlesitem = Past_Ttl[0].Replace(":", string.Empty).Replace("\"", string.Empty).Replace("\\u002d", "-").Replace("&amp;", "&");
                        }
                        catch { }

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

                    }

                }
                catch
                {
                }
            }
            #endregion

            #region ProfileUrl

            try
            {
                LDS_UserProfileLink = Url;

            }
            catch { }
            #endregion

            #region Data Saved In CSV File

            if (!string.IsNullOrEmpty(firstname) || !string.IsNullOrEmpty(lastname) || !string.IsNullOrEmpty(Company))
            {
                try
                {
                    string CSVHeader = "ProfileType" + "," + "UserProfileLink" + "," + "FirstName" + "," + "LastName" + "," + "PostalCode" + "," + "Distance From Postal" + "," + "HeadLineTitle" + "," + "CurrentTitle " + "," + "Company" + "," + "Connection" + "," + "Recommendations " + "," + "SkillAndExpertise " + "," + "Experience " + "," + " Education" + "," + "Groups" + "," + "UserEmail" + "," + "UserContactNumber" + "," + "PastTitles" + "," + "PastCompany With Company Urls" + "," + "City" + "," + "State" + "," + "Country" + "," + "Industry" + "," + "WebSites" + "," + "LinkedInLoginID" + "," + "DateTimeOfCrawl";
                    string CSV_Content = TypeOfProfile + "," + LDS_UserProfileLink + "," + firstname + "," + lastname + "," + postalCode + "," + distance + "," + Company.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + companycurrent.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(",", ";") + "," + location.Replace(",", ";") + "," + state.Replace(",", ";") + "," + country.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + Website.Replace(",", ";") + "," + accountUser + "," + DateTime.Now;// +TypeOfProfile + ",";

                    if (SelectedMode == "Mode1")
                    {
                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_InBoardProGetDataResultLastNameWiseData);
                    }
                    else if (SelectedMode == "Mode2")
                    {
                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_InBoardProGetDataResultIndustryZoneWiseData);
                    }
                    else if (SelectedMode == "Mode3")
                    {
                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_InBoardProGetDataResultZipCodeWiseData);
                    }

                    Log("[ " + DateTime.Now + " ] => [ " + "Data Saved In CSV File ! ]");
                }
                catch { }
            }

            #endregion
        }
Example #24
0
        public Dictionary<string, string> GetSelectedIDForPendingGroups(ref GlobusHttpHelper HttpHelper, string user)
        {
            string GetID = string.Empty;
            Dictionary<string, string> GroupPendingDtl = new Dictionary<string, string>();

            try
            {
                string pageSourceforGroup = string.Empty;

                try
                {
                    pageSourceforGroup = HttpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/anet?dispSortAnets=&trk=my_groups-h_gn-settings"));
                    //pageSourceforGroup = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/grp/"));

                }
                catch { }

                string[] RgxGroupDataforGroup = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "<td class=\"group-name\">");

                foreach (string item in RgxGroupDataforGroup)
                {
                    string GroupUrl = string.Empty;
                    string GroupNames = string.Empty;
                    string GroupIds = string.Empty;

                    try
                    {

                        if (!item.Contains("<!DOCTYPE html>") && item.Contains("groups") && !item.Contains("manageGroup"))
                        {

                            try
                            {
                                int startindex = item.IndexOf("<strong>");
                                string start = item.Substring(startindex);
                                int endIndex = start.IndexOf("</strong>");
                                GroupNames = start.Substring(0, endIndex).Replace("<strong>", string.Empty).Trim();

                                if (item.Contains("Pending"))
                                {
                                    GroupNames = GroupNames + " (Pending Group)" + ':' + user;
                                }
                                else
                                {
                                    GroupNames = GroupNames + " (Open Group)" + ':' + user;
                                }

                            }
                            catch (Exception ex)
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update1 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                            }

                            try
                            {
                                GroupIds = "";
                                int startindex1 = item.IndexOf("?gid=");
                                string start1 = item.Substring(startindex1);
                                int endIndex1 = start1.IndexOf("\">");
                                GroupIds = start1.Substring(0, endIndex1).Replace("?gid=", string.Empty).Trim();
                                if (!NumberHelper.ValidateNumber(GroupIds))
                                {
                                    try
                                    {
                                        GroupIds = GroupIds.Split('\"')[0];
                                    }
                                    catch { }
                                }

                                if (GroupIds == string.Empty)
                                {
                                    startindex1 = item.IndexOf("group");
                                    start1 = item.Substring(startindex1);
                                    endIndex1 = start1.IndexOf("?");
                                    GroupIds = start1.Substring(0, endIndex1).Replace("groups", string.Empty).Replace("/", string.Empty).Replace("<a href=", string.Empty).Replace("\"", string.Empty);

                                    if (!NumberHelper.ValidateNumber(GroupIds))
                                    {
                                        try
                                        {
                                            GroupIds = GroupIds.Split('\"')[0];
                                        }
                                        catch { }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus2 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update2 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                            }

                            if (GroupIds.Contains("analyticsURL"))
                            {
                                continue;
                            }

                            if (GroupIds == string.Empty)
                            {
                                try
                                {
                                    int startindex2 = item.IndexOf("gid=");
                                    string start2 = item.Substring(startindex2);
                                    int endIndex2 = start2.IndexOf("&");
                                    GroupIds = start2.Substring(0, endIndex2).Replace("gid", string.Empty).Replace("=", string.Empty);
                                }
                                catch (Exception ex)
                                {
                                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus3 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update3 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                }
                            }
                            else
                            {
                                string[] endKeyLast = GroupIds.Split('-');
                                try
                                {
                                    if (NumberHelper.ValidateNumber(endKeyLast[1]))
                                    {
                                        GroupIds = endKeyLast[1];
                                    }
                                    else if (NumberHelper.ValidateNumber(endKeyLast[2]))
                                    {
                                        GroupIds = endKeyLast[2];
                                    }
                                    else if (NumberHelper.ValidateNumber(endKeyLast[3]))
                                    {
                                        GroupIds = endKeyLast[3];
                                    }
                                    else if (NumberHelper.ValidateNumber(endKeyLast[4]))
                                    {
                                        GroupIds = endKeyLast[4];
                                    }
                                    else if (NumberHelper.ValidateNumber(endKeyLast[5]))
                                    {
                                        GroupIds = endKeyLast[5];
                                    }
                                    else if (NumberHelper.ValidateNumber(endKeyLast[6]))
                                    {
                                        GroupIds = endKeyLast[6];
                                    }
                                }
                                catch { }
                            }

                            try
                            {
                                GroupPendingDtl.Add(GroupNames, GroupIds);
                            }
                            catch { }

                        }
                    }
                    catch { }
                }

                return GroupPendingDtl;
            }
            catch (Exception ex)
            {
                return GroupPendingDtl;
            }
        }
        public void StartCampaignInBoardProGetDataWithPagination(ref GlobusHttpHelper HttpHelper, string Account, string FirstName, string LastName, string Location, string Country, string LocationArea, string PostalCode, string Company, string Keyword, string Title, string IndustryType, string Relationship, string language, string Groups, string FileName, string TitleValue, string CompanyValue, string within, string YearsOfExperience, string Function, string SeniorLevel, string IntrestedIn, string CompanySize, string Fortune1000, string RecentlyJoined)
        {
            string ResponseWallPostForPremiumAcc = string.Empty;
            string NewSearchPage = string.Empty;
            string PostResponce = string.Empty;
            string PostRequestURL = string.Empty;
            string PostdataForPagination = string.Empty;
            string csrfToken = string.Empty;
            Queue<string> queRecordUrl = new Queue<string>();
            List<string> RecordURL = new List<string>();

            #region Login
            try
            {
                //Temprary class
                //======================================================
                //string tempurl = "http://www.linkedin.com/profile/view?id=224916256&authType=OUT_OF_NETWORK&authToken=SWNz&locale=en_US&srchid=3387141351401255871148&srchindex=1&srchtotal=2017&trk=vsrp_people_res_name&trkInfo=VSRPsearchId%3A3387141351401255871148%2CVSRPtargetId%3A224916256%2CVSRPcmpt%3Aprimary";
                //CrawlingLinkedInPage(tempurl, ref HttpHelper);
                //======================================================

                if (SearchCriteria.starter)
                {
                    #region Serch

                    string pageSourceaAdvanceSearch = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/search"));
                    NewSearchPage = string.Empty;

                    if (pageSourceaAdvanceSearch.Contains("csrfToken"))
                    {
                        try
                        {
                            int startindex = pageSourceaAdvanceSearch.IndexOf("csrfToken");
                            if (startindex > 0)
                            {
                                string start = pageSourceaAdvanceSearch.Substring(startindex);
                                int endindex = start.IndexOf(">");
                                string end = start.Substring(0, endindex);
                                csrfToken = end.Replace("csrfToken=", "").Replace("\\", "").Replace("\"", string.Empty); ;
                            }
                        }
                        catch { }

                    }

                    try
                    {
                        if (Location == "Y")
                        {
                            Country = string.Empty;
                        }

                        //if (NewSearchPage == string.Empty)
                        //{
                        //    string PostDataForPrimiumAccount = "csrfToken=" + csrfToken + "&keepFacets=true&pplSearchOrigin=ADVS&keywords=" + Uri.EscapeDataString(SearchCriteria.Keyword) + "&fname=" + SearchCriteria.FirstName + "&lname=" + SearchCriteria.LastName + "&companyScope=" + SearchCriteria.CompanyValue + "&searchLocationType=" + SearchCriteria.Location + "&countryCode=" + SearchCriteria.Country + "&postalCode=" + SearchCriteria.PostalCode + "&distance=" + SearchCriteria.within + "&title=&company=" + SearchCriteria.Company + "&currentCompany=" + SearchCriteria.CompanyValue + "&school=&I=" + SearchCriteria.IndustryType + "&FG=" + SearchCriteria.Group + "&N=" + SearchCriteria.Relationship + "&L=" + SearchCriteria.language + "&FA=" + SearchCriteria.Function + "&CS=" + SearchCriteria.CompanySize + "&SE=" + SearchCriteria.SeniorLevel + "&P=" + SearchCriteria.InerestedIn + "&TE=" + SearchCriteria.YearOfExperience + "&DR=" + SearchCriteria.RecentlyJoined + "&F=" + SearchCriteria.Fortune1000 + "&sortCriteria=R&viewCriteria=2&%2Fsearch%2Ffpsearch=Search";
                        //    ResponseWallPostForPremiumAcc = HttpHelper.postFormData(new Uri("http://www.linkedin.com/search/fpsearch"), PostDataForPrimiumAccount);
                        //}
                        //else
                        {
                            string GetDataForPrimiumAccount = string.Empty;
                            GetDataForPrimiumAccount = "http://www.linkedin.com/vsearch/p?openAdvancedForm=true&keywords=" + Uri.EscapeDataString(Keyword) + "&title=" + Title + "&titleScope=" + TitleValue + "&firstName=" + FirstName + "&lastName=" + LastName + "&postalCode=" + PostalCode + "&companyScope=" + CompanyValue + "&locationType=" + Location + "&countryCode=" + Country + "&company=" + Company + "&distance=" + within + "&f_FG=" + Groups + "&f_L=" + language + "&f_N=" + Relationship + "&f_G=" + LocationArea + "&f_I=" + IndustryType + "&f_TE=" + YearsOfExperience + "&f_FA=" + Function + "&f_SE=" + SeniorLevel + "&f_P=" + IntrestedIn + "&f_CS=" + CompanySize + "&f_F=" + Fortune1000 + "&f_DR=" + RecentlyJoined + "&orig=ADVS";
                            ResponseWallPostForPremiumAcc = HttpHelper.getHtmlfromUrl1(new Uri(GetDataForPrimiumAccount));

                        }

                    }
                    catch { }

                    string facetsOrder = string.Empty;
                    if (PostResponce.Contains("facetsOrder"))
                    {
                        facetsOrder = ResponseWallPostForPremiumAcc.Substring(PostResponce.IndexOf("facetsOrder"), 200);
                        string[] Arr3 = facetsOrder.Split('"');
                        facetsOrder = Arr3[2];
                        string DecodedCharTest = Uri.UnescapeDataString(facetsOrder);
                        string DecodedEmail = Uri.EscapeDataString(facetsOrder);
                        facetsOrder = DecodedEmail;
                    }
                    #endregion
                }
                int pagenumber = 0;
                string strPageNumber = string.Empty;
                string[] Arr12 = Regex.Split(ResponseWallPostForPremiumAcc, "<li");
                foreach (string item in Arr12)
                {
                    if (SearchCriteria.starter)
                    {
                        #region Loop
                        if (!item.Contains("<!DOCTYPE"))
                        {
                            if (item.Contains("results-summary"))
                            {
                                string data = RemoveAllHtmlTag.StripHTML(item);
                                data = data.Replace("\n", "");
                                if (data.Contains(">"))
                                {
                                    string[] ArrTemp = data.Split('>');
                                    data = ArrTemp[1];
                                    data = data.Replace("results", "");
                                    data = data.Trim();
                                    string[] ArrTemp1 = data.Split(' ');
                                    data = ArrTemp1[0].Replace(',', ' ').Trim();
                                    strPageNumber = data.Replace(" ", string.Empty);
                                    break;
                                }

                            }
                        }
                        #endregion
                    }
                }

                if (string.IsNullOrEmpty(strPageNumber))
                {
                    try
                    {
                        if (ResponseWallPostForPremiumAcc.Contains("resultCount"))
                        {
                            string[] countResultArr = Regex.Split(ResponseWallPostForPremiumAcc, "resultCount");

                            if (countResultArr.Length > 1)
                            {
                                string tempResult = countResultArr[1].Substring(0, countResultArr[1].IndexOf(","));

                                if (tempResult.Contains("<strong>"))
                                {
                                    strPageNumber = tempResult.Substring(tempResult.IndexOf("<strong>"), tempResult.IndexOf("</strong>", tempResult.IndexOf("<strong>")) - tempResult.IndexOf("<strong>")).Replace("<strong>", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim();
                                }
                                else if (tempResult.Contains(":"))
                                {
                                    strPageNumber = tempResult.Replace(":", string.Empty).Replace("\"", string.Empty);
                                }
                            }
                        }
                    }
                    catch (Exception)
                    {

                    }
                }

                if (string.IsNullOrEmpty(strPageNumber))
                {
                    try
                    {
                        if (ResponseWallPostForPremiumAcc.Contains("results_count_without_keywords_i18n"))
                        {
                            string[] countResultArr = Regex.Split(ResponseWallPostForPremiumAcc, "results_count_without_keywords_i18n");

                            if (countResultArr.Length > 1)
                            {
                                string tempResult = countResultArr[1].Substring(0, countResultArr[1].IndexOf(","));

                                if (tempResult.Contains("<strong>"))
                                {
                                    strPageNumber = tempResult.Substring(tempResult.IndexOf("<strong>"), tempResult.IndexOf("</strong>", tempResult.IndexOf("<strong>")) - tempResult.IndexOf("<strong>")).Replace("<strong>", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim();
                                }
                                else if (tempResult.Contains(":"))
                                {
                                    strPageNumber = tempResult.Replace(":", string.Empty).Replace("\"", string.Empty);
                                }
                            }
                        }
                    }
                    catch (Exception)
                    {

                    }
                }

                string logtag = string.Empty;

                try
                {
                    pagenumber = int.Parse(strPageNumber);

                    AddToLogger("[ " + DateTime.Now + " ] => [ Total Results :  " + pagenumber + " ]");
                }
                catch (Exception)
                {

                }

                pagenumber = (pagenumber / 10) + 1;

                if (pagenumber == -1)
                {
                    pagenumber = 2;
                }

                if (pagenumber == 1)
                {
                    pagenumber = 2;
                }

                string GetResponce = string.Empty;
                string GetRequestURL = string.Empty;

                if (pagenumber >= 1)
                {
                    _HttpHelper = HttpHelper;

                    //new Thread(() =>
                   // {
                        if (SearchCriteria.starter)
                        {
                            //string CheckString = "CampaignScraper" + FileName;
                            //finalUrlCollection(RecordURL);

                        }

                   // }).Start();

                    for (int i = 1; i <= pagenumber; i++)
                    {
                        if (SearchCriteria.starter)
                        {
                            #region loop

                            if (ResponseWallPostForPremiumAcc.Contains("Account Type:</span> Basic"))
                            {
                                try
                                {
                                    PostRequestURL = "http://www.linkedin.com/search/hits";
                                    PostdataForPagination = "keywords=" + Uri.EscapeDataString(Keyword) + "&title=" + Uri.EscapeDataString(Title) + "&fname=" + FirstName + "&lname=" + LastName + "&searchLocationType=" + Location + "&f_FG=" + Groups + "&companyScope=" + CompanyValue + "&countryCode=" + Country + "&company=" + Company + "&viewCriteria=1&sortCriteria=R&facetsOrder=CC%2CN%2CG%2CI%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR&page_num=" + i + "&openFacets=N%2CCC%2CG";
                                    PostResponce = HttpHelper.postFormData(new Uri(PostRequestURL), PostdataForPagination);
                                    //Temporosy code for client
                                    //GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Pagesource 3 >>>> " + PostResponce, Globals.Path_InBoardProGetDataPagesource);

                                }
                                catch { }
                            }
                            else if (ResponseWallPostForPremiumAcc.Contains("Account Type:</span> Executive"))
                            {
                                try
                                {
                                    PostRequestURL = "http://www.linkedin.com/search/hits";
                                    PostdataForPagination = "keywords=" + Uri.EscapeDataString(Keyword) + "&title=" + Uri.EscapeDataString(Title) + "&fname=" + FirstName + "&lname=" + LastName + "&searchLocationType=" + Location + "&f_FG=" + Groups + "&companyScope=" + CompanyValue + "&countryCode=" + Country + "&keepFacets=keepFacets&I=" + IndustryType + "&SE=" + SeniorLevel + "&pplSearchOrigin=ADVS&viewCriteria=2&sortCriteria=R&facetsOrder=N%2CCC%2CI%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR%2CG&page_num=" + i + "&openFacets=N%2CCC%2CI";

                                    PostResponce = HttpHelper.postFormData(new Uri(PostRequestURL), PostdataForPagination);
                                    //Temporosy code for client
                                    //GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Pagesource 3 >>>> " + PostResponce, Globals.Path_InBoardProGetDataPagesource);
                                }
                                catch { }
                            }
                            else if (ResponseWallPostForPremiumAcc.Contains("openAdvancedForm=true"))
                            {
                                PostRequestURL = "http://www.linkedin.com/vsearch/p?";
                                PostdataForPagination = "keywords=" + Uri.EscapeDataString(Keyword) + "&title=" + Uri.EscapeDataString(Title) + "&titleScope=" + TitleValue + "&firstName=" + FirstName + "&lastName=" + LastName + "&postalCode=" + PostalCode + "&openAdvancedForm=true&companyScope=" + CompanyValue + "&locationType=" + Location + "&f_FG=" + Groups + "&countryCode=" + Country + "&company=" + Company + "&distance=" + within + "&f_N=" + Relationship + "&f_G=" + LocationArea + "&f_I=" + IndustryType + "&f_TE=" + YearsOfExperience + "&f_FA=" + Function + "&f_SE=" + SeniorLevel + "&f_P=" + IntrestedIn + "&f_CS=" + CompanySize + "&f_F=" + Fortune1000 + "&f_DR=" + RecentlyJoined + "&orig=ADVS&page_num=" + i + "";
                                PostResponce = HttpHelper.postFormData(new Uri(PostRequestURL), PostdataForPagination);
                                //Temporosy code for client
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Pagesource 4 >>>> " + PostResponce, Globals.Path_InBoardProGetDataPagesource);
                            }
                            else
                            {
                                try
                                {
                                    PostRequestURL = "http://www.linkedin.com/search/hits";
                                    PostdataForPagination = "keywords=" + Uri.EscapeDataString(SearchCriteria.Keyword) + "&title=" + Uri.EscapeDataString(Title) + "&fname=" + FirstName + "&lname=" + LastName + "&searchLocationType=" + Location + "&f_FG=" + Groups + "&countryCode=" + Country + "&viewCriteria=1&sortCriteria=R&facetsOrder=CC%2CN%2CG%2CI%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR&page_num=" + i + "&openFacets=N%2CCC%2CG";
                                    PostResponce = HttpHelper.postFormData(new Uri(PostRequestURL), PostdataForPagination);
                                }
                                catch { }
                            }
                            clsDBQueryManager QM = new clsDBQueryManager();
                            if (PostResponce.Contains("/profile/view?id"))
                            {

                                List<string> PageSerchUrl = GettingAllUrl(PostResponce);
                                PageSerchUrl.Distinct();

                                if (PageSerchUrl.Count == 0)
                                {
                                    AddToLogger("[ " + DateTime.Now + " ] => [ On the basis of your Account you can able to see " + RecordURL.Count + " Results ]");
                                    break;
                                }

                                foreach (string item in PageSerchUrl)
                                {
                                    if (SearchCriteria.starter)
                                    {
                                        if (item.Contains("pp_profile_photo_link") || item.Contains("vsrp_people_res_name") || item.Contains("profile/view?"))
                                        {
                                            try
                                            {
                                                string urlSerch = item;
                                                if (urlSerch.Contains("vsrp_people_res_name"))
                                                {
                                                    RecordURL.Add(urlSerch);
                                                    try
                                                    {
                                                        string query = "Insert Into tb_CampaignScraperURL (Url, Account, Status) Values ('" + urlSerch + "','" + Account + "','" + "Not Scraped');";
                                                        QM.InsertUrl(query);
                                                    }
                                                    catch
                                                    { }

                                                    RecordURL = RecordURL.Distinct().ToList();
                                                }

                                                try
                                                {
                                                    AddToLogger("[ " + DateTime.Now + " ] => [ " + urlSerch + " ]");
                                                }
                                                catch { }
                                            }
                                            catch { }
                                        }
                                    }
                                }
                            }

                            else if (!PostResponce.Contains("pp_profile_name_link") && PostResponce.Contains("Custom views are no longer supported. Please select either Basic or Expanded view"))
                            {
                                break;
                            }

                            #endregion
                        }
                    }
                    finalUrlCollection(RecordURL, ref HttpHelper, FileName);

                }
                #region For Else
                else
                {
                    if (SearchCriteria.starter)
                    {

                        #region loop
                        if (ResponseWallPostForPremiumAcc.Contains("/profile/view?id"))
                        {

                            List<string> PageSerchUrl = ChilkatBasedRegex.GettingAllUrls(ResponseWallPostForPremiumAcc, "profile/view?id");
                            if (PageSerchUrl.Count == 0)
                            {

                                AddToLogger("[ " + DateTime.Now + " ] => [ On the basis of your Account or Your Input you can able to see " + RecordURL.Count + "  Results ]");

                            }

                            foreach (string item in PageSerchUrl)
                            {
                                if (SearchCriteria.starter)
                                {
                                    if (item.Contains("pp_profile_name_link"))
                                    {
                                        string urlSerch = "http://www.linkedin.com" + item;
                                        AddToLogger("[ " + DateTime.Now + " ] => [ " + urlSerch + " ]");
                                        RecordURL.Add(urlSerch);
                                        queRecordUrl.Enqueue(urlSerch);

                                    }
                                }
                            }
                        }
                        #endregion
                    }

                }

                //if (strPageNumber != string.Empty)
                //{
                //    if (strPageNumber != "0")
                //    {
                //        AddToLogger("-------------------------------------------------------------------------------------------------------------------------------");
                //        AddToLogger("[ " + DateTime.Now + " ] => [ No Of Results Found >>> " + strPageNumber + " ]");
                //    }
                //}

                RecordURL.Distinct();

            }

                #endregion

            catch { }
            #endregion
        }
Example #26
0
        public Dictionary<string, string> GetSelectedIDForPendingGroups_old(ref GlobusHttpHelper HttpHelper, string user)
        {
            string GetID = string.Empty;
            Dictionary<string, string> GroupPendingDtl = new Dictionary<string, string>();

            try
            {
                     string pageSourceforGroup = string.Empty;
                     //pageSourceforGroup = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/view?id=" + GetID));

                    try
                    {
                        //pageSourceforGroup = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/myGroups?trk=nav_responsive_sub_nav_groups"));
                        pageSourceforGroup = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/grp/"));
                        //if (pageSourceforGroup == "")
                        //{
                        //    Thread.Sleep(2000);
                        //    pageSourceforGroup = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/myGroups?trk=nav_responsive_sub_nav_groups"));
                        //}
                        //if (pageSourceforGroup == "")
                        //{
                        //    Thread.Sleep(2000);
                        //    pageSourceforGroup = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/grp/"));
                        //}
                        //if (pageSourceforGroup == "")
                        //{
                        //    Thread.Sleep(2000);
                        //    pageSourceforGroup = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/grp/"));
                        //}
                    }
                    catch { }

                    //string[] RgxGroupDataforGroup = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "<li class=\"media-block \">");
                      string[] RgxGroupDataforGroup = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "<div class=\"media-content\">");

                    foreach (string item in RgxGroupDataforGroup)
                    {
                        string GroupUrl = string.Empty;
                        string GroupNames = string.Empty;
                        string GroupIds = string.Empty;
                        string CheckOwnGroup = string.Empty;

                        try
                        {

                            //if (!item.Contains("<!DOCTYPE html>") && item.Contains("groups") && item.Contains("Membership Pending"))
                            if (!item.Contains("<!DOCTYPE html>") && item.Contains("groups"))
                            {

                                #region commented old code
                                //try
                                //{
                                //    if (item.Contains("class=\"public\""))
                                //    {
                                //        int startindex = item.IndexOf("class=\"public\"");
                                //        string start = item.Substring(startindex).Replace("class=\"public\"", string.Empty);
                                //        int endindex = start.IndexOf("</a>");
                                //        string end = start.Substring(0, endindex).Replace(">", string.Empty).Replace(":", "-").Replace(",", string.Empty);
                                //        GroupNames = user + ":" + end;
                                //    }
                                //    else if (item.Contains("class=\"private\""))
                                //    {
                                //        int startindex = item.IndexOf("class=\"private\"");
                                //        string start = item.Substring(startindex).Replace("class=\"private\"", string.Empty);
                                //        int endindex = start.IndexOf("</a>");
                                //        string end = start.Substring(0, endindex).Replace(">", string.Empty).Replace(":", "-").Replace(",", string.Empty);
                                //        GroupNames = user + ":" + end;
                                //    }
                                //}
                                //catch { }

                                //if (string.IsNullOrEmpty(GroupIds))
                                //{
                                //    int startindex = item.IndexOf("groups/");
                                //    if (startindex > 0)
                                //    {
                                //        try
                                //        {
                                //            string start = item.Substring(startindex).Replace("groups/", "");
                                //            int endindex = start.IndexOf("?trk");
                                //            string endKey = start.Substring(0, endindex);

                                //            string[] endKeyLast = endKey.Split('-');
                                //            try
                                //            {
                                //                if (NumberHelper.ValidateNumber(endKeyLast[1]))
                                //                {
                                //                    endKey = endKeyLast[1];
                                //                }
                                //                else if (NumberHelper.ValidateNumber(endKeyLast[2]))
                                //                {
                                //                    endKey = endKeyLast[2];
                                //                }
                                //                else if (NumberHelper.ValidateNumber(endKeyLast[3]))
                                //                {
                                //                    endKey = endKeyLast[3];
                                //                }
                                //                else if (NumberHelper.ValidateNumber(endKeyLast[4]))
                                //                {
                                //                    endKey = endKeyLast[4];
                                //                }
                                //                else if (NumberHelper.ValidateNumber(endKeyLast[5]))
                                //                {
                                //                    endKey = endKeyLast[5];
                                //                }
                                //                else if (NumberHelper.ValidateNumber(endKeyLast[6]))
                                //                {
                                //                    endKey = endKeyLast[6];
                                //                }
                                //            }
                                //            catch { }

                                //            GroupIds = endKey;
                                //        }
                                //        catch { }
                                //    }

                                //}

                                //try
                                //{
                                //    GroupPendingDtl.Add(GroupNames, GroupIds);
                                //}
                                //catch { }
                                #endregion

                                try
                                {
                                    string[] UrlCollection = System.Text.RegularExpressions.Regex.Split(item, "<a href=");

                                    foreach (var itemUrl in UrlCollection)
                                    {
                                        if (itemUrl.Contains("trk=my_groups-tile-grp"))
                                        {
                                            try
                                            {
                                                int startind = itemUrl.IndexOf("/groups");
                                                string star = itemUrl.Substring(startind);
                                                int endInd = star.IndexOf("class=");
                                                GroupUrl = "https://www.linkedin.com" + star.Substring(0, endInd).Replace("\"", string.Empty).Replace("amp;", string.Empty).Trim();
                                                break;
                                            }
                                            catch { }
                                        }
                                    }

                                    CheckOwnGroup = HttpHelper.getHtmlfromUrl1(new Uri(GroupUrl));

                                }
                                catch { }

                                if (CheckOwnGroup.Contains("Leave this group.") || CheckOwnGroup.Contains("Your Membership is pending approval by the group owner."))
                                {
                                    if ((item.Contains("public")))
                                    {
                                        try
                                        {
                                            int startindex = item.IndexOf("class=\"public\"");
                                            string start = item.Substring(startindex);
                                            int endIndex = start.IndexOf("</a>");
                                            GroupNames = start.Substring(0, endIndex).Replace("title", string.Empty).Replace("=", string.Empty).Replace(">", string.Empty).Replace("groups", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Replace("&amp;", "&").Replace("classpublic", string.Empty).Replace("&quot;", "'").Replace(":", ";").Replace("This is an open group", string.Empty);

                                            if (item.Contains("Membership Pending"))
                                            {
                                                GroupNames = GroupNames + " (Pending Group)" + ':' + user;
                                            }
                                            else
                                            {
                                                GroupNames = GroupNames + " (Open Group)" + ':' + user;
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update1 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                        }

                                        try
                                        {
                                            GroupIds = "";
                                            int startindex1 = item.IndexOf("gid=");
                                            string start1 = item.Substring(startindex1);
                                            int endIndex1 = start1.IndexOf("&");
                                            GroupIds = start1.Substring(0, endIndex1).Replace("gid=", string.Empty).Trim();
                                            if (!NumberHelper.ValidateNumber(GroupIds))
                                            {
                                                try
                                                {
                                                    GroupIds = GroupIds.Split('\"')[0];
                                                }
                                                catch { }
                                            }

                                            if (GroupIds == string.Empty)
                                            {
                                                startindex1 = item.IndexOf("group");
                                                start1 = item.Substring(startindex1);
                                                endIndex1 = start1.IndexOf("?");
                                                GroupIds = start1.Substring(0, endIndex1).Replace("groups", string.Empty).Replace("/", string.Empty).Replace("<a href=", string.Empty).Replace("\"", string.Empty);

                                                if (!NumberHelper.ValidateNumber(GroupIds))
                                                {
                                                    try
                                                    {
                                                        GroupIds = GroupIds.Split('\"')[0];
                                                    }
                                                    catch { }
                                                }
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus2 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update2 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                        }

                                        if (GroupIds.Contains("analyticsURL"))
                                        {
                                            continue;
                                        }

                                        if (GroupIds == string.Empty)
                                        {
                                            try
                                            {
                                                int startindex2 = item.IndexOf("gid=");
                                                string start2 = item.Substring(startindex2);
                                                int endIndex2 = start2.IndexOf("&");
                                                GroupIds = start2.Substring(0, endIndex2).Replace("gid", string.Empty).Replace("=", string.Empty);
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus3 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update3 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                            }
                                        }
                                        else
                                        {
                                            string[] endKeyLast = GroupIds.Split('-');
                                            try
                                            {
                                                if (NumberHelper.ValidateNumber(endKeyLast[1]))
                                                {
                                                    GroupIds = endKeyLast[1];
                                                }
                                                else if (NumberHelper.ValidateNumber(endKeyLast[2]))
                                                {
                                                    GroupIds = endKeyLast[2];
                                                }
                                                else if (NumberHelper.ValidateNumber(endKeyLast[3]))
                                                {
                                                    GroupIds = endKeyLast[3];
                                                }
                                                else if (NumberHelper.ValidateNumber(endKeyLast[4]))
                                                {
                                                    GroupIds = endKeyLast[4];
                                                }
                                                else if (NumberHelper.ValidateNumber(endKeyLast[5]))
                                                {
                                                    GroupIds = endKeyLast[5];
                                                }
                                                else if (NumberHelper.ValidateNumber(endKeyLast[6]))
                                                {
                                                    GroupIds = endKeyLast[6];
                                                }
                                            }
                                            catch { }
                                        }

                                        try
                                        {
                                            GroupPendingDtl.Add(GroupNames, GroupIds);
                                        }
                                        catch { }
                                    }

                                    //if (!item.Contains("<!DOCTYPE html>") && item.Contains("groups") && item.Contains("Membership Pending"))
                                    if (!item.Contains("<!DOCTYPE html>") && item.Contains("groups"))
                                    {
                                        if ((item.Contains("private")))
                                        {
                                            try
                                            {
                                                int startindex = item.IndexOf("class=\"private\"");
                                                string start = item.Substring(startindex);
                                                int endIndex = start.IndexOf("</a>");
                                                GroupNames = start.Substring(0, endIndex).Replace("=", string.Empty).Replace(">", string.Empty).Replace("groups", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Replace("&amp;", "&").Replace("&quot;", "'").Replace(":", ";").Replace("classprivate", string.Empty);

                                                if (item.Contains("Membership Pending"))
                                                {
                                                    GroupNames = GroupNames + " (Pending Group)" + ':' + user;
                                                }
                                                else
                                                {
                                                    GroupNames = GroupNames + " (Open Group)" + ':' + user;
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus4 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update4 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                            }

                                            try
                                            {
                                                int startindex1 = item.IndexOf("gid=");
                                                string start1 = item.Substring(startindex1);
                                                int endIndex1 = start1.IndexOf("&");
                                                GroupIds = start1.Substring(0, endIndex1).Replace("gid=", string.Empty).Replace("/", string.Empty).Replace("<a href=", string.Empty).Replace("\"", string.Empty).Replace("class=blanket-target><a>groups?home=", string.Empty).Trim();

                                                if (GroupIds == string.Empty)
                                                {
                                                    try
                                                    {
                                                        GroupIds = GroupIds.Split(' ')[0].Trim();
                                                    }
                                                    catch { }
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus5 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update5 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                            }

                                            if (GroupIds.Contains("analyticsURL"))
                                            {
                                                continue;
                                            }

                                            if (GroupIds == string.Empty)
                                            {
                                                try
                                                {
                                                    int startindex2 = item.IndexOf("gid=");
                                                    string start2 = item.Substring(startindex2);
                                                    int endIndex2 = start2.IndexOf("&");
                                                    GroupIds = start2.Substring(0, endIndex2).Replace("gid", string.Empty).Replace("=", string.Empty);

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

                                                }
                                                catch (Exception ex)
                                                {
                                                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus6 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update6 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                                }
                                            }
                                            else
                                            {
                                                string[] endKeyLast = GroupIds.Split('-');
                                                try
                                                {
                                                    if (NumberHelper.ValidateNumber(endKeyLast[1]))
                                                    {
                                                        GroupIds = endKeyLast[1];
                                                    }
                                                    else if (NumberHelper.ValidateNumber(endKeyLast[2]))
                                                    {
                                                        GroupIds = endKeyLast[2];
                                                    }
                                                    else if (NumberHelper.ValidateNumber(endKeyLast[3]))
                                                    {
                                                        GroupIds = endKeyLast[3];
                                                    }
                                                    else if (NumberHelper.ValidateNumber(endKeyLast[4]))
                                                    {
                                                        GroupIds = endKeyLast[4];
                                                    }
                                                    else if (NumberHelper.ValidateNumber(endKeyLast[5]))
                                                    {
                                                        GroupIds = endKeyLast[5];
                                                    }
                                                    else if (NumberHelper.ValidateNumber(endKeyLast[6]))
                                                    {
                                                        GroupIds = endKeyLast[6];
                                                    }
                                                }
                                                catch { }
                                            }

                                            try
                                            {
                                                GroupPendingDtl.Add(GroupNames, GroupIds);
                                            }
                                            catch { }
                                        }

                                        #region Commented old code

                                        //try
                                        //{
                                        //    if (item.Contains("class=\"public\""))
                                        //    {
                                        //        int startindex = item.IndexOf("class=\"public\"");
                                        //        string start = item.Substring(startindex).Replace("class=\"public\"", string.Empty);
                                        //        int endindex = start.IndexOf("</a>");
                                        //        string end = start.Substring(0, endindex).Replace(">", string.Empty).Replace(":", "-").Replace(",", string.Empty);
                                        //        GroupNames = user + ":" + end;
                                        //    }
                                        //    else if (item.Contains("class=\"private\""))
                                        //    {
                                        //        int startindex = item.IndexOf("class=\"private\"");
                                        //        string start = item.Substring(startindex).Replace("class=\"private\"", string.Empty);
                                        //        int endindex = start.IndexOf("</a>");
                                        //        string end = start.Substring(0, endindex).Replace(">", string.Empty).Replace(":", "-").Replace(",", string.Empty);
                                        //        GroupNames = user + ":" + end;
                                        //    }
                                        //}
                                        //catch { }

                                        //if (string.IsNullOrEmpty(GroupIds))
                                        //{
                                        //    try
                                        //    {
                                        //        int startindex = item.IndexOf("gid=");
                                        //        if (startindex > 0)
                                        //        {
                                        //            try
                                        //            {
                                        //                string start = item.Substring(startindex).Replace("gid=", "");
                                        //                int endindex = start.IndexOf("&amp");
                                        //                string end = start.Substring(0, endindex);
                                        //                GroupIds = end;
                                        //            }
                                        //            catch { }
                                        //        }
                                        //    }
                                        //    catch { }
                                        //}

                                        //try
                                        //{
                                        //    GroupPendingDtl.Add(GroupNames, GroupIds);
                                        //}
                                        //catch { }
                                        #endregion
                                    }
                                }
                            }
                        }
                        catch { }
                    }

                return GroupPendingDtl;
            }
            catch (Exception ex)
            {
                return GroupPendingDtl;
            }
        }
Example #27
0
        private void CheckEmail(string Username, string Password, string proxyAddress, string proxyPort, string proxyUserName, string proxyPassword)
        {
            string _Username = string.Empty;

            try
            {
                string _Password      = string.Empty;
                string _ProxyAddress  = string.Empty;
                string _ProxyPort     = string.Empty;
                string _ProxyUsername = string.Empty;
                string _ProxyPassword = string.Empty;

                _Username      = Username;
                _Password      = Password;
                _ProxyAddress  = proxyAddress;
                _ProxyPort     = proxyPort;
                _ProxyUsername = proxyUserName;
                _ProxyPassword = proxyPassword;

                if (_Username.Length < 1)
                {
                    return;
                }

                Log("[ " + DateTime.Now + " ] => [ Starting To Check Email With UserName : "******" ]");

                if (string.IsNullOrEmpty(proxyPort) && !NumberHelper.ValidateNumber(proxyPort))
                {
                    _ProxyPort = "80";
                }

                string Url          = "https://www.linkedin.com/";
                string pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), _ProxyAddress, Convert.ToInt32(_ProxyPort), _ProxyUsername, _ProxyPassword);

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

                if (pageSrcLogin.Contains("csrfToken"))
                {
                    try
                    {
                        csrfToken = pageSrcLogin.Substring(pageSrcLogin.IndexOf("csrfToken"), 100);
                        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].Replace("\\", string.Empty).Replace("csrfToken=", string.Empty);
                            }
                            else if (csrfToken.Contains(","))
                            {
                                string[] Arr = csrfToken.Split(',');
                                csrfToken = Arr[0].Replace("\\", string.Empty);
                            }
                        }
                        catch { }
                    }
                }
                SearchCriteria.CsrToken = csrfToken;
                if (pageSrcLogin.Contains("sourceAlias"))
                {
                    try
                    {
                        sourceAlias = pageSrcLogin.Substring(pageSrcLogin.IndexOf("sourceAlias"), 100);
                        string[] Arr = sourceAlias.Split('"');
                        sourceAlias = Arr[2].Replace("\\", string.Empty);
                    }
                    catch { }
                }

                string getReqForCheckEmail = HttpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/uas/request-password-reset?session_redirect="));
                postUrl = "https://www.linkedin.com/uas/request-password-reset-submit";

                postdata = "email=" + Uri.EscapeDataString(_Username) + "&request=Submit+Address&sessionRedirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias + "";
                ResLogin = HttpHelper.postFormData(new Uri(postUrl), postdata);

                if (ResLogin.Contains("We couldn't find a LinkedIn account associated with " + _Username))
                {
                    try
                    {
                        Log("[ " + DateTime.Now + " ] => [ We couldn't find a LinkedIn account associated with " + _Username + " ]");
                        GlobusFileHelper.AppendStringToTextfileNewLine(_Username, Globals.Path_NonExistingEmail_EmailChecker);
                    }
                    catch
                    {
                    }
                }

                else if (ResLogin.Contains("Please check your email"))
                {
                    try
                    {
                        Log("[ " + DateTime.Now + " ] => [ Please check your email with : " + _Username + " ]");
                        GlobusFileHelper.AppendStringToTextfileNewLine(_Username, Globals.Path_ExistingEmail_EmailChecker);
                    }
                    catch
                    {
                    }
                }
                else if (ResLogin.Contains("Security Verification"))
                {
                    try
                    {
                        Log("[ " + DateTime.Now + " ] => [ Security Verification : " + _Username + " ]");

                        GlobusFileHelper.AppendStringToTextfileNewLine(_Username, Globals.Path_SecurityVerification_EmailChecker);
                    }
                    catch
                    {
                    }
                }
                else
                {
                    Log("[ " + DateTime.Now + " ] => [ There is some problem with : " + _Username + " ]");
                    GlobusFileHelper.AppendStringToTextfileNewLine(_Username, Globals.Path_OtherProblem_EmailChecker);
                }
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("Module Name >>> EmailChecker, UserName >>> " + _Username + " , ex.Message >>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " , ex.StackTrace >>> " + ex.StackTrace + "  , Date Time >>> " + DateTime.Now, Globals.Path_ErrorFile_EmailChecker);
            }

            Log("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED With UserName : "******" ]");
        }
Example #28
0
        public string PageNoSpecGroup(ref GlobusHttpHelper HttpHelper, string gid)
        {
            string pageSourcePage = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/groups?viewMembers=&gid=" + gid + "&split_page=1"));
            string[] RgxTotPages = System.Text.RegularExpressions.Regex.Split(pageSourcePage, "groups_members-h-mbr-cnt\"");

            foreach (var ItemData in RgxTotPages)
            {
                try
                {
                    if (ItemData.Contains("<!DOCTYPE html>"))
                    {
                        continue;
                    }
                    if (ItemData.Contains("class=\"member-count identified\">"))
                    {
                        int startindexName = ItemData.IndexOf("class=\"member-count identified\">");
                        string startName = ItemData.Substring(startindexName);
                        int endIndexName = startName.IndexOf("members</a>");
                        string page = startName.Substring(0, endIndexName).Replace("\"", string.Empty).Replace(">", string.Empty).Replace("class=member-count identified", string.Empty).Replace(",", string.Empty).Trim();
                        PageNo = int.Parse(page);
                        PageNo = (PageNo / 20) + 1;

                        //if (PageNo > 25)
                        //{
                        //    PageNo = 25;
                        //}
                    }
                }
                catch (Exception ex)
                {
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus --> PageNoSpecGroup() --> 1 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus --> PageNoSpecGroup() --> 1 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGroupstatusErrorLogs);
                }
            }

            if (PageNo == 0)
            {
                RgxTotPages = System.Text.RegularExpressions.Regex.Split(pageSourcePage, "<h1 class=\"ptitle\">Members");

                foreach (var ItemData in RgxTotPages)
                {
                    try
                    {
                        if (ItemData.Contains("<!DOCTYPE html>"))
                        {
                            continue;
                        }

                        int startindexName = ItemData.IndexOf("<span>");
                        string startName = ItemData.Substring(startindexName);
                        int endIndexName = startName.IndexOf("</span>");
                        string page = startName.Substring(0, endIndexName).Replace("\"", string.Empty).Replace("<span>", string.Empty).Replace("class=member-count identified", string.Empty).Replace(",", string.Empty).Replace("(",string.Empty).Replace(")",string.Empty).Trim();
                        PageNo = int.Parse(page);
                        PageNo = (PageNo / 20) + 1;
                    }
                    catch (Exception ex)
                    {
                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus --> PageNoSpecGroup() --> 1 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus --> PageNoSpecGroup() --> 1 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGroupstatusErrorLogs);
                    }
                }
            }

            return Convert.ToString(PageNo);
        }
        public void StartAcceptInvitations(ref GlobusHttpHelper httpHelper)
        {
            try
            {
                string csrfToken = string.Empty;
                string userFirstName = string.Empty;
                string UserLastName = string.Empty;
                string SenderName = string.Empty;
                string newPagesource = string.Empty;
                bool isTrue = false;
                int startRow = 1;

                string pageSource = httpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/inbox/invitations/pending"));

                var resultForUserDetails = FindTheUserName(pageSource);
                try
                {
                    resultForUserDetails = resultForUserDetails.Substring(resultForUserDetails.IndexOf("alt="), resultForUserDetails.IndexOf("height") - resultForUserDetails.IndexOf("alt=")).Replace("alt=", string.Empty).Replace("/", string.Empty).Trim();
                    userFirstName = resultForUserDetails.Split(' ')[0].Replace("\"", string.Empty);
                    UserLastName = resultForUserDetails.Split(' ')[1].Replace("\"", string.Empty);
                }
                catch { }

                if (pageSource.Contains("csrfToken"))
                {
                    csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 100);
                    string[] Arr = csrfToken.Split('"');
                    try
                    {
                        foreach (string item in Arr)
                        {
                            try
                            {
                                if (item.Contains("csrfToken="))
                                {
                                    csrfToken = item.Substring(item.IndexOf("csrfToken="), item.IndexOf("&", item.IndexOf("csrfToken=")) - item.IndexOf("csrfToken=")).Replace("csrfToken=", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Trim();//Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty);

                                    break;
                                }
                            }
                            catch (Exception ex)
                            {
                            }

                            if (item.Contains("csrfToken="))
                            {
                                csrfToken = item.Replace("csrfToken=", string.Empty).Trim();

                                break;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        //csrfToken = Arr[0].Replace("csrfToken=", "").Replace("\\", "");
                    }
                }

                // For Show More

                //string postData1 = "pkey=inbox-invitations-pending&tcode=%5Bobject%20Arguments%5D&plist=";
                //string response1 = httpHelper.postFormData(new Uri("http://www.linkedin.com/lite/web-action-track?csrfToken="+csrfToken+""),postData1);
                //string pageSource2=httpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/inbox/invitations/pending/more?sinceDate=1366351490125&startRow=6&count=20&showBlocked=false&ctx=inbox&rnd=1366353236172"));
                //*** Conver HTML to XML *******************************//
                #region Convert HTML to XML
                ChilkatHttpHelpr objhelper = new ChilkatHttpHelpr();
                //xHtml contain xml data
                string xHtml = objhelper.ConvertHtmlToXml(pageSource);

                Chilkat.Xml xml = new Chilkat.Xml();
                xml.LoadXml(xHtml);
                //xHtml.

                ////  Iterate over all h1 tags:
                Chilkat.Xml xNode = default(Chilkat.Xml);
                Chilkat.Xml xBeginSearchAfter = default(Chilkat.Xml);
                #endregion

                #region Invitatin count
                xBeginSearchAfter = null;
                xNode = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "invitation-count count ");

                try
                {
                    while ((xNode != null))
                    {
                        string strvalue = xNode.AccumulateTagContent("text", "script|style");
                        string Invitatincount = strvalue;
                        Log("[ " + DateTime.Now + " ] => [ Invitation Count = " + Invitatincount + " UserName = "******" ]");
                        Log("-----------------------------------------------------------------------------------------------------------------------------------");
                        break;
                    }
                }
                catch (Exception ex)
                {

                }

                #endregion

                do
                {
                    newPagesource = httpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/inbox/invitations?keywords=&sortBy=&startRow=" + startRow + "&subFilter=&trk=&showBlocked=false"));
                if (newPagesource.Contains("inbox-list"))
                {
                    string inbox_list = httpHelper.GetDataWithTagValueByTagAndAttributeNameWithClass(newPagesource, "ol", "inbox-list ");

                    if (inbox_list.Contains("<li"))
                    {
                        isTrue = true;
                        string[] srrLi = Regex.Split(inbox_list, "<li");

                        foreach (string item in srrLi)
                        {
                            try
                            {
                                if (item.Contains("data-gid=\""))
                                {
                                    string data_gid = item.Substring(item.IndexOf("data-gid=\"") + 10, item.IndexOf("\"", item.IndexOf("data-gid=\"") + 10) - (item.IndexOf("data-gid=\"") + 10)).Replace("\"", string.Empty).Replace("data-gid=\"", string.Empty).Trim();
                                    int startindex1 = item.IndexOf("alt=");
                                    string start1 = item.Substring(startindex1).Replace("alt=",string.Empty);
                                    int endindex1 = start1.IndexOf("height");
                                    string end1 = start1.Substring(0, endindex1).Replace("\"", string.Empty).Trim();
                                    SenderName = end1;

                                    string response2 = httpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/inbox/action?mboxItemGID=" + data_gid + "&actionType=invitationAccept&csrfToken=" + csrfToken + "&goback=%2Epiv_*1_*1_*1_*1_*1&trk=inbox-invitations-inv-accept&ctx=inbox&rnd=1366352095313"));

                                    if (response2.Contains(" are now connected"))
                                    {
                                        string SuccessMsg = string.Empty;
                                        int startindex = response2.IndexOf("<div class=\"confirmation\">");

                                        if (startindex > 0)
                                        {
                                            try
                                            {
                                                string start = response2.Substring(startindex).Replace("<div class=\"confirmation\">", string.Empty);
                                                int endindex = start.IndexOf("<ul>");
                                                string end = start.Substring(0, endindex);
                                                //SuccessMsg = end.Replace("<h4>", string.Empty).Replace("\"", string.Empty).Replace("</h4>", string.Empty).Replace("\n", string.Empty).Replace("\t", string.Empty).Replace("\"u002", "-").Replace("You", "User: "******"<h4>", string.Empty).Replace("\"", string.Empty).Replace("</h4>", string.Empty).Replace("\n", string.Empty).Replace("\t", string.Empty).Replace("\"u002", "-").Replace("You", "User: "******"( Name:" + userFirstName + "  " + UserLastName + ") ").Trim();

                                            }
                                            catch { }
                                        }

                                        GlobusFileHelper.AppendStringToTextfileNewLine(SuccessMsg, Globals.path_AcceptInvitationEmail);
                                        Log("[ " + DateTime.Now + " ] => [ " + SuccessMsg + " ]");

                                    }
                                    if (!(response2.Contains(SenderName)))
                                    {
                                        Log("[ " + DateTime.Now + " ] => [ Invitation accepted from " + SenderName + " ]");
                                    }
                                    else
                                    {
                                        //Log("There is some error !");
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                            }
                        }

                    }
                    else
                    {
                        //Log("[ " + DateTime.Now + " ] => [ There is no invitation ! ]");
                        Log("[ " + DateTime.Now + " ] => [ No more invitations left to accept ! ]");

                    }
                }
                startRow = startRow + 10;
                } while (newPagesource.Contains("is now a connection."));
                //else
                //{
                //    Log("[ " + DateTime.Now + " ] => [ There is no invitation ! ]");
                //}

                //if (isTrue)
                //{
                //    StartAcceptInvitations(ref httpHelper);
                //}
            }
            catch (Exception ex)
            {
            }
        }
Example #30
0
        public Dictionary<string, string> PostAddGroupNames(ref GlobusHttpHelper HttpHelper, List<string> FriendsProfileIDs)
        {
            try
            {
                FriendsProfileIDs = FriendsProfileIDs.Distinct().ToList();
                foreach (var friendID in FriendsProfileIDs)
                {
                    try
                    {

                        string ProfileID = string.Empty;
                        if (Globals.groupStatusString == "API")
                        {
                            string  ProfileUrl = "https://www.linkedin.com/contacts/view?id=" + ProfileID + "";
                            string profilePageSource = HttpHelper.getHtmlfromUrl1(new Uri(ProfileUrl));
                            ProfileID = Utils.getBetween(profilePageSource, "id=", ",").Replace("\"", "");

                        }
                        else
                        {

                            ProfileID = friendID;
                        }

                        string pageSourceforGroup = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/view?id=" + ProfileID));

                        if (pageSourceforGroup.Contains("Your address book is currently unavailable. Please check again later"))
                        {
                            Log("[ " + DateTime.Now + " ] => [ Your address book is currently unavailable. Please check again later ! ]");
                            Log("[ " + DateTime.Now + " ] => [ Please Wait for sometimes ! ]");
                            System.Threading.Thread.Sleep(1 * 60 * 1000);

                            pageSourceforGroup = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/view?id=" + ProfileID));
                        }

                        if (pageSourceforGroup.Contains("You and this LinkedIn user don’t know anyone in common") || pageSourceforGroup.Contains("You and this LinkedIn user don&#8217;t know anyone in common"))
                        {
                            Log("[ " + DateTime.Now + " ] => [ You and this LinkedIn user don’t know anyone in common With Profile URL >>> " + "http://www.linkedin.com/profile/view?id=" + ProfileID + " ]");
                            continue;
                        }

                        //groups-name group-data
                        string[] RgxGroupDataforGroup = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "link_groupRegistration");
                        string[] RgxGroupDataName = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "fmt__profileUserFullName");

                        #region By Prabhat Sir Commented By san
                        //foreach (var Nm in RgxGroupDataName)
                        //{
                        //    if (Nm.Contains("class=\"given-name\">"))
                        //    {
                        //        if (Nm.IndexOf(">") > 0)
                        //        {
                        //            int SIndex = Nm.IndexOf(">");
                        //            string Start = Nm.Substring(SIndex);
                        //            int EndIndex = Start.IndexOf("class=\"family-name\"");
                        //            MemFName = Start.Substring(0, EndIndex).Replace(">", string.Empty).Replace("<", string.Empty).Replace("/", string.Empty).Replace("span", string.Empty).Trim();

                        //            int SIndex2 = Nm.IndexOf("class=\"family-name\"");
                        //            string Start2 = Nm.Substring(SIndex2);
                        //            int EndIndex2 = Start2.IndexOf("</h1>");
                        //            MemLName = Start2.Substring(0, EndIndex2).Replace("family-name", string.Empty).Replace("class=", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Replace("/", string.Empty).Replace("span", string.Empty).Replace("\"", string.Empty).Replace("\n", string.Empty).Trim();
                        //            MemFullName = MemFName + "-" + MemLName;
                        //        }
                        //    }
                        //}

                        //foreach (var Groups in RgxGroupDataforGroup)
                        //{
                        //    if (Groups.Contains("class=\"fn org\""))
                        //    {
                        //        if (Groups.IndexOf("groupRegistration") > 0)
                        //        {
                        //            int startindex2 = Groups.IndexOf("groupRegistration");
                        //            string start2 = Groups.Substring(startindex2);
                        //            int endIndex2 = start2.IndexOf("csrfToken");  //groupRegistration?gid=85746&amp;csrfToken
                        //            GroupId = start2.Substring(0, endIndex2).Replace("groupRegistration", string.Empty).Replace("?gid=", string.Empty).Replace("&amp", string.Empty).Replace(";", string.Empty).Replace("csrfToken", string.Empty);
                        //            GroupId = ":" + GroupId;

                        //            int startindex1 = Groups.IndexOf("class=\"fn org\"");
                        //            string start1 = Groups.Substring(startindex1);
                        //            int endIndex1 = start1.IndexOf("</strong>");
                        //            GroupName = start1.Substring(0, endIndex1).Replace("class=\"fn org\"", string.Empty).Replace(">", string.Empty);
                        //            GroupName = MemFullName + ":" + GroupName;

                        //            try
                        //            {
                        //                GroupDtl.Add(GroupName, GroupId);
                        //            }
                        //            catch { }

                        //        }
                        //        else
                        //        {
                        //            continue;
                        //        }

                        //    }

                        //}
                        #endregion

                        #region CodeChabgeBysanjeev
                        string MemberName = string.Empty;
                        try
                        {
                            MemberName = pageSourceforGroup.Substring(pageSourceforGroup.IndexOf("<span class=\"full-name\" dir=\"auto\">"), (pageSourceforGroup.IndexOf(",", pageSourceforGroup.IndexOf("<span class=\"full-name\" dir=\"auto\">")) - pageSourceforGroup.IndexOf("<span class=\"full-name\" dir=\"auto\">"))).Replace("<span class=\"full-name\" dir=\"auto\">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(":", string.Empty).Trim();
                            MemberName = MemberName.Replace(" ", "-");

                            if (MemberName.Contains("</span>"))
                            {
                                MemberName = MemberName.Split('<')[0];
                            }
                        }
                        catch { }

                        if (RgxGroupDataforGroup.Count() < 2)
                        {
                            try
                            {
                                pageSourceforGroup = 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=" + ProfileID + "&locale=&snapshotID=&authToken=&authType=name&invAcpt=&notContactable=&primaryAction=&isPublic=false&sfd=true&_=1366115853014"));

                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine("Error >>> " + ex.StackTrace);
                            }
                        }

                        RgxGroupDataforGroup = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "link_groupRegistration");
                        RgxGroupDataName = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "class=\"full-name\">");
                        RgxGroupDataforGroup = RgxGroupDataforGroup.Skip(1).ToArray();
                        if (pageSourceforGroup.Contains("link_groupRegistration"))
                        {
                            foreach (string item in RgxGroupDataforGroup)
                            {
                                string GroupNames = string.Empty;
                                string GroupIds = string.Empty;
                                string GroupMemberCount = string.Empty;
                                string tempGroupNames = string.Empty;
                                try
                                {
                                    if (!item.Contains("<!DOCTYPE html>") && item.Contains("\"name\":\""))
                                    {
                                        try
                                        {
                                            tempGroupNames = item.Substring(item.IndexOf("\"name\":\""), (item.IndexOf("\",\"", item.IndexOf("\"name\":\"")) - item.IndexOf("\"name\":\""))).Replace("\"name\":\"", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
                                            GroupNames = MemberName + ":" + tempGroupNames;

                                        }
                                        catch { }
                                        try
                                        {
                                            #region commented
                                            //int startindex = item.IndexOf("gid=");
                                            //if (startindex > 0)
                                            //{
                                            //    string start = item.Substring(startindex).Replace("gid=", "");
                                            //    int endindex = start.IndexOf("&csrfToken=");
                                            //    if (endindex == -1)
                                            //    {
                                            //        endindex = start.IndexOf("&");
                                            //    }
                                            //    string end = start.Substring(0, endindex);
                                            //    GroupIds = end;
                                            //}
                                            #endregion

                                            int startindex = item.IndexOf("/groups?gid=");
                                            if (startindex > 0)
                                            {
                                                string start = item.Substring(startindex).Replace("/groups?gid=", "");
                                                int endindex = start.IndexOf("&");
                                                if (endindex == -1)
                                                {
                                                    endindex = start.IndexOf("&goback=");
                                                }
                                                string end = start.Substring(0, endindex);
                                                GroupIds = end;
                                            }
                                        }
                                        catch { }

                                        if (string.IsNullOrEmpty(GroupIds))
                                        {
                                            try
                                            {
                                                GroupIds = item.Substring(item.IndexOf("groupRegistration?gid="), (item.IndexOf("&", item.IndexOf("groupRegistration?gid=")) - item.IndexOf("groupRegistration?gid="))).Replace("groupRegistration?gid=", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("&amp", "").Trim();
                                            }
                                            catch { }
                                        }

                                        if (!string.IsNullOrEmpty(GroupIds))
                                        {
                                            try
                                            {
                                                string membercountPageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/groups?gid=" + GroupIds));
                                                GroupMemberCount = getBetween(membercountPageSource, "class=\"member-count identified\">", "</a>").Replace(",","").Trim(); ;
                                            }
                                            catch { }
                                        }
                                        try
                                        {
                                            GroupDtl.Add(GroupNames, GroupIds);

                                            string LinkedInDeskTop = Globals.DesktopFolder + "\\InBoardProGetData" + "FriendsGroupInfo" + ".csv";
                                            if (!File.Exists(LinkedInDeskTop))
                                            {
                                                string Header = "FriendName" + "," + "GroupNames" + "," + "GroupUrl" + "," + "Total Member Of Group";
                                                GlobusFileHelper.AppendStringToTextfileNewLine(Header, LinkedInDeskTop);
                                            }

                                            string LDS_FinalData = MemberName.Replace(",", ";") + "," + tempGroupNames.Replace(",", ";") + "," + "https://www.linkedin.com/groups?gid=" + GroupIds + "," + GroupMemberCount;
                                            GlobusFileHelper.AppendStringToTextfileNewLine(LDS_FinalData, LinkedInDeskTop);
                                        }
                                        catch { }
                                    }
                                }
                                catch { }
                            }
                        }
                        #endregion
                    }
                    catch { }

                    int delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                    Log("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                    Thread.Sleep(delay * 1000);
                }
                return GroupDtl;
             }
            catch (Exception ex)
            {
                return GroupDtl;
            }
        }
        public void PostFinalMsgGroupMember(ref GlobusHttpHelper HttpHelper, Dictionary<string, string> SlectedContacts, string msg, string body, string UserName, string FromemailId, string FromEmailNam, int mindelay, int maxdelay)
        {
            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;

                 try
                 {
                     string MessageText = string.Empty;
                     string PostedMessage = string.Empty;

                         int totalSelectedItems = SlectedContacts.Count;
                         Log("[ " + DateTime.Now + " ] => [ Total Selected Members : " + totalSelectedItems + " ]");

                         IEnumerable<IEnumerable<KeyValuePair<string, string>>> partitioned = SlectedContacts.Partition(50);

                         foreach (var item in partitioned)
                         {
                             string FString = string.Empty;
                             string Nstring = string.Empty;
                             string connId = string.Empty;
                             string FullName = string.Empty;
                             string ContactName = 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);
                                 csrfToken = csrfToken.Trim();
                             }

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

                             try
                             {
                                 foreach (KeyValuePair<string, string> itemChecked in item)
                                 {
                                     try
                                     {

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

                                         FName = itemChecked.Value.Split(' ')[0];
                                         Lname = itemChecked.Value.Split(' ')[1];

                                         FullName = FName + " " + Lname;
                                         try
                                         {
                                             ContactName = ContactName + "  :  " + FullName;

                                             if (ContactName.Contains("class="))
                                             {
                                                 try
                                                 {
                                                     ContactName = ContactName.Substring(0, ContactName.IndexOf("class=")).Trim();
                                                 }
                                                 catch (Exception ex)
                                                 {
                                                 }
                                             }
                                         }
                                         catch { }
                                         Log("[ " + DateTime.Now + " ] => [ Adding Contact : " + FullName + " ]");

                                         string ToCd = itemChecked.Key;
                                         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;
                                              connId += " " + ToCd;
                                         }
                                     }
                                     catch { }
                                 }
                                 Nstring += "}";

                                 try
                                 {

                                     string PostMessage;
                                     string ResponseStatusMsg;
                                     Log("[ " + DateTime.Now + " ] => [ Message Sending Process Running.. ]");
                                     PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(body.ToString()) + "&submit=Send+Message&showRecipeints=showRecipeints&fromName=" + FromEmailNam + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=" + Uri.EscapeUriString(Nstring) +"&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&goback=.smg_*1_*1_*1_*1_*1_*1_*1_*1_*1";
                                     ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/msgToConns"), PostMessage);

                                     if (ResponseStatusMsg.Contains("Your message was successfully sent."))
                                     {
                                         Log("[ " + DateTime.Now + " ] => [ Subject Posted : " + msg + " ]");
                                         Log("[ " + DateTime.Now + " ] => [ Body Text Posted : " + body.ToString() + " ]");
                                         Log("[ " + DateTime.Now + " ] => [ Message Posted To  Accounts : " + item.Count() + " ] ");
                                         ReturnString = "Your message was successfully.";

                                         #region CSV
                                         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";
                                         string CSV_Content = UserName + "," + msg + "," + bdy.ToString() + "," + ContactName;
                                         CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_MessageSentGroupMember);

                                         #endregion

                                         //GlobusFileHelper.AppendStringToTextfileNewLine("Subject Posted : " + textMsg.Text.ToString(), Globals.path_MessageGroupMember);
                                         //GlobusFileHelper.AppendStringToTextfileNewLine("Body Text Posted : " + txtBody.Text.ToString(), Globals.path_MessageGroupMember);
                                         //GlobusFileHelper.AppendStringToTextfileNewLine("Message Posted To All Selected Accounts", Globals.path_MessageGroupMember);

                                     }
                                     else if (ResponseStatusMsg.Contains("There was an unexpected problem that prevented us from completing your request.") || ResponseStatusMsg.Contains("You are no longer authorized to message this"))
                                     {
                                         //Log("Error In Message Posting");
                                         Log("[ " + DateTime.Now + " ] => [ There was an unexpected problem that prevented us from completing your request ]");
                                         //string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                         //string CSV_Content = UserName + "," + msg + "," + body.ToString() + "," + ContactName;
                                         //CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_MessageSentGroupMember);

                                         GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", Globals.path_MessageGroupMember);

                                     }

                                 }
                                 catch (Exception ex)
                                 {
                                     //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");

                                     GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember);
                                 }

                                 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_MessageGroupMember);
                             }
                         }

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

             }
             catch (Exception ex)
             {
                 GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error -->  PostFinalMsgGroupMember() --> 2 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                 GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> PostFinalMsgGroupMember() --> 2 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember);
             }
        }
Example #32
0
        public Dictionary<string, string> PostAddPendingGroupNames(ref GlobusHttpHelper HttpHelper,  string FriendsProfileIDs)
        {
            try
            {
                string emailid = FriendsProfileIDs.Split(':')[0].ToString();
                string friendID = FriendsProfileIDs.Split(':')[1].ToString();

                    try
                    {
                        string pageSourceforGroup = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/view?id=" + friendID));

                        if (pageSourceforGroup.Contains("Your address book is currently unavailable. Please check again later"))
                        {
                            Log("[ " + DateTime.Now + " ] => [ Your address book is currently unavailable. Please check again later ! ]");
                            Log("[ " + DateTime.Now + " ] => [ Please Wait for sometimes ! ]");
                            System.Threading.Thread.Sleep(1 * 60 * 1000);

                            pageSourceforGroup = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/view?id=" + friendID));
                        }

                        if (pageSourceforGroup.Contains("You and this LinkedIn user don’t know anyone in common") || pageSourceforGroup.Contains("You and this LinkedIn user don&#8217;t know anyone in common"))
                        {
                            Log("[ " + DateTime.Now + " ] => [ You and this LinkedIn user don’t know anyone in common With Profile URL >>> " + "http://www.linkedin.com/profile/view?id=" + friendID + " ]");
                            //continue;
                        }

                        //groups-name group-data
                        string[] RgxGroupDataforGroup = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "link_groupRegistration");
                        string[] RgxGroupDataName = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "fmt__profileUserFullName");

                        #region CodeChabgeBysanjeev
                        string MemberName = string.Empty;
                        try
                        {
                            MemberName = pageSourceforGroup.Substring(pageSourceforGroup.IndexOf("fmt__profileUserFullName"), (pageSourceforGroup.IndexOf(",", pageSourceforGroup.IndexOf("fmt__profileUserFullName")) - pageSourceforGroup.IndexOf("fmt__profileUserFullName"))).Replace("fmt__profileUserFullName", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(":", string.Empty).Trim();
                            MemberName = MemberName.Replace(" ", "-");
                        }
                        catch { }

                        try
                        {
                            pageSourceforGroup = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/myGroups?trk=nav_responsive_sub_nav_groups"));
                        }
                        catch { }

                        RgxGroupDataforGroup = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "<div class=\"media-content\">");
                        RgxGroupDataName = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "class=\"full-name\">");

                        foreach (string item in RgxGroupDataforGroup)
                        {
                            string GroupNames = string.Empty;
                            string GroupIds = string.Empty;

                            try
                            {
                                if (!item.Contains("<!DOCTYPE html>") && item.Contains("/groups") && item.Contains("Membership Pending"))
                                {
                                    try
                                    {
                                        if (item.Contains("class=\"public\""))
                                        {
                                            int startindex = item.IndexOf("class=\"public\"");
                                            string start = item.Substring(startindex).Replace("class=\"public\"", string.Empty);
                                            int endindex = start.IndexOf("</a>");
                                            string end = start.Substring(0, endindex).Replace(">",string.Empty);
                                            GroupNames = emailid + ":" + end;
                                        }
                                        else if (item.Contains("class=\"private\""))
                                        {
                                            int startindex = item.IndexOf("class=\"private\"");
                                            string start = item.Substring(startindex).Replace("class=\"private\"", string.Empty);
                                            int endindex = start.IndexOf("</a>");
                                            string end = start.Substring(0, endindex).Replace(">", string.Empty);
                                            GroupNames = emailid + ":" + end;
                                                                                    }
                                    }
                                    catch { }
                                    try
                                    {
                                        int startindex = item.IndexOf("gid=");
                                        if (startindex > 0)
                                        {
                                            string start = item.Substring(startindex).Replace("gid=", "");
                                            int endindex = start.IndexOf("&amp");
                                            string end = start.Substring(0, endindex);
                                            GroupIds = end;
                                        }
                                    }
                                    catch { }

                                    if (string.IsNullOrEmpty(GroupIds))
                                    {
                                        try
                                        {
                                            GroupIds = item.Substring(item.IndexOf("groupRegistration?gid="), (item.IndexOf("&", item.IndexOf("groupRegistration?gid=")) - item.IndexOf("groupRegistration?gid="))).Replace("groupRegistration?gid=", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("&amp", "").Trim();
                                        }
                                        catch { }
                                    }

                                    try
                                    {
                                        GroupDtl.Add(GroupNames, GroupIds);
                                    }
                                    catch { }
                                }
                            }
                            catch { }
                        }
                        #endregion
                    }
                    catch { }
                //}
                return GroupDtl;
            }
            catch (Exception ex)
            {
                return GroupDtl;
            }
        }
        public bool CrawlingLinkedInPage(string Url, ref GlobusHttpHelper HttpHelper)
        {
            //new Thread(() =>
             //     {

            Log("[ " + DateTime.Now + " ] => [ Parsing For URL : " + Url + " ]");

            //  Workbooks myExcelWorkbooks = ClsExcelData.myExcelWorkbooks;
            #region Data Initialization
            string GroupMemId = 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 html = 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 memhead = 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_HeadLineTitle = string.Empty;
            string Company = string.Empty;
            string degreeConnection = string.Empty;
            string website1 = string.Empty;
            string LDS_CurrentCompany = string.Empty;

            List<string> lstpasttitle = new List<string>();
            List<string> checkpasttitle = new List<string>();
            List<string> titleList = new List<string>();
            List<string> companyList = new List<string>();
            #endregion

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

            if (stringSource.Contains("Sign in to LinkedIn"))
            {
                Log("[ " + DateTime.Now + " ] => [ Sign in to LinkedIn ]");

            }

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

            #region Name
            try
            {
                try
                {
                    //strFamilyName = stringSource.Substring(stringSource.IndexOf("fmt__profileUserFullName\":\""), (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).Replace("}", string.Empty).Replace("]", string.Empty).Trim();
                    int startindex = stringSource.IndexOf("fmt__profileUserFullName\":\"");
                    string start = stringSource.Substring(startindex).Replace("fmt__profileUserFullName\":\"", "");
                    int endindex = start.IndexOf("\",\"");
                    string end = start.Substring(0, endindex).Replace("\\u002d", "-");
                    strFamilyName = end;
                    if (string.IsNullOrEmpty(strFamilyName))
                    {
                        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).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).Replace("}", string.Empty).Replace("]", string.Empty).Trim();

                    }
                    catch { }
                }
            }
            catch { }

            if (strFamilyName == string.Empty)
            {
                try
                {
                    int startindex = stringSource.IndexOf("<title>");
                    string start = stringSource.Substring(startindex).Replace("<title>", string.Empty);
                    int endindex = start.IndexOf("</title>");
                    string end = start.Substring(0, endindex).Replace("\\u002d", "-").Replace("| LinkedIn", string.Empty).Trim();
                    strFamilyName = end;
                }
                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];
            }
            catch { }

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

                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 titlecurrent
            //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();
                        // int startindex = stringSource.IndexOf("memberHeadline");
                        // string start = stringSource.Substring(startindex).Replace("memberHeadline", "");
                        //  int endindex = start.IndexOf("\",\"");
                        //  string end = start.Substring(0, endindex).Replace("\"", "").Replace(":", "");
                        //  titlecurrent = end.Replace("\\u002d", "-");
                        int startindex = stringSource.IndexOf("\"title_highlight\":\"");
                        string start = stringSource.Substring(startindex).Replace("\"title_highlight\":\"", "");
                        int endindex = start.IndexOf("\",\"");
                        string end = start.Substring(0, endindex).Replace("\u002d", string.Empty).Replace("Å", "A").Replace("\\u002d", "-").Replace("\"\n", "").Replace("\n", "").Replace(";", ",").Replace("&amp", "");
                        titlecurrent = end;
                    }
                    catch
                    {
                    }

                    //    if (string.IsNullOrEmpty(Company))
                    if (string.IsNullOrEmpty(titlecurrent))
                    {
                        try
                        {
                            //memberHeadline
                            //  titlecurrent = 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("u002d",string.Empty).Trim();

                            int startindex = stringSource.IndexOf("memberHeadline");
                            string start = stringSource.Substring(startindex).Replace("memberHeadline", "");
                            int endindex = start.IndexOf("\",\"");
                            string end = start.Substring(0, endindex).Replace("\"", "").Replace(":", "");
                            memhead = end.Replace("\\u002d", "-");
                        }
                        catch
                        {
                        }

                    }
                    if (string.IsNullOrEmpty(titlecurrent))
                    {
                        string[] cmpny = Regex.Split(stringSource, "trk=prof-exp-title' name='title' title='Find others with this title'>");
                        foreach (string item in cmpny)
                        {
                            try
                            {
                                try
                                {
                                    if (!item.Contains("<!DOCTYPE html>"))
                                    {
                                        int startindex = item.IndexOf("");
                                        string start = item.Substring(startindex);
                                        int endindex = start.IndexOf("</a>");
                                        string end = start.Substring(0, endindex).Replace("</a>", String.Empty);
                                        string titles = end.Trim();
                                        titleList.Add(titles);
                                        titleList = titleList.Distinct().ToList();
                                    }
                                }
                                catch
                                {

                                }
                            }
                            catch
                            {

                            }
                        }
                    }
                    if (titleList.Count > 0)
                    {
                        titlecurrent = titleList[0];
                    }
                    string[] strdesigandcompany1 = new string[4];
                    if (memhead.Contains(" at ") || memhead.Contains(" of "))
                    {
                        // titlecurrent = string.Empty;
                        companycurrent = string.Empty;

                        try
                        {
                            strdesigandcompany1 = Regex.Split(memhead, " at ");

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

                        try
                        {
                            titlecurrent = strdesigandcompany1[0];
                        }
                        catch { }

                    }

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

                        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
                    }

                }
                catch { }
            //}
            //catch{}

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

                string Companyname = string.Empty;
                foreach (string item in companylist)
                {
                    try
                    {
                        if (!item.Contains("<!DOCTYPE html>"))
                        {
                            Companyname = item.Substring(item.IndexOf(":"), (item.IndexOf(",", item.IndexOf(":")) - item.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 = item;
                            checkerlst.Add(Companyname);
                            checkerlst = checkerlst.Distinct().ToList();
                        }
                    }
                    catch { }
                }

                // string AllComapny = string.Empty;
                if (checkerlst.Count > 0)
                {
                    foreach (string item1 in checkerlst)
                    {
                        try
                        {
                            if (string.IsNullOrEmpty(AllComapny))
                            {
                                AllComapny = item1.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                            }
                            else
                            {
                                AllComapny = AllComapny + " : " + item1.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                            }
                        }
                        catch
                        {

                        }
                    }
                }
                if (string.IsNullOrEmpty(AllComapny))
                {
                    string[] allCompany = Regex.Split(stringSource, "trk=prof-exp-company-name\" name=\"company\" title=\"Find others who have worked at this company\">");
                    foreach (string item in allCompany)
                    {
                        if (!item.Contains("<!DOCTYPE html>"))
                        {
                            try
                            {
                                int startindex = item.IndexOf("");
                                string start = item.Substring(startindex);
                                int endindex = start.IndexOf("</a>");
                                string end = start.Substring(0, endindex).Replace("</a>", string.Empty);
                                string companies = end.Trim();
                                companyList.Add(companies);
                                companyList = companyList.Distinct().ToList();
                            }
                            catch
                            {

                            }
                        }

                    }
                    string[] allcompany1 = Regex.Split(stringSource, "trk=prof-exp-company-name\">");
                    foreach (string item in allcompany1)
                    {
                        if (!item.Contains("<!DOCTYPE html>") && !item.Contains("<span data-tracking=\"mcp_profile_sum\""))
                        {
                            try
                            {
                                int startindex = item.IndexOf("");
                                string start = item.Substring(startindex);
                                int endindex = start.IndexOf("</a>");
                                string end = start.Substring(0, endindex).Replace("</a>", string.Empty);
                                string companies = end.Replace("&amp", "&").Trim();
                                companyList.Add(companies);
                                companyList = companyList.Distinct().ToList();
                            }
                            catch
                            {

                            }
                        }
                    }
                    if (companyList.Count > 0)
                    {
                        foreach (string item1 in companyList)
                        {
                            try
                            {
                                if (string.IsNullOrEmpty(AllComapny))
                                {
                                    AllComapny = item1.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                                }
                                else
                                {
                                    AllComapny = AllComapny + " : " + item1.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                                }
                            }
                            catch
                            {

                            }
                        }
                    }

                }
                if (companyList.Count > 0)
                {
                    companycurrent = companyList[0];
                }
                //           if (companycurrent == string.Empty)
                //           {
                //               try
                //               {
                //                 companycurrent = checkerlst[0].ToString();
                //             }
                //             catch { }
                //        }

                #endregion
            #endregion Company

                #region Company
                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();
                        }
                        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(";", "").Trim();
                            }
                            catch
                            {
                            }

                        }

                        string[] strdesigandcompany = new string[4];
                        if (Company.Contains(" at "))
                        {
                            try
                            {
                                strdesigandcompany = Regex.Split(Company, " at ");
                            }
                            catch { }

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

                            #region Current Company
                            try
                            {
                                companycurrent = strdesigandcompany[1];
                            }
                            catch { }
                            #endregion
                        }
                    }
                    catch { }
                    #region PastCompany
                    string[] grpcompanylist = Regex.Split(stringSource, "companyName\"");
                    string grpAllComapny = string.Empty;

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

                    #region Education
                    try
                    {
                        //  string[] str_UniversityName = Regex.Split(stringSource, "link__school_name");
                        string[] str_UniversityName = Regex.Split(stringSource, "link__school_name_public");
                        foreach (string item in str_UniversityName)
                        {
                            try
                            {
                                string School = string.Empty;
                                string Degree = string.Empty;
                                string SessionEnd = string.Empty;
                                string SessionStart = string.Empty;
                                string Education = string.Empty;

                                if (!item.Contains("<!DOCTYPE html>"))
                                {
                                    try
                                    {
                                        try
                                        {
                                            int startindex = item.IndexOf("\"schoolName\":");
                                            string start = item.Substring(startindex).Replace("\"schoolName\":", string.Empty);
                                            int endindex = start.IndexOf(",");
                                            School = start.Substring(0, endindex).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("\\t", string.Empty);
                                        }
                                        catch { }

                                        try
                                        {
                                            int startindex1 = item.IndexOf("degree");
                                            string start1 = item.Substring(startindex1).Replace("degree", "");
                                            int endindex1 = start1.IndexOf(",");
                                            Degree = start1.Substring(0, endindex1).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("_highlight", string.Empty);
                                        }
                                        catch { }

                                        try
                                        {
                                            int startindex2 = item.IndexOf("enddate_my");
                                            string start2 = item.Substring(startindex2).Replace("enddate_my", "");
                                            int endindex2 = start2.IndexOf(",");
                                            SessionEnd = start2.Substring(0, endindex2).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty);
                                        }
                                        catch { }

                                        try
                                        {
                                            int startindex3 = item.IndexOf("startdate_my");
                                            string start3 = item.Substring(startindex3).Replace("startdate_my", "");
                                            int endindex3 = start3.IndexOf(",");
                                            SessionStart = start3.Substring(0, endindex3).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty);
                                        }
                                        catch { }
                                        //if (Degree == string.Empty)
                                        //{
                                        //    try
                                        //    {
                                        //        if (!item.Contains("\"degree\":\""))
                                        //        {
                                        //            int startindex4 = item.IndexOf("name\":");
                                        //            string start4 = item.Substring(startindex4).Replace("name\":", "");
                                        //            int endindex4 = start4.IndexOf(",");
                                        //            Degree = start4.Substring(0, endindex4).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty);
                                        //        }
                                        //    }
                                        //    catch { }
                                        //}

                                        if (SessionStart == string.Empty && SessionEnd == string.Empty)
                                        {
                                            Education = " [" + School + "] Degree: " + Degree;
                                        }
                                        else
                                        {
                                            Education = " [" + School + "] Degree: " + Degree + " Session: " + SessionStart + "-" + SessionEnd;
                                        }
                                        //University = item.Substring(item.IndexOf(":"), (item.IndexOf(",", item.IndexOf(":")) - item.IndexOf(":"))).Replace(":", string.Empty).Replace("\\u002d", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                                    }
                                    catch { }
                                    EducationList.Add(Education);

                                }
                            }
                            catch { }
                        }

                        EducationList = EducationList.Distinct().ToList();
                        if (EducationList.Count == 0)
                        {
                            //string[] uniName = Regex.Split(stringSource, "trk=prof-edu-school-name' title=\"More details for this school\">");
                            //foreach (string item in uniName)
                            //{
                            //    try
                            //    {
                            //        string School = string.Empty;
                            //        string Degree = string.Empty;
                            //        string SessionEnd = string.Empty;
                            //        string SessionStart = string.Empty;
                            //        string Education = string.Empty;
                            //        if (!item.Contains("<!DOCTYPE html>"))
                            //        {
                            //            try
                            //            {
                            //                try
                            //                {
                            //                    int startindex = item.IndexOf("");
                            //                    string start = item.Substring(startindex);
                            //                    int endindex = start.IndexOf("</a>");
                            //                    School = start.Substring(0, endindex).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("\\t", string.Empty).Trim();
                            //                }
                            //                catch
                            //                { }

                            //                try
                            //                {
                            //                    int startindex1 = item.IndexOf("degree");
                            //                    string start1 = item.Substring(startindex1).Replace("degree", "");
                            //                    int endindex1 = start1.IndexOf(",");
                            //                    Degree = start1.Substring(0, endindex1).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("_highlight", string.Empty).Replace(">",string.Empty);
                            //                }
                            //                catch { }

                            //                try
                            //                {
                            //                    int startindex2 = item.IndexOf("<time datetime=");
                            //                    string start2 = item.Substring(startindex2).Replace("<time datetime=", string.Empty);
                            //                    int endindex2 = start2.IndexOf(">");
                            //                    SessionStart = start2.Substring(0, endindex2).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("'",string.Empty);
                            //                }
                            //                catch { }

                            //                try
                            //                {
                            //                    int startindex2 = item.IndexOf("</time><time datetime=");
                            //                    string start2 = item.Substring(startindex2).Replace("</time><time datetime=", string.Empty);
                            //                    int endindex2 = start2.IndexOf(">");
                            //                    SessionEnd = start2.Substring(0, endindex2).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace(">",string.Empty).Replace("'",string.Empty);
                            //                }
                            //                catch { }

                            //                if (SessionStart == string.Empty && SessionEnd == string.Empty)
                            //                {
                            //                    Education = " [" + School + "] Degree: " + Degree;
                            //                }
                            //                else
                            //                {
                            //                    Education = " [" + School + "] Degree: " + Degree + " Session: " + SessionStart + "-" + SessionEnd;
                            //                }
                            //            }

                            //            catch
                            //            { }
                            //            EducationList.Add(Education);

                            //        }
                            //    }
                            //    catch { }

                            //}
                            string[] uniName1 = Regex.Split(stringSource, "trk=prof-edu-school-name' title=");
                            foreach (string item in uniName1)
                            {
                                try
                                {
                                    string School = string.Empty;
                                    string Degree = string.Empty;
                                    string SessionEnd = string.Empty;
                                    string SessionStart = string.Empty;
                                    string Education = string.Empty;
                                    if (!item.Contains("<!DOCTYPE html>"))
                                    {
                                        try
                                        {
                                            try
                                            {
                                                int startindex = item.IndexOf(">");
                                                string start = item.Substring(startindex);
                                                int endindex = start.IndexOf("</a>");
                                                School = start.Substring(0, endindex).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("\\t", string.Empty).Replace(">", string.Empty).Trim();
                                            }
                                            catch
                                            { }

                                            try
                                            {
                                                int startindex1 = item.IndexOf("degree");
                                                string start1 = item.Substring(startindex1).Replace("degree", "");
                                                int endindex1 = start1.IndexOf(",");
                                                Degree = start1.Substring(0, endindex1).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("_highlight", string.Empty).Replace(">", string.Empty);
                                                if (Degree.Contains("connection") || Degree.Contains("title") || Degree.Contains("firstName") || Degree.Contains("authToken"))
                                                {
                                                    Degree = string.Empty;
                                                }

                                            }
                                            catch { }

                                            try
                                            {
                                                int startindex2 = item.IndexOf("<time datetime=");
                                                string start2 = item.Substring(startindex2).Replace("<time datetime=", string.Empty);
                                                int endindex2 = start2.IndexOf(">");
                                                SessionStart = start2.Substring(0, endindex2).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("'", string.Empty);
                                            }
                                            catch { }
                                            if (string.IsNullOrEmpty(SessionStart))
                                            {
                                                try
                                                {
                                                    int startindex3 = item.IndexOf("<span class=\"education-date\"><time>");
                                                    string start3 = item.Substring(startindex3).Replace("<span class=\"education-date\"><time>", string.Empty);
                                                    int endindex3 = start3.IndexOf("</time>");
                                                    SessionStart = start3.Substring(0, endindex3).Replace("</time>", string.Empty).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty);
                                                }
                                                catch
                                                { }

                                            }

                                            try
                                            {
                                                int startindex2 = item.IndexOf("<time> &#8211;");
                                                string start2 = item.Substring(startindex2).Replace("<time> &#8211;", string.Empty);
                                                int endindex2 = start2.IndexOf("</time>");
                                                SessionEnd = start2.Substring(0, endindex2).Replace("</time>", string.Empty).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty);

                                            }
                                            catch { }
                                            if (string.IsNullOrEmpty(SessionStart))
                                            {
                                                try
                                                {
                                                    int startindex3 = item.IndexOf("<span class=\"education-date\"><time>");
                                                    string start3 = item.Substring(startindex3).Replace("<span class=\"education-date\"><time>", string.Empty);
                                                    int endindex3 = start3.IndexOf("</time>");
                                                    SessionEnd = start3.Substring(0, endindex3).Replace("</time>", string.Empty).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty);
                                                }
                                                catch
                                                { }

                                            }

                                            if (SessionStart == string.Empty && SessionEnd == string.Empty)
                                            {
                                                Education = " [" + School + "] Degree: " + Degree;
                                            }
                                            else
                                            {
                                                if (Degree == string.Empty)
                                                {
                                                    Education = " [" + School + "] Session: " + SessionStart + "-" + SessionEnd;
                                                }
                                                else
                                                {
                                                    Education = " [" + School + "] Degree: " + Degree + " Session: " + SessionStart + "-" + SessionEnd;
                                                }

                                            }

                                        }

                                        catch
                                        { }
                                        EducationList.Add(Education);

                                    }
                                }
                                catch { }

                            }
                        }
                        EducationList = EducationList.Distinct().ToList();
                        if (EducationList.Count > 0)
                        {
                            foreach (string item in EducationList)
                            {
                                if (string.IsNullOrEmpty(EducationCollection))
                                {
                                    // EducationCollection = item.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                                    EducationCollection = item.Replace("}", "").Replace("&amp;", "&");
                                }
                                else
                                {
                                    // EducationCollection = EducationCollection + "  -  " + item.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                                    EducationCollection = EducationCollection + "  -  " + item.Replace("}", "").Replace("&amp;", "&");
                                }
                            }
                        }
                        // string University1 = 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).Replace(":", string.Empty).Trim();

                    }

                    catch { }

                    #endregion Education

                    #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)
                    {

                    }
                    if (string.IsNullOrEmpty(USERemail))
                    {
                        try
                        {
                            int startindex = stringSource.IndexOf("Email:");
                            string start = stringSource.Substring(startindex).Replace("Email:", "");
                            int endindex = start.IndexOf("Phone");
                            string end = start.Substring(0, endindex).Replace("\u003cbr", "").Replace("\\u003cbr\\u003e", "").Replace("\\n", "").Replace(" ", "");
                            USERemail = end;
                        }
                        catch
                        {
                        }
                    }
                    #endregion Email

                    #region Contact
                    try
                    {
                        int startindex = stringSource.IndexOf("Phone:");
                        string start = stringSource.Substring(startindex).Replace("Phone:", "");
                        int endindex = start.IndexOf("Skype");
                        string end = start.Substring(0, endindex).Replace("\\u003cbr\\u003e", "").Replace("\\u002d", "").Replace("\\n", "");
                        LDS_UserContact = end;
                    }
                    catch { }
                    if (string.IsNullOrEmpty(LDS_UserContact))
                    {
                        try
                        {
                            int startindex = stringSource.IndexOf("[{\"number\":\"");
                            string start = stringSource.Substring(startindex).Replace("[{\"number\":\"", "");
                            int endindex = start.IndexOf("\"}]");
                            string end = start.Substring(0, endindex).Replace("\\u003cbr\\u003e", "").Replace("\\u002d", "").Replace("\\n", "");
                            LDS_UserContact = end;

                        }
                        catch { }
                    }

                    #endregion

                    #region Website
                    string Web1 = string.Empty;
                    List<string> Websites = new List<string>();
                    try
                    {
                        int startindex = stringSource.IndexOf("\"websites\":");
                        string start = stringSource.Substring(startindex).Replace("\"websites\":", "");
                        int endindex = start.IndexOf("\"showTencent\":");
                        string end = start.Substring(0, endindex).Replace("[{\"", string.Empty).Replace("{", string.Empty).Trim();
                        Web1 = end;
                    }
                    catch
                    { }
                    string[] web = Regex.Split(Web1, "\"URL\":\"");
                    foreach (var items in web)
                    {

                        try
                        {
                            int startindex = items.IndexOf("");
                            string start = items.Substring(startindex).Replace("\"", "");
                            int endindex = start.IndexOf("}");
                            string end = start.Substring(0, endindex).Replace("\\u002d", string.Empty).Replace("URL:", string.Empty);
                            Website = end;
                        }
                        catch { }

                        try
                        {
                            if (Website.Contains("]") || Website.Contains("}") || Website.Contains("[") || Website.Contains("}"))
                            {
                                Website = Website.Replace("]", string.Empty).Replace("}", string.Empty).Replace("\\u002d", string.Empty).Replace("[", string.Empty).Replace("{", string.Empty).Trim();
                            }
                        }
                        catch { }
                        Websites.Add(Website);
                    }
                    string item2 = string.Empty;
                    website1 = Websites[0];
                    //foreach (var item in Websites)
                    int size = Websites.Count;

                    for (int i = 1; i <= size; i++)
                    {
                        try
                        {
                            website1 += " - " + Websites[i];
                        }
                        catch { }
                    }

                    #endregion Website

                    #region location
                    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();
                        int startindex = stringSource.IndexOf("fmt_location");
                        string start = stringSource.Substring(startindex).Replace("fmt_location\":\"", "");
                        int endindex = start.IndexOf("\"");
                        string end = start.Substring(0, endindex).Replace("\u002d", string.Empty).Replace("Å", "A").Replace("\\u002d", "-");
                        location = end;
                    }
                    catch (Exception ex)
                    {

                    }
                    if (location == string.Empty)
                    {
                        try
                        {
                            int startindex = stringSource.IndexOf("name='location' title=\"Find other members");
                            string start = stringSource.Substring(startindex).Replace("name='location' title=\"Find other members", string.Empty);
                            int startindex1 = start.IndexOf("\">");
                            string start1 = start.Substring(startindex1);
                            int endindex = start1.IndexOf("</a>");
                            string end = start1.Substring(0, endindex).Replace("\u002d", string.Empty).Replace("Å", "A").Replace("\\u002d", "-").Replace(">", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Trim();
                            location = end;
                        }
                        catch
                        { }
                    }

                    #endregion location

                    #region Country
                    try
                    {
                        int startindex = stringSource.IndexOf("\"geo_region\":");
                        if (startindex > 0)
                        {
                            string start = stringSource.Substring(startindex).Replace("\"geo_region\":", "");
                            int endindex = start.IndexOf("\"i18n_geo_region\":\"Location\"");
                            string end = start.Substring(0, endindex);
                            country = end;

                            string[] array = Regex.Split(end, "\"name\":\"");
                            array = array.Skip(1).ToArray();
                            foreach (string item in array)
                            {
                                try
                                {
                                    int startindex1 = item.IndexOf("\",\"");
                                    string strat1 = item.Substring(0, startindex1);
                                    country = strat1;
                                    break;
                                }
                                catch (Exception ex)
                                {

                                }
                            }

                        }
                    }
                    catch (Exception ex)
                    {

                    }

                    if (country == string.Empty)
                    {
                        try
                        {
                            string[] countLocation = location.Split(',');

                            if (countLocation.Count() == 2)
                            {
                                country = location.Split(',')[1];
                            }
                            else if (countLocation.Count() == 3)
                            {
                                country = location.Split(',')[2];
                            }

                        }
                        catch { }

                    }

                    #endregion

                    #region Industry
                    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)
                    {
                    }
                    if (string.IsNullOrEmpty(Industry))
                    {
                        try
                        {
                            int startindex = stringSource.IndexOf("name=\"industry\" title=\"Find other members in this industry\">");
                            string start = stringSource.Substring(startindex).Replace("name=\"industry\" title=\"Find other members in this industry\">", string.Empty);
                            int endindex = start.IndexOf("</a>");
                            string end = start.Substring(0, endindex).Replace("</a>", string.Empty).Replace("&amp;", "&");
                            Industry = end;
                        }
                        catch
                        { }
                    }
                    #endregion Industry

                    #region Connection
                    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("\"", "").Replace("connectionsBrowseable:true", "").Replace(",", "");
                            Connection = end;
                        }

                        if (startindex < 0)
                        {
                            int startindex1 = stringSource.IndexOf("overview-connections");
                            if (startindex1 > 0)
                            {
                                string start = stringSource.Substring(startindex1).Replace("overview-connections", "").Replace("\n", string.Empty).Replace("<p>", string.Empty).Replace("</p>", string.Empty);
                                int endindex = start.IndexOf("</strong>");
                                string end = start.Substring(0, endindex).Replace("&amp;", "&").Replace("\"", string.Empty).Replace("<strong>", string.Empty).Replace(">", string.Empty).Trim();
                                Connection = end;
                            }
                        }
                        if (string.IsNullOrEmpty(Connection))
                        {
                            try
                            {
                                int startindex1 = stringSource.IndexOf("class=\"member-connections\"><strong>");
                                string start = stringSource.Substring(startindex1).Replace("class=\"member-connections\"><strong>", "").Replace("\n", string.Empty).Replace("<p>", string.Empty).Replace("</p>", string.Empty);
                                int endindex = start.IndexOf("</strong>");
                                string end = start.Substring(0, endindex).Replace("&amp;", "&").Replace("\"", string.Empty).Replace("<strong>", string.Empty).Replace("<a href=#connections class=connections-link>", string.Empty).Replace("más de", string.Empty).Replace("</a>", string.Empty).Replace(">",string.Empty).Trim();
                                Connection = end;
                            }
                            catch
                            { }
                        }

                    }
                    catch (Exception ex)
                    {
                    }
                    #endregion Connection

                    #region Recommendation

                    try
                    {
                        string RecomnedUrl = string.Empty;
                        try
                        {
                            int startindex = stringSource.IndexOf("endorsements?id=");
                            string start = stringSource.Substring(startindex);
                            int endIndex = start.IndexOf("\"mem_pic\":");
                            RecomnedUrl = (start.Substring(0, endIndex).Replace(",", string.Empty).Replace("\"", string.Empty).Replace(":", string.Empty));

                        }
                        catch { }

                        string PageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/profile-v2-" + RecomnedUrl + ""));
                        string[] arrayRecommendedName = Regex.Split(PageSource, "headline");

                        if (arrayRecommendedName.Count() == 1)
                        {
                            arrayRecommendedName = Regex.Split(PageSource, "fmt__recommendeeFullName");
                        }

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

                        foreach (var itemRecomName in arrayRecommendedName)
                        {
                            try
                            {
                                if (!itemRecomName.Contains("Endorsements"))
                                {
                                    string Heading = string.Empty;
                                    string Name = string.Empty;

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

                                    try
                                    {
                                        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));
                                    }
                                    catch { }

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

                                    ListRecommendationName.Add(Name + " : " + Heading);

                                }
                            }
                            catch { }

                        }

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

                    }

                    catch { }
                    if (string.IsNullOrEmpty(Recommendations))
                    {
                        List<string> ListRecommendationName = new List<string>();
                        string[] recommend = Regex.Split(stringSource, "trk=prof-exp-snippet-endorsement-name'>");
                        foreach (string item in recommend)
                        {
                            if (!item.Contains("<!DOCTYPE html>"))
                                try
                                {
                                    int startindex = item.IndexOf("");
                                    string start = item.Substring(startindex);
                                    int endindex = start.IndexOf("</a>");
                                    string end = start.Substring(0, endindex).Replace("</a>", string.Empty);
                                    string recmnd = end.Trim();
                                    ListRecommendationName.Add(recmnd);
                                }
                                catch
                                { }
                        }
                        foreach (string item in ListRecommendationName)
                        {
                            if (recomandation == string.Empty)
                            {
                                recomandation = item;
                            }
                            else
                            {
                                recomandation += "  -  " + item;
                            }
                        }
                    }

                    #endregion

                    #region Group
                    try
                    {
                        #region commented by Prabhat 17/05/13 1:27 PM
                        //string groupdata = string.Empty;
                        //int startindex = stringSource.IndexOf("\"groupsMpr\":");
                        //if (startindex > 0)
                        //{
                        //    string start = stringSource.Substring(startindex);
                        //    int endindex = start.IndexOf("},\"");
                        //    string end = start.Substring(0, endindex);
                        //    groupdata = end;
                        //}

                        //string[] CheckList = Regex.Split(groupdata, "\"name\"");
                        //CheckList = CheckList.Skip(1).ToArray();

                        //foreach (string item in CheckList)
                        //{
                        //    try
                        //    {
                        //        int endindexdata = item.IndexOf("\",");
                        //        string enddata = item.Substring(0, endindexdata).Replace("\"","").Replace(":","");
                        //        if(string.IsNullOrEmpty(groupscollectin))
                        //        {
                        //            groupscollectin = enddata;
                        //        }
                        //        else
                        //        {
                        //            groupscollectin = groupscollectin + ":" + enddata;
                        //        }
                        //    }
                        //    catch(Exception ex)
                        //    {

                        //    }
                        //}
                        #endregion

                        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 item in ListGroupName)
                        {
                            if (groupscollectin == string.Empty)
                            {
                                groupscollectin = item;
                            }
                            else
                            {
                                groupscollectin += "  -  " + item;
                            }
                        }

                    }
                    catch { }

                    #endregion

                    #region Experience
                    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>();
                            List<string> ListCompany = 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 (Company == string.Empty)
                                        {
                                            Company = comp;
                                        }

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

                                        ListExperince.Add(exp + ":" + comp);
                                        ListCompany.Add(comp);
                                        companycurrent = ListCompany[0];

                                    }
                                }
                                catch { }
                            }
                            if (ListExperince.Count > 0)
                            {
                                foreach (var item in ListExperince)
                                {
                                    if (LDS_Experience == string.Empty)
                                    {
                                        LDS_Experience = item;
                                    }
                                    else
                                    {
                                        LDS_Experience += "  -  " + item;
                                    }
                                }
                            }

                        }
                        catch { }
                        try
                        {
                            string[] array = Regex.Split(stringSource, "name='title' title='Find others with this title'>");
                            string exp = string.Empty;
                            string comp = string.Empty;
                            List<string> ListExperince = new List<string>();
                            List<string> ListCompany = new List<string>();
                            string SelItem = string.Empty;

                            foreach (var itemGrps in array)
                            {
                                try
                                {
                                    if (!itemGrps.Contains("<!DOCTYPE html")) //">Join
                                    {
                                        try
                                        {
                                            int startindex = itemGrps.IndexOf("");
                                            string start = itemGrps.Substring(startindex);
                                            int endIndex = start.IndexOf("</a>");
                                            exp = (start.Substring(0, endIndex).Replace("\"", string.Empty).Replace(":", string.Empty).Replace("&amp", "&").Replace(";", string.Empty).Replace("\\u002d", "-").Replace("</a>", string.Empty).Replace("name:", string.Empty));

                                        }
                                        catch { }

                                        try
                                        {
                                            int startindex1 = itemGrps.IndexOf("trk=prof-exp-company-name\">");
                                            string start1 = itemGrps.Substring(startindex1);
                                            int endIndex1 = start1.IndexOf("</a>");
                                            comp = (start1.Substring(0, endIndex1).Replace("trk=prof-exp-company-name\">", string.Empty).Replace(":", string.Empty).Replace(";", string.Empty).Replace("\\u002d", "-").Replace("</a>", string.Empty).Replace("name:", string.Empty)).Replace("\"", string.Empty);

                                        }
                                        catch { }

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

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

                                        ListExperince.Add(exp + ":" + comp);
                                        ListCompany.Add(comp);
                                        companycurrent = ListCompany[0];
                                        if (companycurrent.Contains("span data-tracking") || string.IsNullOrEmpty(companycurrent))
                                        {
                                            try
                                            {
                                                if (companyList.Count > 0)
                                                {
                                                    companycurrent = companyList[0];
                                                }
                                            }
                                            catch
                                            { }
                                        }

                                    }
                                }
                                catch { }
                            }
                            if (ListExperince.Count > 0)
                            {
                                foreach (var item in ListExperince)
                                {
                                    if (LDS_Experience == string.Empty)
                                    {
                                        LDS_Experience = item;
                                    }
                                    else
                                    {
                                        LDS_Experience += "  -  " + item;
                                    }
                                }
                            }

                        }
                        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 item in strarr_skill)
                            {
                                try
                                {
                                    if (!item.Contains("!DOCTYPE html"))
                                    {
                                        try
                                        {
                                            string Grp = item.Substring(item.IndexOf(">"), (item.IndexOf("<", item.IndexOf(">")) - item.IndexOf(">"))).Replace(">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("&amp", "&").Trim();
                                            checkgrplist.Add(Grp);
                                            checkgrplist.Distinct().ToList();
                                        }
                                        catch { }
                                    }

                                }
                                catch { }
                            }

                            if (checkgrplist.Count > 0)
                            {
                                foreach (string item in checkgrplist)
                                {
                                    if (string.IsNullOrEmpty(Skill))
                                    {
                                        Skill = item;
                                    }
                                    else
                                    {
                                        Skill = Skill + "  :  " + item;
                                    }
                                }
                            }
                        }
                        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();
                                                int startindex = skillitem.IndexOf(":\"");
                                                string start = skillitem.Substring(startindex);
                                                int endindex = start.IndexOf("viewerEndorsementId");
                                                if (!start.Contains("viewerEndorsementId"))
                                                {
                                                    int endindex1 = start.IndexOf("\"}");
                                                    string end1 = skillitem.Substring(0, endindex1).Replace("\"}", "").Replace("\"", "").Replace("\":", "").Replace(",", "").Replace(":", "").Replace("\\u002d", "");
                                                    string Grp1 = end1;
                                                    checkgrplist.Add(Grp1);
                                                    checkgrplist.Distinct().ToList();
                                                }
                                                else
                                                {
                                                    string end = skillitem.Substring(0, endindex).Replace("viewerEndorsementId", string.Empty).Replace("\"", "").Replace("\":", "").Replace(",", "").Replace(":", "").Replace("\\u002d", "");
                                                    string Grp = end;
                                                    checkgrplist.Add(Grp);
                                                    checkgrplist.Distinct().ToList();
                                                }
                                            }
                                            catch { }
                                        }
                                    }

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

                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {

                    }

                    #endregion

                    #region Pasttitle
                    string[] pasttitles = Regex.Split(stringSource, "title_highlight");
                    string pstTitlesitem = string.Empty;
                    pasttitles = pasttitles.Skip(1).ToArray();
                    foreach (string item in pasttitles)
                    {
                        try
                        {
                            if (!item.Contains("<!DOCTYPE html>") && !item.Contains("Tip: You can also search by keyword"))
                            {
                                try
                                {
                                    string[] Past_Ttl = Regex.Split(item, ",");
                                    pstTitlesitem = Past_Ttl[0].Replace(":", string.Empty).Replace("\"", string.Empty).Replace("\\u002d", "-").Replace("&amp;", "&");
                                }
                                catch { }

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

                            }

                        }
                        catch
                        {
                        }
                    }
                    if (string.IsNullOrEmpty(LDS_PastTitles))
                    {
                        try
                        {
                            foreach (string item in titleList)
                            {
                                LDS_PastTitles = LDS_PastTitles + " : " + item;
                            }

                        }
                        catch
                        { }
                    }

                    if (string.IsNullOrEmpty(LDS_PastTitles))
                    {
                        if (stringSource.Contains("id=\"overview-summary-past\">"))
                        {
                            string _tempPageSourcePastTitle = Utils.getBetween(stringSource, "id=\"overview-summary-past\">", "</tr>");
                            string[] pasttitles1 = Regex.Split(_tempPageSourcePastTitle, "dir=\"auto\">");
                            string pstTitlesitem1 = string.Empty;
                            pasttitles1 = pasttitles1.Skip(1).ToArray();
                            foreach (string item in pasttitles1)
                            {
                                try
                                {
                                    if (!item.Contains("<!DOCTYPE html>") && !item.Contains("Tip: You can also search by keyword"))
                                    {
                                        try
                                        {
                                            string[] Past_Ttl = Regex.Split(item, "<");
                                            pstTitlesitem1 = Past_Ttl[0].Replace(":", string.Empty).Replace("\"", string.Empty).Replace("\\u002d", "-").Replace("&amp;", "&");
                                        }
                                        catch { }

                                        if (string.IsNullOrEmpty(LDS_PastTitles))
                                        {
                                            LDS_PastTitles = pstTitlesitem1;
                                        }
                                        else if (LDS_PastTitles.Contains(pstTitlesitem1))
                                        {
                                            continue;
                                        }
                                        else
                                        {
                                            LDS_PastTitles = LDS_PastTitles + "  :  " + pstTitlesitem1;
                                        }

                                    }

                                }
                                catch
                                {
                                }
                            }
                        }

                    }
                    #endregion

                    #region FullUrl
                    try
                    {
                        string[] UrlFull = System.Text.RegularExpressions.Regex.Split(Url, "&authType");
                        LDS_UserProfileLink = UrlFull[0];
                        LDS_UserProfileLink = Url;
                        //  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

                    #region Current Title Current Company

                    try
                    {
                        int startindex = stringSource.IndexOf("memberHeadline");
                        if (startindex < 0)
                        {
                            try
                            {
                                int startindex1 = stringSource.IndexOf("<p class=\"title \">");
                                string start1 = stringSource.Substring(startindex1).Replace("<p class=\"title \">", string.Empty);
                                int endindex1 = start1.IndexOf("</p>");
                                string end1 = start1.Substring(0, endindex1).Replace("</p>", string.Empty).Replace("&#xf3;", "ó").Replace("&#xf1;", "ñ");
                                LDS_HeadLineTitle = end1.Trim();
                            }
                            catch
                            { }
                        }
                        else
                        {
                            try
                            {
                                string start = stringSource.Substring(startindex).Replace("memberHeadline", string.Empty);
                                int endindex = start.IndexOf("\",\"");
                                string end = start.Substring(0, endindex).Replace("\"", "").Replace(":", string.Empty);
                                LDS_HeadLineTitle = end.Replace("\\u002d", "-");
                            }
                            catch
                            { }
                        }

                    }
                    catch { }
                    if (LDS_HeadLineTitle.Contains(" at ") || LDS_HeadLineTitle.Contains(" of "))
                    {
                        //  titlecurrent = string.Empty;
                        string[] strdesigandcompany1 = new string[4];
                        //    companycurrent = string.Empty;

                        try
                        {
                            strdesigandcompany1 = Regex.Split(LDS_HeadLineTitle, " at ");

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

                        try
                        {
                            if (string.IsNullOrEmpty(companycurrent))
                            {
                                companycurrent = strdesigandcompany1[1];
                            }
                            if (companycurrent.Contains("span data-tracking") || string.IsNullOrEmpty(companycurrent))
                            {
                                if (companyList.Count > 0)
                                {
                                    companycurrent = companyList[0];
                                }
                            }
                        }
                        catch { }
                    }

                    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("u002d", string.Empty).Replace("   ", string.Empty).Trim();
                        }
                        catch
                        {
                        }

                        if (string.IsNullOrEmpty(Company))
                        {
                            try
                            {
                                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("u002d", string.Empty).Trim();
                            }
                            catch
                            {
                            }

                        }

                        string[] strdesigandcompany = new string[4];
                        if (Company.Contains(" at "))
                        {
                            try
                            {
                                strdesigandcompany = Regex.Split(Company, " at ");
                            }
                            catch { }

                            #region Title
                            try
                            {
                                LDS_HeadLineTitle = strdesigandcompany[0].Replace("\\u002d", "-");
                            }
                            catch { }
                            #endregion

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

                    #endregion Company

                    #region degreeConnection
                    //try
                    //{
                    //    int startindex = stringSource.IndexOf("text_plain__NAME_is_");
                    //    string start = stringSource.Substring(startindex).Replace("text_plain__NAME_is_", string.Empty);
                    //    int endindex = start.IndexOf("_key");
                    //    string end = start.Substring(0, endindex).Replace("_key", string.Empty);
                    //    degreeConnection = end.Replace("_", " ").Trim();
                    //    if (degreeConnection.Contains("your connection"))
                    //    {
                    //        degreeConnection = "1st degree contact";
                    //    }
                    //}
                    //catch
                    //{ }
                    //if (string.IsNullOrEmpty(degreeConnection))
                    //{
                    //    try
                    //    {
                    //        int startindex = stringSource.IndexOf("class=\"fp-degree-icon\"><abbr title=\"");
                    //        string start = stringSource.Substring(startindex).Replace("class=\"fp-degree-icon\"><abbr title=\"", string.Empty);
                    //        int startindex1 = start.IndexOf("class=\"degree-icon \">");
                    //        string start1 = start.Substring(startindex1);
                    //        int endindex = start1.IndexOf("<sup>");
                    //        string end = start1.Substring(0, endindex).Replace("class=\"degree-icon \">", string.Empty).Replace("\"", string.Empty).Replace("<sup>", string.Empty);
                    //        degreeConnection = end.Replace("_", " ").Trim();
                    //    }
                    //    catch
                    //    { }
                    //}

                    string[] arr = Regex.Split(stringSource, "<span class=\"fp-degree-icon\">");
                    arr = arr.Skip(1).ToArray();
                    foreach (string tempItem in arr)
                    {
                        if (tempItem.Contains("class=\"degree-icon \">"))
                        {
                            int startindex = tempItem.IndexOf("class=\"degree-icon \">");
                            string start = tempItem.Substring(startindex).Replace("class=\"degree-icon \">", string.Empty);
                            int endIndex = start.IndexOf("</abbr>");
                            string end = start.Substring(0, endIndex).Replace("</abbr>", string.Empty).Replace("</sup>", string.Empty).Replace("<sup>", string.Empty);
                            degreeConnection = end.Trim();
                            break;
                        }
                    }

                    if (string.IsNullOrEmpty(degreeConnection))
                    {
                        try
                        {
                            int startindex = stringSource.IndexOf("class=\"degree-icon \">");
                            string start = stringSource.Substring(startindex).Replace("class=\"degree-icon \">", string.Empty);
                            int endIndex = start.IndexOf("</abbr>");
                            string end = start.Substring(0, endIndex).Replace("</abbr>", string.Empty).Replace("</sup>", string.Empty).Replace("<sup>", string.Empty);
                            degreeConnection = end.Trim();
                        }
                        catch
                        { }
                    }
                    #endregion degreeConnection

                    if (firstname == string.Empty) firstname = "LinkedIn";
                    if (lastname == string.Empty) lastname = "Member";
                    if (LDS_HeadLineTitle == string.Empty) LDS_HeadLineTitle = "--";
                    if (titlecurrent == string.Empty) titlecurrent = "--";
                    if (Company == string.Empty) Company = "--";
                    if (Connection == string.Empty) Connection = "--";
                    if (recomandation == string.Empty) recomandation = "--";
                    if (Skill == string.Empty) Skill = "--";
                    if (LDS_Experience == string.Empty) LDS_Experience = "--";
                    if (EducationCollection == string.Empty) EducationCollection = "--";
                    if (groupscollectin == string.Empty) groupscollectin = "--";
                    if (USERemail == string.Empty) USERemail = "--";
                    if (LDS_UserContact == string.Empty) LDS_UserContact = "--";
                    if (grpAllComapny == string.Empty) grpAllComapny = "--";
                    if (location == string.Empty) location = "--";
                    if (country == string.Empty) country = "--";
                    if (Industry == string.Empty) Industry = "--";
                    //   if (Website == string.Empty) Website = "--";
                    if (website1 == string.Empty) website1 = "--";
                    if (degreeConnection == string.Empty) degreeConnection = "--";
                    if (companycurrent == string.Empty) companycurrent = "--";
                    //  LDS_LoginID = _UserName;
                    LDS_LoginID = UN;
                    //SearchCriteria.LoginID;
                    //LDS_LoginID = UserDetails.UserName;
                    // string FinalData = firstname + "," + lastname + "," + Company.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + Skill.Replace(",", ";") + "," + country.Replace(",", ";") + "," + location.Replace(",", ";") + "," + Website.Replace(",", ";") + "," + USERemail.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + groupscollectin.Replace(",", ";") + "," + EducationCollection.Replace(",", ";") + "," + recomandation.Replace(",", ";") + "," + Connection.Replace(",", ";") + "," + groupscollectin.Replace(",", ";") + "," + URLprofile.Replace(",", ";") + "," + UserDetails.UserName + "," + TypeOfProfile + ",";

                    string LDS_FinalData = TypeOfProfile + "," + LDS_UserProfileLink + "," + firstname + "," + lastname + "," + Company.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + companycurrent.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 + "," + grpAllComapny.Replace(",", ";") + "," + country.Replace(",", ";") + "," + location.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + Website.Replace(",", ";") + "," + LDS_LoginID + ",";// +TypeOfProfile + ",";

                    //if (!string.IsNullOrEmpty(firstname))
                    //{
                    //    Log(LDS_FinalData);
                    //}
                    //else
                    //{
                    //    Log("No Data For URL : " + Url);
                    //    GlobusFileHelper.AppendStringToTextfileNewLineWithCarat(Url, Globals.DesktopFolder + "\\UnScrapedList.txt");
                    //}

                    // if (SearchCriteria.starter)

                    //string tempFinalData = LDS_FinalData.Replace(";", "").Replace(LDS_UserProfileLink, "").Replace(TypeOfProfile, "").Replace(",", "").Replace(LDS_LoginID, "").Trim();

                    //if (!string.IsNullOrEmpty(tempFinalData))
                    //{
                    //AppFileHelper.AddingLinkedInDataToCSVFile(LDS_FinalData, Globals.path_ScrappedMembersFromGroup);
                    string CSVHeader = "ProfileType" + "," + "Degree Connection" + "," + "UserProfileLink" + "," + "FirstName" + "," + "LastName" + "," + "HeadLineTitle" + "," + "Current Title " + "," + "Current Company" + "," + "Connection" + "," + "Recommendations " + "," + "SkillAndExpertise " + "," + "Experience " + "," + " Education" + "," + "Groups" + "," + "UserEmail" + "," + "UserContactNumber" + "," + "PastTitles" + "," + "PastCompany" + "," + "Location" + "," + "Country" + "," + "Industry" + "," + "WebSites" + "," + "LinkedInLoginID" + ",";
                    string CSV_Content = TypeOfProfile.Replace(",", ";") + "," + degreeConnection.Replace(",", ";") + "," + LDS_UserProfileLink.Replace(",", ";") + "," + firstname.Replace(",", ";") + "," + lastname.Replace(",", ";") + "," + LDS_HeadLineTitle.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + companycurrent.Replace(",", ";").Replace("002", "-") + "," + Connection.Replace(",", ";") + "," + recomandation.Replace(",", ";") + "," + Skill.Replace(",", ";") + "," + LDS_Experience.Replace(",", ";") + "," + EducationCollection.Replace(",", ";") + "," + groupscollectin.Replace(",", ";") + "," + USERemail.Replace(",", ";") + "," + LDS_UserContact.Replace(",", ";") + "," + LDS_PastTitles.Replace(",", ";") + "," + grpAllComapny.Replace(",", ";") + "," + location.Replace(",", ";") + "," + country.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + website1.Replace(",", ";") + "," + LDS_LoginID.Replace(",", ";");

                    //string CSV_Content = TypeOfProfile + "," + LDS_UserProfileLink + "," + firstname + "," + lastname + "," + Company.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + companycurrent.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 + ",";// +TypeOfProfile + ",";

                    CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_ScrappedMembersFromGroup);

                    Log("[ " + DateTime.Now + " ] => [ Data Saved In CSV File With URL >>> " + LDS_UserProfileLink + " ]");

                    return true;
                    //}
                }
                catch { };
                return false;
        }
Example #34
0
        public Dictionary<string, string> PostCreateGroupNames(ref GlobusHttpHelper HttpHelper, string user)
        {
            try
            {
                 string pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/grp/"));

                if (pageSource == "" || pageSource.Contains("Make sure you have cookies and Javascript enabled in your browser before signing in") || pageSource.Contains("manual_redirect_link"))
                {
                    Thread.Sleep(2000);
                    pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/myGroups?trk=nav_responsive_sub_nav_groups"));
                }

                if (pageSource == "" || pageSource.Contains("Make sure you have cookies and Javascript enabled in your browser before signing in") || pageSource.Contains("manual_redirect_link"))
                {
                    Thread.Sleep(2000);
                    pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/grp/"));
                }

                if (pageSource == "" || pageSource.Contains("Make sure you have cookies and Javascript enabled in your browser before signing in") || pageSource.Contains("manual_redirect_link"))
                {
                    Thread.Sleep(2000);
                    pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/myGroups?trk=nav_responsive_sub_nav_groups"));
                }

                if (pageSource.Contains("media-block has-activity"))
                {

                    string[] RgxGroupData = Regex.Split(pageSource, "media-content");

                    foreach (var GrpName in RgxGroupData)
                    {
                        string endName = string.Empty;
                        string endKey = string.Empty;

                        try
                        {
                            if (GrpName.Contains("<!DOCTYPE html>") || GrpName.Contains("Membership Pending"))
                            {
                                continue;
                            }

                            if (GrpName.Contains("<a href=\"/groups/") || (GrpName.Contains("<a href=\"/groups?")))
                            {
                                if ((GrpName.Contains("public")))
                                {
                                    try
                                    {
                                        int startindex = GrpName.IndexOf("class=\"public\"");
                                        string start = GrpName.Substring(startindex);
                                        int endIndex = start.IndexOf("</a>");
                                        endName = start.Substring(0, endIndex).Replace("title", string.Empty).Replace("=", string.Empty).Replace(">", string.Empty).Replace("groups", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Replace("&amp;", "&").Replace("classpublic", string.Empty).Replace("&quot;", "'").Replace(":", ";").Replace("This is an open group", string.Empty);
                                        endName = endName + ':' + user;
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update1 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                    }

                                    try
                                    {
                                        endKey = "";
                                        int startindex1 = GrpName.IndexOf("group");
                                        string start1 = GrpName.Substring(startindex1);
                                        int endIndex1 = start1.IndexOf("?");
                                        endKey = start1.Substring(0, endIndex1).Replace("groups", string.Empty).Replace("/", string.Empty).Replace("<a href=", string.Empty).Replace("\"", string.Empty);

                                        if (endKey == string.Empty)
                                        {
                                            startindex1 = GrpName.IndexOf("gid=");
                                            start1 = GrpName.Substring(startindex1);
                                            endIndex1 = start1.IndexOf("&");
                                            endKey = start1.Substring(0, endIndex1).Replace("gid=", string.Empty).Trim();

                                            if (!NumberHelper.ValidateNumber(endKey))
                                            {
                                                try
                                                {
                                                    endKey = endKey.Split('\"')[0];
                                                }
                                                catch { }
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus2 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update2 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                    }

                                    if (endKey.Contains("analyticsURL"))
                                    {
                                        continue;
                                    }

                                    if (endKey == string.Empty)
                                    {
                                        try
                                        {
                                            int startindex2 = GrpName.IndexOf("gid=");
                                            string start2 = GrpName.Substring(startindex2);
                                            int endIndex2 = start2.IndexOf("&");
                                            endKey = start2.Substring(0, endIndex2).Replace("gid", string.Empty).Replace("=", string.Empty);
                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus3 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update3 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                        }
                                    }
                                    else
                                    {
                                        string[] endKeyLast = endKey.Split('-');
                                        try
                                        {
                                            if (NumberHelper.ValidateNumber(endKeyLast[1]))
                                            {
                                                endKey = endKeyLast[1];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[2]))
                                            {
                                                endKey = endKeyLast[2];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[3]))
                                            {
                                                endKey = endKeyLast[3];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[4]))
                                            {
                                                endKey = endKeyLast[4];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[5]))
                                            {
                                                endKey = endKeyLast[5];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[6]))
                                            {
                                                endKey = endKeyLast[6];
                                            }
                                        }
                                        catch { }
                                    }

                                    try
                                    {
                                        if (NumberHelper.ValidateNumber(endKey))
                                        {
                                            GroupName.Add(endName, endKey);
                                        }
                                    }
                                    catch { }
                                }

                            }

                            if (GrpName.Contains("<a href=\"/groups/") || (GrpName.Contains("<a href=\"/groups?")))
                            {
                                if ((GrpName.Contains("private")))
                                {
                                    try
                                    {
                                        int startindex = GrpName.IndexOf("class=\"private\"");
                                        string start = GrpName.Substring(startindex);
                                        int endIndex = start.IndexOf("</a>");
                                        endName = start.Substring(0, endIndex).Replace("=", string.Empty).Replace(">", string.Empty).Replace("groups", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Replace("&amp;", "&").Replace("&quot;", "'").Replace(":", ";").Replace("classprivate", string.Empty);
                                        endName = endName + ':' + user;
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus4 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update4 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                    }

                                    try
                                    {
                                        int startindex1 = GrpName.IndexOf("gid=");
                                        string start1 = GrpName.Substring(startindex1);
                                        int endIndex1 = start1.IndexOf("&");
                                        endKey = start1.Substring(0, endIndex1).Replace("gid=", string.Empty).Replace("/", string.Empty).Replace("<a href=", string.Empty).Replace("\"", string.Empty).Replace("class=blanket-target><a>groups?home=", string.Empty).Trim();

                                        if (endKey == string.Empty)
                                        {
                                            try
                                            {
                                                endKey = endKey.Split(' ')[0].Trim();
                                            }
                                            catch { }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus5 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update5 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                    }

                                    if (endKey.Contains("analyticsURL"))
                                    {
                                        continue;
                                    }

                                    if (endKey == string.Empty)
                                    {
                                        try
                                        {
                                            int startindex2 = GrpName.IndexOf("gid=");
                                            string start2 = GrpName.Substring(startindex2);
                                            int endIndex2 = start2.IndexOf("&");
                                            endKey = start2.Substring(0, endIndex2).Replace("gid", string.Empty).Replace("=", string.Empty);

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

                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus6 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update6 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                        }
                                    }
                                    else
                                    {
                                        string[] endKeyLast = endKey.Split('-');
                                        try
                                        {
                                            if (NumberHelper.ValidateNumber(endKeyLast[1]))
                                            {
                                                endKey = endKeyLast[1];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[2]))
                                            {
                                                endKey = endKeyLast[2];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[3]))
                                            {
                                                endKey = endKeyLast[3];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[4]))
                                            {
                                                endKey = endKeyLast[4];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[5]))
                                            {
                                                endKey = endKeyLast[5];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[6]))
                                            {
                                                endKey = endKeyLast[6];
                                            }
                                        }
                                        catch { }
                                    }

                                    try
                                    {
                                        if (NumberHelper.ValidateNumber(endKey))
                                        {
                                            GroupName.Add(endName, endKey);
                                        }
                                    }
                                    catch { }
                                }

                            }
                        }
                        catch { }
                    }

                }
                else
                {
                    if (pageSource.Contains("View More</span>"))
                    {
                        pageSource = Utils.getBetween(pageSource, "<ul class=\"group-list\">", "View More</span>");
                    }
                    else
                    {
                        pageSource = Utils.getBetween(pageSource, "<ul class=\"group-list\">", "<li class=\"find-more\">");
                    }
                    string[] RgxGroupData = Regex.Split(pageSource, "<li class=");
                    RgxGroupData = RgxGroupData.Skip(1).ToArray();
                    foreach (var GrpName in RgxGroupData)
                    {
                        string endName = string.Empty;
                        string endKey = string.Empty;

                        try
                        {
                            if (GrpName.Contains("<!DOCTYPE html>") || GrpName.Contains("Pending"))
                            {
                                continue;
                            }

                            if (GrpName.Contains("<a href=\"/groups/") || (GrpName.Contains("<a href=\"/groups?")))
                            {
                                if ((GrpName.Contains("title")))
                                {
                                    try
                                    {
                                        int startindex = GrpName.IndexOf("class=\"title\"");
                                        string start = GrpName.Substring(startindex).Replace("class=\"title\"",string.Empty);
                                        int endIndex = start.IndexOf("<span");
                                        endName = start.Substring(0, endIndex).Replace("title", string.Empty).Replace("=", string.Empty).Replace(">", string.Empty).Replace("groups", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Replace("&amp;", "&").Replace("classpublic", string.Empty).Replace("&quot;", "'").Replace(":", ";").Replace("This is an open group", string.Empty).Replace("class", "").Replace("&#39;","'");
                                        if (endName.Contains("<div group-activity"))
                                        {
                                            endIndex = endName.IndexOf("<h3");
                                            endName = endName.Substring(0, endIndex).Replace("<h3", "").Replace("<div group-activity", "");
                                        }
                                        endName = endName + ':' + user;
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update1 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                    }

                                    try
                                    {
                                        endKey = "";
                                        //int startindex1 = GrpName.IndexOf("group");
                                        //string start1 = GrpName.Substring(startindex1);
                                        //int endIndex1 = start1.IndexOf("?");
                                        //endKey = start1.Substring(0, endIndex1).Replace("groups", string.Empty).Replace("/", string.Empty).Replace("<a href=", string.Empty).Replace("\"", string.Empty);

                                        if (endKey == string.Empty)
                                        {
                                            int startindex1 = GrpName.IndexOf("gid=");
                                            string start1 = GrpName.Substring(startindex1);
                                            int endIndex1 = start1.IndexOf("&");
                                            endKey = start1.Substring(0, endIndex1).Replace("gid=", string.Empty).Trim();

                                            if (!NumberHelper.ValidateNumber(endKey))
                                            {
                                                try
                                                {
                                                    endKey = endKey.Split('\"')[0];
                                                }
                                                catch { }
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus2 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update2 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                    }

                                    if (endKey.Contains("analyticsURL"))
                                    {
                                        continue;
                                    }

                                    if (endKey == string.Empty)
                                    {
                                        try
                                        {
                                            int startindex2 = GrpName.IndexOf("gid=");
                                            string start2 = GrpName.Substring(startindex2);
                                            int endIndex2 = start2.IndexOf("&");
                                            endKey = start2.Substring(0, endIndex2).Replace("gid", string.Empty).Replace("=", string.Empty);
                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus3 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update3 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                        }
                                    }
                                    else
                                    {
                                        string[] endKeyLast = endKey.Split('-');
                                        try
                                        {
                                            if (NumberHelper.ValidateNumber(endKeyLast[1]))
                                            {
                                                endKey = endKeyLast[1];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[2]))
                                            {
                                                endKey = endKeyLast[2];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[3]))
                                            {
                                                endKey = endKeyLast[3];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[4]))
                                            {
                                                endKey = endKeyLast[4];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[5]))
                                            {
                                                endKey = endKeyLast[5];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[6]))
                                            {
                                                endKey = endKeyLast[6];
                                            }
                                        }
                                        catch { }
                                    }

                                    try
                                    {
                                        if (NumberHelper.ValidateNumber(endKey))
                                        {
                                            GroupName.Add(endName, endKey);
                                        }
                                    }
                                    catch { }
                                }

                            }
                        }
                        catch { }
                    }
                }

                return GroupName;
            }
            catch (Exception ex)
            {
                return GroupName;
            }
        }