Ejemplo n.º 1
0
        public bool LogoutHttpHelper(ref GlobusHttpHelper HttpHelper)
        {
            try
            {
                //string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/"));
                string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/"));
                if (pageSource1.Contains("\"h\"") && pageSource1.Contains("post_form_id") && pageSource1.Contains("fb_dtsg"))
                {
                    string h            = string.Empty;
                    string post_form_id = string.Empty;
                    string fb_dtsg      = string.Empty;

                    if (pageSource1.Contains("\"h\""))
                    {
                        string   strTemp = pageSource1.Substring(pageSource1.IndexOf("\"h\""), 200);
                        string[] ArrTemp = strTemp.Split('"');
                        h = ArrTemp[3];
                    }
                    if (pageSource1.Contains("post_form_id") && pageSource1.Contains("fb_dtsg"))
                    {
                        string   strTemp = pageSource1.Substring(pageSource1.IndexOf("post_form_id"), 200);
                        string[] ArrTemp = strTemp.Split('"');
                        post_form_id = ArrTemp[2];
                        fb_dtsg      = ArrTemp[6];
                    }

                    string ResponseLogout = HttpHelper.postFormData(new Uri("http://www.facebook.com/logout.php"), "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&ref=mb&h=" + h);
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                return(false);

                Console.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 2
0
        private void SearchByCompanyWithFilter(ref GlobusHttpHelper HttpHelper)
        {
            try
            {
                LogScrap("[ " + DateTime.Now + " ] => [ Starting Search By Company With UserName : "******" ]");
                _Search = _Search.ToLower();
                //_Keyword = _Keyword.ToLower();
                //_Keyword = _Keyword.Replace(" ", "+");
                string url = string.Empty;

                if (SearchCriteria.Relationship == "N")
                {
                    SearchCriteria.Relationship = "";
                }

                if (SearchCriteria.IndustryType == "Y")
                {
                    SearchCriteria.IndustryType = "";
                }

                if (SearchCriteria.CompanySize == "Y")
                {
                    SearchCriteria.CompanySize = "";
                }

                if (SearchCriteria.Follower == "Y")
                {
                    SearchCriteria.Follower = "";
                }
                if (SearchCriteria.Fortune1000 == "Y")
                {
                    SearchCriteria.Fortune1000 = "";
                }

                string getOthLocCode = string.Empty;
                string getlocurl = string.Empty;
                if (SearchCriteria.OtherLocation != string.Empty)
                {
                    getlocurl = "http://www.linkedin.com/ta/region?query="+ Uri.EscapeDataString(SearchCriteria.OtherLocation) + "";
                    getOthLocCode = HttpHelper.getHtmlfromUrl1(new Uri(getlocurl));
                    //Temporosy code for client
                    //GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Comp Scpr Pagesource 2 >>>> " + getOthLocCode, Globals.Path_LinkedinCompanyScrapperPagesource);

                    try
                    {
                        int startindex = getOthLocCode.IndexOf("id\":");
                        string start = getOthLocCode.Substring(startindex).Replace("id\":", string.Empty);
                        int endindex = start.IndexOf(",");
                        string othccountrycode = start.Substring(0, endindex).Replace("\"", string.Empty);
                        SearchCriteria.Country = othccountrycode.Replace(":", "%3A");
                    }
                    catch { }

                }

                if (SearchCriteria.Relationship == "" && SearchCriteria.Country == "" && SearchCriteria.IndustryType == "" && SearchCriteria.CompanySize == "" && SearchCriteria.Follower == "" && SearchCriteria.Fortune1000 == "")
                {
                    //url = "http://www.linkedin.com/vsearch/c?keywords=" + _Keyword + "&openFacets=N,CCR,JO,I,CS,NFR,F&orig=FCTD";
                    url = "http://www.linkedin.com/vsearch/c?type=companies&keywords=" + _Keyword + "&orig=GLHD&pageKey=voltron_company_search_internal_jsp&search=Search";
                }
                else
                {
                    //url = "http://www.linkedin.com/vsearch/c?keywords=" + _Keyword + "&openFacets=N,CCR,JO,I,CS,NFR,F&f_CCR=" + SearchCriteria.Country + "&f_I=" + SearchCriteria.IndustryType + "&f_CS=" + SearchCriteria.CompanySize + "&f_NFR=" + SearchCriteria.Follower + "&f_N=" + SearchCriteria.Relationship + "&f_F=" + SearchCriteria.Fortune1000 + "&orig=FCTD";
                    url = "http://www.linkedin.com/vsearch/c?type=companies&keywords=" + _Keyword + "&orig=GLHD&openFacets=N,CCR,JO,I,CS,NFR,F&f_CCR=" + SearchCriteria.Country + "&f_I=" + SearchCriteria.IndustryType + "&f_CS=" + SearchCriteria.CompanySize + "&f_NFR=" + SearchCriteria.Follower + "&f_N=" + SearchCriteria.Relationship + "&f_F=" + SearchCriteria.Fortune1000 + "";
                }

               string CompanySearchGetRequest = HttpHelper.getHtmlfromUrl1(new Uri(url));

               //Temporosy code for client
               //GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Comp Scpr Pagesource 2 >>>> " + CompanySearchGetRequest, Globals.Path_LinkedinCompanyScrapperPagesource);

                List<string> lstCompanyUrls = GettingAllUrlswithCompanyFilter(CompanySearchGetRequest);

                ////// call to GetDataFromCompanyURL
                GetDataFromCompanyURLWithFilter(ref HttpHelper, lstCompanyUrls);

                // call to get page no
                int pagenumber = GetPageNo(CompanySearchGetRequest);

                try
                {
                    LogScrap("[ " + DateTime.Now + " ] => [ Total Urls : " + pagenumber.ToString() + " ]");
                    pagenumber = int.Parse(pagenumber.ToString())/10 + 1;
                }
                catch (Exception)
                {

                }
                //pagenumber = (pagenumber / 10) - 1;

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

                if (pagenumber > 1)
                {
                    try
                    {
                        string posturl = "http://www.linkedin.com/vsearch/c?keywords=" + _Keyword + "&orig=FCTD";

                      for (int s = 2; s <= pagenumber; s++)
                        {
                            try
                            {
                                //l%26T
                                if (_Keyword.Contains("&"))
                                {
                                    _Keyword = _Keyword.Replace("&", "%26");

                                }

                                string PostDAta = "&f_CCR=" + SearchCriteria.Country + "&f_I=" + SearchCriteria.IndustryType + "&f_CS=" + SearchCriteria.CompanySize + "&f_NFR=" + SearchCriteria.Follower + "&f_N=" + SearchCriteria.Relationship + "&f_F=" + SearchCriteria.Fortune1000 + "&page_num=" + s + "&pt=companies";
                                string Responses = HttpHelper.postFormData(new Uri(posturl), PostDAta);

                                //Temporosy code for client
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Comp Scpr Pagesource 2 >>>> " + Responses, Globals.Path_LinkedinCompanyScrapperPagesource);

                                List<string> lstCompanyURLs = GettingAllUrlswithCompanyFilter(Responses);

                                if (lstCompanyURLs.Count == 0)
                                {
                                    lstCompanyURLs = GettingAllUrlswithCompanyFilter(Responses);
                                }

                                // call to GetDataFromCompanyURL
                                GetDataFromCompanyURLWithFilter(ref HttpHelper, lstCompanyURLs);
                            }
                            catch { }
                        }
                    }
                    catch
                    {
                    }
                }

                string getsize = string.Empty;
                //obj_NewHireexcel.WritedataIntoExcel(Workbooks, Workbook, ComapanyName, link, industry, companysize, website, Founded, DateTime.Now.ToString(), Token1, Token2, Token3, Token4, starttime.ToString());
                try
                {
                    // getsize = companysize.Replace("employees", string.Empty).Trim();
                }
                catch { }
            }
            catch { }

            LogScrap("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED With UserName : "******" ]");
        }
Ejemplo n.º 3
0
        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);
             }
        }
Ejemplo n.º 4
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 : "******" ]");
        }
        public bool MultiPartImageUpload(ref GlobusHttpHelper httpHelper, string Username, string Password, string localImagePath, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword)
        {
            /////Login to FB

            ////string valueLSD = "name=" + "\"lsd\"";

            int intProxyPort = 80;

            Regex IdCheck = new Regex("^[0-9]*$");

            if (!string.IsNullOrEmpty(proxyPort) && IdCheck.IsMatch(proxyPort))
            {
                intProxyPort = int.Parse(proxyPort);
            }
            //string pageSource = string.Empty;
            //try
            //{
            //    pageSource = getHtmlfromUrlProxy(new Uri("https://www.facebook.com/login.php"), proxyAddress, intProxyPort, proxyUsername, proxyPassword);
            //    //int startIndex = pageSource.IndexOf(valueLSD) + 18;
            //}
            //catch { }
            //string value = GlobusHttpHelper.GetParamValue(pageSource, "lsd");
            string ResponseLogin = string.Empty;
            try
            {
            //    ResponseLogin = postFormData(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + Username.Split('@')[0] + "%40" + Username.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "");

                ResponseLogin = httpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com"));
            }
            catch { }
            ///Setting Post Data Params...

            string userId = GlobusHttpHelper.Get_UserID(ResponseLogin);

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

                return false;
            }

            string pgSrc_Profile = string.Empty;
            try
            {
                pgSrc_Profile = httpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/profile.php?id=" + userId + ""));
            }
            catch { }
            string profileSource = string.Empty;
            try
            {
                profileSource = httpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/ajax/timeline/profile_pic_selector.php?profile_id=" + userId + "&__a=1&__user="******""));
            }
            catch { }


            //GlobusHttpHelper httpHelper = new GlobusHttpHelper();
            /////Get User ID
            //ProfileIDExtractor idExtracter = new ProfileIDExtractor();
            //idExtracter.ExtractFriendIDs(ref httpHelper, ref userId);


            string fb_dtsg = GlobusHttpHelper.GetParamValue(ResponseLogin, "fb_dtsg");//pageSourceHome.Substring(pageSourceHome.IndexOf("fb_dtsg") + 16, 8);
            if (string.IsNullOrEmpty(fb_dtsg))
            {
                fb_dtsg = GlobusHttpHelper.ParseJson(ResponseLogin, "fb_dtsg");
            }


            string last_action_id = GlobusHttpHelper.ParseJson(pgSrc_Profile, "last_action_id");

            if (!Utils.IsNumeric(last_action_id))
            {
                last_action_id = "0";
            }

            string postData = "last_action_id=" + last_action_id + "&fb_dtsg=" + fb_dtsg + "&__user="******"&phstamp=165816810252768712174";
            string res = string.Empty;
            try
            {
                res = httpHelper.postFormData(new Uri("https://www.facebook.com/ajax/mercury/thread_sync.php?__a=1"), postData);
            }
            catch { }
            NameValueCollection nvc = new NameValueCollection();
            //nvc.Add("post_form_id", post_form_id);
            nvc.Add("fb_dtsg", fb_dtsg);
            nvc.Add("id", userId);
            nvc.Add("type", "profile");
            //nvc.Add("return", "/ajax/profile/picture/upload_iframe.php?pic_type=1&id=" + userId);
            nvc.Add("return", "/ajax/timeline/profile_pic_upload.php?pic_type=1&id=" + userId);

            //UploadFilesToRemoteUrl("http://upload.facebook.com/pic_upload.php ", new string[] { @"C:\Users\Globus-n2\Desktop\Windows Photo Viewer Wallpaper.jpg" }, "", nvc);
            //HttpUploadFile("http://upload.facebook.com/pic_upload.php ", localImagePath, "file", "image/jpeg", nvc);
            if (HttpUploadFile("https://upload.facebook.com/pic_upload.php ", localImagePath, "pic", "image/jpeg", nvc, proxyAddress, intProxyPort, proxyUsername, proxyPassword))
            //if (HttpUploadFile("http://upload.facebook.com/pic_upload.php ", localImagePath, "file", "image/jpeg", nvc, proxyAddress, intProxyPort, proxyUsername, proxyPassword))
            {
                return true;
            }
            return false;

        }
Ejemplo n.º 6
0
        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
        }
        private List<string> ScarppLinkedinDataByPageNumber(int pagerecords, ref GlobusHttpHelper HttpHelper, string Pagesource, string indstrycd, string postalcd, string countrycd)
        {
            List<string> lstRecordurl = new List<string>();
            try
            {
                string ResponseForPremiumAcc = Pagesource;
                int pagenumber = (pagerecords / 10) + 1;

                string GetResponce = string.Empty;
                string GetRequestURL = string.Empty;
                string PostRequestURL = string.Empty;
                string PostdataForPagination = string.Empty;
                string PostResponce = string.Empty;
                if (pagenumber >= 1)
                {
                    for (int i = 1; i <= pagenumber; i++)
                    {
                        PostRequestURL = string.Empty;
                        PostdataForPagination = string.Empty;
                        PostResponce = string.Empty;
                        {

                            if (ResponseForPremiumAcc.Contains("Account Type:</span> Basic"))
                            {
                                try
                                {
                                    PostRequestURL = "http://www.linkedin.com/search/hits";
                                    PostdataForPagination = "lname=" + lastName + "&searchLocationType=I&countryCode=" + countrycd + "&postalCode=" + postalcd + "&distance=" + distance + "&keepFacets=keepFacets&facet_I=" + indstrycd + "&pplSearchOrigin=ADVS&viewCriteria=2&sortCriteria=R&facetsOrder=I%2CCC%2CN%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR%2CG&page_num=" + i + "&openFacets=I%2CCC%2CN";
                                    PostResponce = HttpHelper.postFormData(new Uri(PostRequestURL), PostdataForPagination);
                                }
                                catch { }
                            }

                            else if (ResponseForPremiumAcc.Contains(""))
                            {
                                try
                                {
                                    PostRequestURL = "http://www.linkedin.com/search/hits";
                                    PostdataForPagination = "lname=" + lastName + "&searchLocationType=I&countryCode=" + countrycd + "&postalCode=" + postalcd + "&distance=" + distance + "&keepFacets=keepFacets&facet_I=" + indstrycd + "&pplSearchOrigin=ADVS&viewCriteria=2&sortCriteria=R&facetsOrder=I%2CCC%2CN%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR%2CG&page_num=" + i + "&openFacets=I%2CCC%2CN";
                                    PostResponce = HttpHelper.postFormData(new Uri(PostRequestURL), PostdataForPagination);
                                    if (string.IsNullOrEmpty(PostResponce))
                                    {
                                        PostRequestURL = "http://www.linkedin.com/search/hits";
                                        PostdataForPagination = "lname=" + lastName + "&searchLocationType=I&countryCode=" + countrycd + "&postalCode=" + postalcd + "&distance=" + distance + "&keepFacets=keepFacets&facet_I=" + indstrycd + "&pplSearchOrigin=ADVS&viewCriteria=2&sortCriteria=R&facetsOrder=I%2CCC%2CN%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR%2CG&page_num=" + i + "&openFacets=I%2CCC%2CN";
                                        PostResponce = HttpHelper.postFormData(new Uri(PostRequestURL), PostdataForPagination);
                                    }
                                }
                                catch { }

                            }
                            else if (ResponseForPremiumAcc.Contains("Account Type:</span> Executive"))
                            {
                                try
                                {
                                    PostRequestURL = "http://www.linkedin.com/search/hits";
                                    PostdataForPagination = "lname=" + lastName + "&searchLocationType=I&countryCode=" + countrycd + "&postalCode=" + postalcd + "&distance=" + distance + "&keepFacets=keepFacets&facet_I=" + indstrycd + "&pplSearchOrigin=ADVS&viewCriteria=2&sortCriteria=R&facetsOrder=I%2CCC%2CN%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR%2CG&page_num=" + i + "&openFacets=I%2CCC%2CN";
                                    PostResponce = HttpHelper.postFormData(new Uri(PostRequestURL), PostdataForPagination);
                                }
                                catch { }

                            }

                            if (PostResponce.Contains("/profile/view?id"))
                            {

                                List<string> PageSerchUrl = ChilkatBasedRegex.GettingAllUrls(PostResponce, "profile/view?id");
                                if (PageSerchUrl.Count == 0)
                                {
                                    break;
                                }
                                foreach (string item in PageSerchUrl)
                                {
                                    try
                                    {
                                        {
                                            if (item.Contains("authType=") && item.Contains("pp_profile_name_link"))
                                            {

                                                try
                                                {
                                                    if (item.Contains("//www.linkedin.com"))
                                                    {
                                                        string urlSerch = item;
                                                        lstRecordurl.Add(urlSerch);
                                                        lstRecordurl = lstRecordurl.Distinct().ToList();
                                                    }
                                                    else
                                                    {
                                                        string urlSerch = "https://www.linkedin.com" + item;
                                                        lstRecordurl.Add(urlSerch);
                                                        lstRecordurl = lstRecordurl.Distinct().ToList();
                                                    }
                                                }
                                                catch { }
                                            }
                                        }
                                    }
                                    catch
                                    {
                                    }
                                }
                            }

                            else if (!PostResponce.Contains("authType=") && PostResponce.Contains("Custom views are no longer supported. Please select either Basic or Expanded view"))
                            {
                                break;
                            }
                        }
                    }
                }
                else
                {
                    if (ResponseForPremiumAcc.Contains("Account Type:</span> Basic"))
                    {
                        try
                        {
                            PostRequestURL = "http://www.linkedin.com/search/hits";
                            PostdataForPagination = "lname=" + lastName + "&searchLocationType=I&countryCode=" + countrycd + "&postalCode=" + postalcd + "&distance=" + distance + "&keepFacets=keepFacets&facet_I=" + indstrycd + "&pplSearchOrigin=ADVS&viewCriteria=2&sortCriteria=R&facetsOrder=I%2CCC%2CN%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR%2CG&page_num=1&openFacets=I%2CCC%2CN";
                            PostResponce = HttpHelper.postFormData(new Uri(PostRequestURL), PostdataForPagination);
                        }
                        catch { }
                    }
                    else if (ResponseForPremiumAcc.Contains("Account Type:</span> Executive"))
                    {
                        try
                        {
                            PostRequestURL = "http://www.linkedin.com/search/hits";
                            PostdataForPagination = "lname=" + lastName + "&searchLocationType=I&countryCode=" + countrycd + "&postalCode=" + postalcd + "&distance=" + distance + "&keepFacets=keepFacets&facet_I=" + indstrycd + "&pplSearchOrigin=ADVS&viewCriteria=2&sortCriteria=R&facetsOrder=I%2CCC%2CN%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR%2CG&page_num=1&openFacets=I%2CCC%2CN";
                            PostResponce = HttpHelper.postFormData(new Uri(PostRequestURL), PostdataForPagination);
                        }
                        catch { }

                    }

                    if (PostResponce.Contains("/profile/view?id"))
                    {

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

                            //Log("On the basis of you Account you can able to see " + RecordURL.Count + "Results");
                            // break;
                        }
                        foreach (string item in PageSerchUrl)
                        {
                            try
                            {
                                {
                                    if (item.Contains("authType="))
                                    {

                                        string urlSerch = "http://www.linkedin.com" + item;
                                        // Log(urlSerch);
                                        lstRecordurl.Add(urlSerch);
                                    }
                                }
                            }
                            catch
                            {
                            }
                        }
                    }

                }
            }
            catch { }
            return lstRecordurl;
        }
Ejemplo n.º 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 { }
        }
Ejemplo n.º 9
0
        public void PostAttachLinkGroupUpdate(ref GlobusHttpHelper HttpHelper, List<string> selectedItems, object parameter, int mindelay, int maxdelay)
        {
            string postdata = string.Empty;
             string referal = string.Empty;
             string postUrl = string.Empty;
             string ResLogin = string.Empty;
             string csrfToken = string.Empty;
             string sourceAlias = string.Empty;
             string ReturnString = string.Empty;
             string PostGrpAttachLink = string.Empty;
             string PostGrpKey = string.Empty;
             string Poststatus = string.Empty;

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

                 Array paramsArray = (Array)parameter;

                 string user = string.Empty;
                 try
                 {
                     user = paramsArray.GetValue(1).ToString();
                 }
                 catch { }

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

                 if (pageSource.Contains("csrfToken"))
                 {
                     string pattern = @"\";
                     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.Replace(pattern, string.Empty.Trim());
                 }

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

                 try
                 {
                     int counter = 0;
                     foreach (var Itegid in selectedItems)
                     {
                         counter = counter + 1;
                         try
                         {

                                 lock (Locked_Que_GrpAttachLink_Post)
                                 {
                                     if (Que_GrpAttachLink_Post.Count > 0)
                                     {
                                         try
                                         {
                                             PostGrpAttachLink = Que_GrpAttachLink_Post.Dequeue();
                                         }
                                         catch { }
                                     }
                                     else
                                     {
                                         PostGrpAttachLink = AttachLink_Post;
                                     }

                                 }

                             string[] grpDisplay = Itegid.Split(':');
                             string GrpName = Itegid.ToString().Replace(",", ":").Replace("[", string.Empty).Replace("]", string.Empty).Trim();
                             string[] PostGid = GrpName.Split(':');
                             string Gid = string.Empty;

                             try
                             {
                                 if (NumberHelper.ValidateNumber(PostGid[1].Trim()))
                                 {
                                     Gid = PostGid[1].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[2].Trim()))
                                 {
                                     Gid = PostGid[2].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[3].Trim()))
                                 {
                                     Gid = PostGid[3].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[4].Trim()))
                                 {
                                     Gid = PostGid[4].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[5].Trim()))
                                 {
                                     Gid = PostGid[5].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[6].Trim()))
                                 {
                                     Gid = PostGid[6].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[7].Trim()))
                                 {
                                     Gid = PostGid[7].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[8].Trim()))
                                 {
                                     Gid = PostGid[8].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[9].Trim()))
                                 {
                                     Gid = PostGid[9].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[10].Trim()))
                                 {
                                     Gid = PostGid[10].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[11].Trim()))
                                 {
                                     Gid = PostGid[11].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[12].Trim()))
                                 {
                                     Gid = PostGid[12].Trim();
                                 }
                             }
                             catch { }

                     string ReqUrl = PostGrpAttachLink;
                     ReqUrl = ReqUrl.Replace(":", "%3A").Replace("//", "%2F%2F");
                     referal = "http://www.linkedin.com/groups/" + grpDisplay[2].Replace(" ", "-") + "-" + Gid + "?goback=%2Egmr_" + Gid;
                     string GetStatus = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/share?getPreview=&url=" + PostGrpAttachLink), referal);

                     string ImgCount = string.Empty;
                     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";
                     }

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

                     string EntityId = string.Empty;
                     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 { }

                     string contentTitle = string.Empty;
                     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 { }

                     string contentSummary = string.Empty;
                     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 PostAttachLink = string.Empty;
                     string ResponseStatusMsg = string.Empty;

                     try
                     {
                         PostAttachLink = "csrfToken=" + csrfToken + "&postTitle=&postText=&pollChoice1-ANetPostForm=&pollChoice2-ANetPostForm=&pollChoice3-ANetPostForm=&pollChoice4-ANetPostForm=&pollChoice5-ANetPostForm=&pollEndDate-ANetPostForm=0&contentImageCount=" + ImgCount + "&contentImageIndex=0&contentImage=" + LogoUrl + "&contentEntityID=" + EntityId + "&contentUrl=" + ReqUrl + "&contentTitle=" + contentTitle + "&contentSummary=" + contentSummary + "&contentImageIncluded=true&%23=&gid=" + Gid + "&postItem=&ajax=true&tetherAccountID=&facebookTetherID=";
                         ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groups"), PostAttachLink);
                     }
                     catch { }

                             string CSVHeader = "UserName" + "," + "HeaderPost" + "," + "Details Post" + "," + "ToGroup";

                             if (ResponseStatusMsg.Contains("SUCCESS") || ResponseStatusMsg.Contains("Accept  the description According to you"))
                             {
                                 Log("[ " + DateTime.Now + " ] => [ Attach Link : " + PostGrpAttachLink + " Added Successfully on Group : " + grpDisplay[2] + " ]");

                                 string CSV_Content = user + "," + PostGrpAttachLink + "," + PostGrpAttachLink + "," + grpDisplay[2];
                                 CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_GroupUpdates);

                             }
                             else if (ResponseStatusMsg.Contains("Your request to join is still pending"))
                             {
                                 Log("[ " + DateTime.Now + " ] => [ Your membership is pending approval on a Group:" + grpDisplay[2] + " ]");
                                 Log("[ " + DateTime.Now + " ] => [ Attach Link : " + PostGrpAttachLink + " Not Posted on Group:" + grpDisplay[2] + " Because Your membership is pending for approval. ]");

                                 GlobusFileHelper.AppendStringToTextfileNewLine("Your membership is pending approval on a Group:" + grpDisplay[2], Globals.path_GroupUpdate);
                                 GlobusFileHelper.AppendStringToTextfileNewLine("Message Header: " + PostGrpAttachLink + " Not Posted on Group:" + grpDisplay[2] + " Because Your membership is pending for approval. ", Globals.path_GroupUpdate);
                                 GlobusFileHelper.AppendStringToTextfileNewLine("Message More Details: " + PostGrpAttachLink + " Not Posted on Group:" + grpDisplay[2] + " Because Your membership is pending for approval. ", Globals.path_GroupUpdate);
                             }
                             else if (ResponseStatusMsg.Contains("Your post has been submitted for review"))
                             {
                                 Log("[ " + DateTime.Now + " ] => [ Message Header Posted : " + PostGrpAttachLink + " Successfully on Group : " + grpDisplay[2] + " ]");
                                 Log("[ " + DateTime.Now + " ] => [ Your post has been submitted for review ]");
                                 string CSV_Content = user + "," + PostGrpAttachLink + "," + PostGrpAttachLink + "," + grpDisplay[2];

                             }

                             else if (ResponseStatusMsg.Contains("Error"))
                             {
                                 Log("[ " + DateTime.Now + " ] => [ Error in Post ]");
                                 GlobusFileHelper.AppendStringToTextfileNewLine("Error in Post", Globals.path_GroupUpdate);

                             }
                             else
                             {
                                 Log("[ " + DateTime.Now + " ] => [ Message Not Posted ]");
                                 GlobusFileHelper.AppendStringToTextfileNewLine("Message Not Posted", Globals.path_GroupUpdate);
                             }

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

                         }
                         catch (Exception ex)
                         {
                             GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update --> cmbGroupUser_SelectedIndexChanged() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + "    Stack Trace >>> " + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                             Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");
                         }
                     }
                 }
                 catch (Exception ex)
                 {
                     GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update --> cmbGroupUser_SelectedIndexChanged() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                     GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update --> cmbGroupUser_SelectedIndexChanged() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                     Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");
                 }

             }
             catch (Exception ex)
             {
                 GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update --> cmbGroupUser_SelectedIndexChanged() ---2--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                 GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update --> cmbGroupUser_SelectedIndexChanged() ---2--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
             }
        }
Ejemplo n.º 10
0
        public void StartInBoardProGetDataWithPagination(ref GlobusHttpHelper HttpHelper)
        {
            #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.AccountType == "RecuiterType")
                {
                    string pageSourceaAdvanceSearch = HttpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/recruiter/search"));
                    string referralUrl = string.Empty;
                    if (pageSourceaAdvanceSearch.Contains("csrfToken"))
                    {
                        try
                        {
                            int pagenumberrecruiter = 0;
                            bool IsShowLoggerPagecount = true;
                            int i = 1;
                            int startCount = 0;

                            #region seniorLevel
                            string tempSeniorlevel = string.Empty;
                            if (SearchCriteria.SeniorLevel.Contains(","))
                            {
                                string[] arrseniorLevel = Regex.Split(SearchCriteria.SeniorLevel, ",");
                                if (arrseniorLevel.Count() > 1)
                                {
                                    foreach (string item in arrseniorLevel)
                                    {
                                        tempSeniorlevel += "&facet.SE=" + item;
                                    }
                                }
                                else
                                {
                                    tempSeniorlevel = "&facet.SE=";
                                }
                            }
                            else if (string.IsNullOrEmpty(SearchCriteria.SeniorLevel))
                            {
                                tempSeniorlevel = "&facet.SE=";
                            }
                            else
                            {
                                tempSeniorlevel = "&facet.SE=" + SearchCriteria.SeniorLevel;
                            }
                            #endregion

                            #region Function
                            string tempFunction = string.Empty;
                            if (SearchCriteria.Function.Contains(","))
                            {
                                string[] arrFunction = Regex.Split(SearchCriteria.Function, ",");
                                if (arrFunction.Count() > 1)
                                {
                                    foreach (string item in arrFunction)
                                    {
                                        tempFunction += "&facet.FA=" + item;
                                    }
                                }
                                else
                                {
                                    tempFunction = "&facet.FA=";
                                }
                            }
                            else if (string.IsNullOrEmpty(SearchCriteria.Function))
                            {
                                tempFunction = "&facet.FA=";
                            }
                            else
                            {
                                tempFunction = "&facet.FA=" + SearchCriteria.Function;
                            }
                            #endregion

                            #region RelationShip
                            string tempRelationShip = string.Empty;
                            if (SearchCriteria.Relationship.Contains(","))
                            {
                                string[] arrRelationShip = Regex.Split(SearchCriteria.Relationship, ",");
                                if (arrRelationShip.Count() > 1)
                                {
                                    foreach (string item in arrRelationShip)
                                    {
                                        tempRelationShip += "&facet.N=" + item;
                                    }
                                }
                                else
                                {
                                    tempRelationShip = "&facet.N=";
                                }
                            }
                            else if (string.IsNullOrEmpty(SearchCriteria.Relationship))
                            {
                                tempRelationShip = "&facet.N=";
                            }
                            else
                            {
                                tempRelationShip = "&facet.N=" + SearchCriteria.Relationship;
                            }
                            #endregion

                            #region Language
                            string tempLanguage = string.Empty;
                            if (SearchCriteria.language.Contains(","))
                            {
                                string[] arrLanguage = Regex.Split(SearchCriteria.language, ",");
                                if (arrLanguage.Count() > 1)
                                {
                                    foreach (string item in arrLanguage)
                                    {
                                        tempLanguage += "&facet.L=" + item;
                                    }
                                }
                                else
                                {
                                    tempLanguage = "&facet.L=";
                                }
                            }
                            else if (string.IsNullOrEmpty(SearchCriteria.language))
                            {
                                tempLanguage = "&facet.L=";
                            }
                            else
                            {
                                tempLanguage = "&facet.L=" + SearchCriteria.language;
                            }
                            #endregion

                            #region Industry
                            string tempIndustry = string.Empty;
                            if (SearchCriteria.IndustryType.Contains(","))
                            {
                                string[] arrIndustry = Regex.Split(SearchCriteria.IndustryType, ",");
                                if (arrIndustry.Count() > 1)
                                {
                                    foreach (string item in arrIndustry)
                                    {
                                        tempIndustry += "&facet.L=" + item;
                                    }
                                }
                                else
                                {
                                    tempIndustry = "&facet.L=";
                                }
                            }
                            else if (string.IsNullOrEmpty(SearchCriteria.IndustryType))
                            {
                                tempIndustry = "&facet.L=";
                            }
                            else
                            {
                                tempIndustry = "&facet.L=" + SearchCriteria.IndustryType;
                            }
                            #endregion

                            #region Year of Experience
                            string tempExperience = string.Empty;
                            if (SearchCriteria.YearOfExperience.Contains(","))
                            {
                                string[] arrYearOfExperience = Regex.Split(SearchCriteria.YearOfExperience, ",");
                                if (arrYearOfExperience.Count() > 1)
                                {
                                    foreach (string item in arrYearOfExperience)
                                    {
                                        tempExperience += "&facet.TE=" + item;
                                    }
                                }
                                else
                                {
                                    tempExperience = "&facet.TE=";
                                }
                            }
                            else if (string.IsNullOrEmpty(SearchCriteria.YearOfExperience))
                            {
                                tempExperience = "&facet.TE=";
                            }
                            else
                            {
                                tempExperience = "&facet.TE=" + SearchCriteria.YearOfExperience;
                            }
                            #endregion

                            #region InterestedIN
                            string tempInteresedIn = string.Empty;
                            if (SearchCriteria.InerestedIn.Contains(","))
                            {
                                string[] arrInterestedIn = Regex.Split(SearchCriteria.InerestedIn, ",");
                                if (arrInterestedIn.Count() > 1)
                                {
                                    foreach (string item in arrInterestedIn)
                                    {
                                        tempInteresedIn += "&facet.P=" + item;
                                    }
                                }
                                else
                                {
                                    tempInteresedIn = "&facet.P=";
                                }
                            }
                            else if (string.IsNullOrEmpty(SearchCriteria.InerestedIn))
                            {
                                tempInteresedIn = "&facet.P=";
                            }
                            else
                            {
                                tempInteresedIn = "&facet.P=" + SearchCriteria.InerestedIn;
                            }
                            #endregion

                        StartAgain:

                            string recruiterUrl = string.Empty; //"https://www.linkedin.com/recruiter/api/search?keywords=" + Uri.EscapeDataString(SearchCriteria.Keyword) + "&page=" + i + "&start=" + startCount + "&count=25&countryCode=" + SearchCriteria.Country + "&postalCode=" + SearchCriteria.PostalCode + "&radiusMiles=" + SearchCriteria.within + "&jobTitle=" + SearchCriteria.Title + "&jobTitleTimeScope=" + SearchCriteria.TitleValue + "&company=" + SearchCriteria.Company + "&companyTimeScope=" + SearchCriteria.CompanyValue + "&firstName=" + SearchCriteria.FirstName + "&lastName=" + SearchCriteria.LastName + "&facet.TE=" + SearchCriteria.YearOfExperience + "&facet.CS=" + SearchCriteria.CompanySize + "&facet.L=" + SearchCriteria.language + "&facet.I=" + SearchCriteria.IndustryType + "&facet.FG=" + SearchCriteria.Group + "&facet.N=" + SearchCriteria.Relationship + "&facet.FA=" + SearchCriteria.Function + "&facet.SE=" + SearchCriteria.SeniorLevel + "&facet.P=" + SearchCriteria.InerestedIn + "&facet.F=" + SearchCriteria.Fortune1000 + "&facet.DR=" + SearchCriteria.RecentlyJoined + "&origin=ASAS"; //&facet.I=" + SearchCriteria.IndustryType + "&facet.FG=" + SearchCriteria.Group + "&facet.N=" + SearchCriteria.Relationship + "&facet.FA=" + SearchCriteria.Function + "&facet.SE=" + SearchCriteria.SeniorLevel + "&facet.P=" + SearchCriteria.InerestedIn + "&facet.F=" + SearchCriteria.Fortune1000 + "&facet.DR=" + SearchCriteria.RecentlyJoined + "
                            recruiterUrl = "https://www.linkedin.com/recruiter/api/search?keywords=" + Uri.EscapeDataString(SearchCriteria.Keyword) + "&page=" + i + "&start=" + startCount + "&count=25&countryCode=" + SearchCriteria.Country + "&postalCode=" + SearchCriteria.PostalCode + "&radiusMiles=" + SearchCriteria.within + "&jobTitle=" + SearchCriteria.Title + "&jobTitleTimeScope=" + SearchCriteria.TitleValue + "&company=" + SearchCriteria.Company + "&companyTimeScope=" + SearchCriteria.CompanyValue + "&firstName=" + SearchCriteria.FirstName + "&lastName=" + SearchCriteria.LastName + "" + tempExperience + "&facet.CS=" + SearchCriteria.CompanySize + "" + tempLanguage+ "" + tempIndustry + "&facet.FG=" + SearchCriteria.Group + "" + tempRelationShip + "" + tempFunction + "" + tempSeniorlevel + "" + tempInteresedIn + "&facet.F=" + SearchCriteria.Fortune1000 + "&facet.DR=" + SearchCriteria.RecentlyJoined + "&origin=ASAS"; //&facet.I=" + SearchCriteria.IndustryType + "&facet.FG=" + SearchCriteria.Group + "&facet.N=" + SearchCriteria.Relationship + "&facet.FA=" + SearchCriteria.Function + "&facet.SE=" + SearchCriteria.SeniorLevel + "&facet.P=" + SearchCriteria.InerestedIn + "&facet.F=" + SearchCriteria.Fortune1000 + "&facet.DR=" + SearchCriteria.RecentlyJoined + "
                            if (string.IsNullOrEmpty(SearchCriteria.Keyword))
                            {
                                recruiterUrl = recruiterUrl.Replace("keywords=", "");
                            }

                            if (string.IsNullOrEmpty(SearchCriteria.Country))
                            {
                                recruiterUrl = recruiterUrl.Replace("&countryCode=", "");
                            }

                            if (string.IsNullOrEmpty(SearchCriteria.PostalCode))
                            {
                                recruiterUrl = recruiterUrl.Replace("&postalCode=", "");
                            }
                            if (string.IsNullOrEmpty(SearchCriteria.within))
                            {
                                recruiterUrl = recruiterUrl.Replace("&radiusMiles=", "");
                            }

                            if (string.IsNullOrEmpty(SearchCriteria.Title))
                            {
                                recruiterUrl = recruiterUrl.Replace("&jobTitle=", "");
                            }
                            if (string.IsNullOrEmpty(SearchCriteria.TitleValue))
                            {
                                recruiterUrl = recruiterUrl.Replace("&jobTitleTimeScope=", "");
                            }
                            if (string.IsNullOrEmpty(SearchCriteria.Company))
                            {
                                recruiterUrl = recruiterUrl.Replace("&company=", "");
                            }
                            if (string.IsNullOrEmpty(SearchCriteria.CompanyValue))
                            {
                                recruiterUrl = recruiterUrl.Replace("&companyTimeScope=", "");
                            }

                            if (string.IsNullOrEmpty(SearchCriteria.FirstName))
                            {
                                recruiterUrl = recruiterUrl.Replace("&firstName=", "");
                            }
                            if (string.IsNullOrEmpty(SearchCriteria.LastName))
                            {
                                recruiterUrl = recruiterUrl.Replace("&lastName=", "");
                            }
                            if (string.IsNullOrEmpty(SearchCriteria.YearOfExperience))
                            {
                                recruiterUrl = recruiterUrl.Replace("&facet.TE=", "");
                            }
                            if (string.IsNullOrEmpty(SearchCriteria.CompanySize))
                            {
                                recruiterUrl = recruiterUrl.Replace("&facet.CS=", "");
                            }
                            if (string.IsNullOrEmpty(SearchCriteria.language))
                            {
                                recruiterUrl = recruiterUrl.Replace("&facet.L=", "");
                            }
                            if (string.IsNullOrEmpty(SearchCriteria.IndustryType))
                            {
                                recruiterUrl = recruiterUrl.Replace("&facet.I=", "");
                            }
                            if (string.IsNullOrEmpty(SearchCriteria.SeniorLevel))
                            {
                                recruiterUrl = recruiterUrl.Replace("&facet.SE=", "");
                            }
                            if (string.IsNullOrEmpty(SearchCriteria.Function))
                            {
                                recruiterUrl = recruiterUrl.Replace("&facet.FA=", "");
                            }
                            if (string.IsNullOrEmpty(SearchCriteria.Relationship))
                            {
                                recruiterUrl = recruiterUrl.Replace("&facet.N=", "");
                            }
                            if (string.IsNullOrEmpty(SearchCriteria.InerestedIn))
                            {
                                recruiterUrl = recruiterUrl.Replace("&facet.P=", "");
                            }
                            if (string.IsNullOrEmpty(SearchCriteria.Fortune1000))
                            {
                                recruiterUrl = recruiterUrl.Replace("&facet.F=", "");
                            }
                            if (string.IsNullOrEmpty(SearchCriteria.Group))
                            {
                                recruiterUrl = recruiterUrl.Replace("&facet.FG=", "");
                            }
                            if (string.IsNullOrEmpty(SearchCriteria.RecentlyJoined))
                            {
                                recruiterUrl = recruiterUrl.Replace("&facet.DR=", "");
                            }

                            recruiterUrl = recruiterUrl.Trim();

                            referralUrl = "https://www.linkedin.com/recruiter/search?searchHistoryId=1256614203&searchCacheKey=226602fa-2763-48a7-a2ff-dfddc87c4840%2CIwQE&linkContext=Controller%3ApeopleSearch%2CAction%3AresultsWithFacets%2CID%3A1256614203&page=1&start=0&count=25";
                            string pageSourceaAdvanceSearch11 = string.Empty;

                            try
                            {
                                pageSourceaAdvanceSearch11 = HttpHelper.getHtmlfromUrlNewRefre(new Uri(recruiterUrl), referralUrl);
                            }
                            catch { }
                            string strTotalPageNO = string.Empty;

                            if (IsShowLoggerPagecount)
                            {
                                strTotalPageNO = Utils.getBetween(pageSourceaAdvanceSearch11, "total\":", ",").Trim();

                                try
                                {
                                    pagenumberrecruiter = int.Parse(strTotalPageNO);

                                    Log("[ " + DateTime.Now + " ] => [ Total Results :  " + pagenumberrecruiter + " ]");

                                }
                                catch (Exception)
                                {

                                }

                                pagenumberrecruiter = (pagenumberrecruiter / 25) + 1;

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

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

                                //if (IsShowLoggerPagecount)
                                {
                                    if (pagenumberrecruiter >= 1)
                                    {
                                        _HttpHelper = HttpHelper;

                                        if (!Globals.scrapeWithoutGoingToMainProfile)
                                        {
                                            new Thread(() =>
                                            {
                                                if (SearchCriteria.starter)
                                                {
                                                    string CheckString = string.Empty;
                                                    finalUrlCollectionForRecruter(CheckString);
                                                }

                                            }).Start();
                                        }
                                    }
                                }
                            }
                            IsShowLoggerPagecount = false;
                            while (i <= pagenumberrecruiter)
                            {
                                if (SearchCriteria.starter)
                                {

                                    if (pageSourceaAdvanceSearch11.Contains("memberId"))
                                    {
                                        try
                                        {
                                            List<string> PageSerchUrl = GettingAllUrlRecruiterType(pageSourceaAdvanceSearch11);
                                            PageSerchUrl.Distinct();

                                            if (PageSerchUrl.Count == 0)
                                            {
                                                Log("[ " + 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("recruiter/profile"))
                                                    {
                                                        try
                                                        {
                                                            string urlSerch = item;
                                                            if (urlSerch.Contains("recruiter/profile"))
                                                            {
                                                                RecordURL.Add(urlSerch);
                                                                if (!queRecordUrl.Contains(urlSerch))
                                                                {
                                                                    queRecordUrl.Enqueue(urlSerch);
                                                                }
                                                                RecordURL = RecordURL.Distinct().ToList();
                                                            }

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

                                            if (i == pagenumberrecruiter)
                                            {
                                                break;
                                            }

                                            startCount += 25; ;
                                            i++;
                                            Thread.Sleep(4000);
                                            goto StartAgain;
                                        }
                                        catch { }
                                    }

                                }
                            }
                            #region MyRegion

                            //string searchHistoryId = Utils.getBetween(pageSourceaAdvanceSearch, "searchHistoryId\":", ",").Replace("\"", "").Trim();
                           // string searchCacheKey = Utils.getBetween(pageSourceaAdvanceSearch, "searchCacheKey\":", ",\"").Replace("\"", "").Trim();
                            //string linkContext = Utils.getBetween(pageSourceaAdvanceSearch, "linkContext\":", ",\"").Replace("\"", "").Trim();
                            //referralUrl = "https://www.linkedin.com/recruiter/search?searchHistoryId=" + Uri.EscapeDataString(searchHistoryId) + "&searchCacheKey=" + Uri.EscapeDataString(searchCacheKey).Replace(",", "%2C") + "&linkContext=" + Uri.EscapeDataString(linkContext) + "&page=1&start=0&count=25";

                            //pageSourceaAdvanceSearch = HttpHelper.getHtmlfromUrl1(new Uri(referralUrl));
                            //searchHistoryId = Utils.getBetween(pageSourceaAdvanceSearch, "searchHistoryId\":", ",").Replace("\"", "").Trim();
                            //searchCacheKey = Utils.getBetween(pageSourceaAdvanceSearch, "searchCacheKey\":", ",\"").Replace("\"", "").Trim();
                            //linkContext = Utils.getBetween(pageSourceaAdvanceSearch, "linkContext\":", ",\"").Replace("\"", "").Trim();

                            //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).Replace("%3A", ":"); ;
                            //}

                            //string postData = "{\"keywords\":\"hr\",\"locationParams\":{\"countryCode\":\"us\",\"postalCode\":[null]},\"metaParams\":{\"resetFacets\":true,\"reset\":[\"keywords\",\"countryCode\",\"postalCode\",\"company\",\"companyTimeScope\",\"jobTitle\",\"jobTitleTimeScope\",\"notes\",\"projects\",\"reviews\",\"reminders\"],\"origin\":\"GHDS\"},\"pagingParams\":{\"count\":1}}";
                            //postData = "{\"keywords\":\"hr\",\"locationParams\":{\"countryCode\":\"us\",\"postalCode\":[null]},\"metaParams\":{\"resetFacets\":true,\"reset\":[\"keywords\",\"countryCode\",\"postalCode\",\"company\",\"companyTimeScope\",\"jobTitle\",\"jobTitleTimeScope\",\"notes\",\"projects\",\"reviews\",\"reminders\"],\"origin\":\"GHDS\"},\"pagingParams\":{\"count\":1}}";

                            //string responsePostData = HttpHelper.postFormDataRefDemo(new Uri("https://www.linkedin.com/recruiter/search"), postData, referralUrl, csrfToken, "XMLHttpRequest", "", "https://www.linkedin.com", "");
                            //responsePostData = HttpHelper.postFormDataRefDemo(new Uri("https://www.linkedin.com/recruiter/search"), "", referralUrl, csrfToken, "", "XMLHttpRequest", "https://www.linkedin.com", "1");
                            //string demo = responsePostData;
                            #endregion

                        }
                        catch { }

                    }
                    return;

                }

                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 (SearchCriteria.Location == "Y")
                        {
                            SearchCriteria.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(SearchCriteria.Keyword) + "&title=" + SearchCriteria.Title + "&titleScope=" + SearchCriteria.TitleValue + "&firstName=" + SearchCriteria.FirstName + "&lastName=" + SearchCriteria.LastName + "&postalCode=" + SearchCriteria.PostalCode + "&companyScope=" + SearchCriteria.CompanyValue + "&locationType=" + SearchCriteria.Location + "&countryCode=" + SearchCriteria.Country + "&company=" + SearchCriteria.Company + "&distance=" + SearchCriteria.within + "&f_FG=" + SearchCriteria.Group + "&f_L=" + SearchCriteria.language + "&f_N=" + SearchCriteria.Relationship + "&f_G=" + SearchCriteria.LocationArea + "&f_I=" + SearchCriteria.IndustryType + "&f_TE=" + SearchCriteria.YearOfExperience + "&f_FA=" + SearchCriteria.Function + "&f_SE=" + SearchCriteria.SeniorLevel + "&f_P=" + SearchCriteria.InerestedIn + "&f_CS=" + SearchCriteria.CompanySize + "&f_F=" + SearchCriteria.Fortune1000 + "&f_DR=" + SearchCriteria.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(","));

                                #region Commented
                                //Regex IdCheck = new Regex("^[0-9]*$");

                                //string[] tempResultArr = Regex.Split(tempResult, "[^0-9]");

                                //foreach (string item in tempResultArr)
                                //{
                                //    try
                                //    {
                                //        if(IdCheck.IsMatch(item))
                                //        {
                                //            strPageNumber = item;

                                //            break;
                                //        }
                                //    }
                                //    catch (Exception ex)
                                //    {
                                //    }
                                //}
                                #endregion

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

                    Log("[ " + 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;

                    if (!Globals.scrapeWithoutGoingToMainProfile)
                    {
                        new Thread(() =>
                        {
                            if (SearchCriteria.starter)
                            {
                                string CheckString = string.Empty;
                                finalUrlCollection(CheckString);
                            }

                        }).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(SearchCriteria.Keyword) + "&title=" + Uri.EscapeDataString(SearchCriteria.Title) + "&fname=" + SearchCriteria.FirstName + "&lname=" + SearchCriteria.LastName + "&searchLocationType=" + SearchCriteria.Location + "&f_FG=" + SearchCriteria.Group + "&companyScope=" + SearchCriteria.CompanyValue + "&countryCode=" + SearchCriteria.Country + "&company=" + SearchCriteria.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(SearchCriteria.Keyword) + "&title=" + Uri.EscapeDataString(SearchCriteria.Title) + "&fname=" + SearchCriteria.FirstName + "&lname=" + SearchCriteria.LastName + "&searchLocationType=" + SearchCriteria.Location + "&f_FG=" + SearchCriteria.Group + "&companyScope=" + SearchCriteria.CompanyValue + "&countryCode=" + SearchCriteria.Country + "&keepFacets=keepFacets&I=" + SearchCriteria.IndustryType + "&SE=" + SearchCriteria.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(SearchCriteria.Keyword) + "&title=" + Uri.EscapeDataString(SearchCriteria.Title) + "&titleScope=" + SearchCriteria.TitleValue + "&firstName=" + SearchCriteria.FirstName + "&lastName=" + SearchCriteria.LastName + "&postalCode=" + SearchCriteria.PostalCode + "&openAdvancedForm=true&companyScope=" + SearchCriteria.CompanyValue + "&locationType=" + SearchCriteria.Location + "&f_FG=" + SearchCriteria.Group + "&countryCode=" + SearchCriteria.Country + "&company=" + SearchCriteria.Company + "&distance=" + SearchCriteria.within + "&f_N=" + SearchCriteria.Relationship + "&f_G=" + SearchCriteria.LocationArea + "&f_I=" + SearchCriteria.IndustryType + "&f_TE=" + SearchCriteria.YearOfExperience + "&f_FA=" + SearchCriteria.Function + "&f_SE=" + SearchCriteria.SeniorLevel + "&f_P=" + SearchCriteria.InerestedIn + "&f_CS=" + SearchCriteria.CompanySize + "&f_F=" + SearchCriteria.Fortune1000 + "&f_DR=" + SearchCriteria.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(SearchCriteria.Title) + "&fname=" + SearchCriteria.FirstName + "&lname=" + SearchCriteria.LastName + "&searchLocationType=" + SearchCriteria.Location + "&f_FG=" + SearchCriteria.Group + "&countryCode=" + SearchCriteria.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 { }
                            }

                            if (PostResponce.Contains("/profile/view?id"))
                            {

                                if (Globals.scrapeWithoutGoingToMainProfile)
                                {

                                    if (i > 10)
                                    {
                                        if(PostResponce.Contains("Upgrade your account to see more results"))
                                        {
                                            Log("[ " + DateTime.Now + " ] => [ Search result limit reached. ]");
                                            Log("[ " + DateTime.Now + " ] => [ PROCESS COMPLETE ]");
                                            return;
                                        }
                                    }
                                    else
                                    {
                                        Log("[ " + DateTime.Now + " ] => [ Crawling search result page number : " + i + " ]");
                                        CrawlingProfileDataFromSearchPage(PostResponce, ref HttpHelper);
                                    }
                                }
                                else
                                {
                                    List<string> PageSerchUrl = GettingAllUrl(PostResponce);
                                    PageSerchUrl.Distinct();

                                    if (PageSerchUrl.Count == 0)
                                    {
                                        Log("[ " + 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);
                                                        if (!queRecordUrl.Contains(urlSerch))
                                                        {
                                                            queRecordUrl.Enqueue(urlSerch);
                                                        }
                                                        RecordURL = RecordURL.Distinct().ToList();
                                                    }

                                                    try
                                                    {
                                                        Log("[ " + 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
                        }
                    }
                }
                #region For Else
                else
                {
                    if (!Globals.scrapeWithoutGoingToMainProfile)
                    {
                        if (SearchCriteria.starter)
                        {

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

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

                                    Log("[ " + 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;
                                            Log("[ " + DateTime.Now + " ] => [ " + urlSerch + " ]");
                                            RecordURL.Add(urlSerch);
                                            queRecordUrl.Enqueue(urlSerch);

                                        }
                                    }
                                }
                            }
                            #endregion
                        }
                    }

                }

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

                RecordURL.Distinct();
                //if (SearchCriteria.starter)
                //{
                //    finalUrlCollection(ref HttpHelper);
                //    //new Thread(() =>
                //    //{
                //    //    test();
                //    //}).Start();
                //}

            }

               #endregion

            catch { }
            #endregion
        }
Ejemplo n.º 11
0
        public string PostFollowCompanyUsingUrl(ref GlobusHttpHelper HttpHelper, Dictionary<string, Dictionary<string, string>> LinkdInContacts, int mindelay, int maxdelay)
        {
            string postdata = string.Empty;
             string postUrl = string.Empty;
             string ResLogin = string.Empty;
             string csrfToken = string.Empty;
             string sourceAlias = string.Empty;
             string ReturnString = string.Empty;

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

                 if (pageSource.Contains("csrfToken"))
                 {
                     csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 50);
                     string[] Arr = csrfToken.Split('&');
                     csrfToken = Arr[0];
                     csrfToken = csrfToken.Replace(":", "%3A").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
                 {
                     int counter = 0;
                     foreach (KeyValuePair<string, Dictionary<string, string>> UserValue in LinkdInContacts)
                     {
                         counter = counter + 1;
                         foreach (KeyValuePair<string, string> GroupValue in UserValue.Value)
                         {
                             post_url = string.Empty;
                             post_url = (GroupValue.Key + ":" + GroupValue.Value);

                             string Screen_name = UserValue.Key.Split(':')[0];
                             string pass = UserValue.Key.Split(':')[1];

                             postUrl = "https://www.linkedin.com/uas/login-submit";
                             postdata = "session_key=" + Screen_name + "&session_password="******"&source_app=&trk=guest_home_login&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;
                             ResLogin = HttpHelper.postFormData(new Uri(postUrl), postdata);

                             try
                             {
                                 string GoBack = "%2Ebzo_*1_*1_*1_*1_*1_*1_*1_" + post_url.Split(':')[1];
                                 Log("[ " + DateTime.Now + " ] => [ ID: " + Screen_name + " has Follow the Company: " + post_url.Split(':')[0] + " ]");
                                 string pageGetreq = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/company/follow/submit?id=" + post_url.Split(':')[1] + "&fl=start&version=2&ft=pageKey%3Dbiz-overview-internal%3Bmodule%3Dbutton&sp=biz-overview&csrfToken=" + csrfToken + "&goback="+ GoBack));

                                 if (pageGetreq.Contains("Following"))
                                 {
                                     ReturnString = "Your request to Follow the: " + post_url.Split(':')[0] + " company has been Successfully Followed.";
                                     Log("[ " + DateTime.Now + " ] => [ " + ReturnString + " ]");
                                     //GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + ReturnString, Globals.path_FollowCompany);

                                 }
                                 else if (pageGetreq.Contains("Error"))
                                 {
                                     Log("[ " + DateTime.Now + " ] => [ Error In Follow Company ]");
                                     GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + "Error In Follow Company", Globals.path_Not_FollowCompany);
                                 }
                                 else
                                 {
                                     Log("[ " + DateTime.Now + " ] => [ Company Could Not Be Followed ]");
                                     GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + "Company Could Not Be Followed", Globals.path_Not_FollowCompany);
                                 }
                             }
                             catch { }

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

                         }
                     }

                 }
                 catch (Exception ex)
                 {
                     GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Follow Company--1 --> PostFollowCompanyUsingUrl() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                     GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Follow Company--1 --> PostFollowCompanyUsingUrl() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinFollowCompanyErrorLogs);
                 }
             }
             catch (Exception ex)
             {
                 GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Follow Company--2--> PostFollowCompanyUsingUrl() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                 GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Follow Company--2--> PostFollowCompanyUsingUrl() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinFollowCompanyErrorLogs);
                 ReturnString = "Error";
             }
             return ReturnString;
        }
Ejemplo n.º 12
0
       public bool AddaPictureForEditMessage(ref GlobusHttpHelper HttpHelper, string Username, string Password, string localImagePath, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, string targeturl, string message, ref string status, string pageSource_Home, string xhpc_targetid, string xhpc_composerid, string message_text, string fb_dtsg, string UsreId, string pageSource, ref int tempCountMain,int delay)
       {

           // string pageSource = HttpHelper.getHtmlfromUrl(new Uri(targeturl));
           int tempCount = 0;
       startAgain:

           bool isSentPicMessage = false;
           //string fb_dtsg = string.Empty;
           string photo_id = string.Empty;
           //string UsreId = string.Empty;
           //xhpc_composerid = string.Empty;
           //xhpc_targetid = string.Empty;
           //message_text = string.Empty;

           try
           {
               #region commentedCode


               //string pageSource_Home = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/home.php"));

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

               //fb_dtsg = GlobusHttpHelper.GetParamValue(pageSource_Home, "fb_dtsg");//pageSourceHome.Substring(pageSourceHome.IndexOf("fb_dtsg") + 16, 8);
               //if (string.IsNullOrEmpty(fb_dtsg))
               //{
               //    fb_dtsg = GlobusHttpHelper.ParseJson(pageSource_Home, "fb_dtsg");
               //}


               //string pageSource_HomeData = HttpHelper.getHtmlfromUrl(new Uri(targeturl));
               //xhpc_composerid = GlobusHttpHelper.GetParamValue(pageSource_HomeData, "composerid");
               //xhpc_targetid = GlobusHttpHelper.GetParamValue(pageSource_HomeData, "xhpc_targetid"); 
               #endregion

               string composer_session_id = "";

               string tempresponse1 = "";
               ///temp post
               {
                   string source = "";
                   string profile_id = "";
                   string gridID = "";
                   //  string qn = string.Empty;

                   try
                   {
                       string Url = "https://www.facebook.com/ajax/composerx/attachment/media/upload/?composerurihash=1";
                       string posturl1 = "fb_dtsg=" + fb_dtsg + "&composerid=" + xhpc_composerid + "&targetid=" + xhpc_targetid + "&loaded_components[0]=maininput&loaded_components[1]=cameraicon&loaded_components[2]=withtaggericon&loaded_components[3]=placetaggericon&loaded_components[4]=mainprivacywidget&loaded_components[5]=cameraicon&loaded_components[6]=mainprivacywidget&loaded_components[7]=withtaggericon&loaded_components[8]=placetaggericon&loaded_components[9]=maininput&nctr[_mod]=pagelet_group_composer&__user="******"&__a=1&__dyn=7n88QoAMNoBwXAw&__req=i&phstamp=16581688688747595501";    //"fb_dtsg=" + fb_dtsg + "&composerid=" + xhpc_composerid + "&targetid=" + xhpc_targetid + "&istimeline=1&timelinelocation=composer&loaded_components[0]=maininput&loaded_components[1]=mainprivacywidget&loaded_components[2]=mainprivacywidget&loaded_components[3]=maininput&loaded_components[4]=explicitplaceinput&loaded_components[5]=hiddenplaceinput&loaded_components[6]=placenameinput&loaded_components[7]=hiddensessionid&loaded_components[8]=withtagger&loaded_components[9]=backdatepicker&loaded_components[10]=placetagger&loaded_components[11]=withtaggericon&loaded_components[12]=backdateicon&loaded_components[13]=citysharericon&nctr[_mod]=pagelet_timeline_recent&__user="******"&__a=1&__dyn=7n88QoAMNoBwXAw&__req=18&phstamp=1658168111112559866679";
                       // string PostUrl = "city_id=" + CityIDS1 + "&city_page_id=" + city_page_id + "&city_name=" + CityName1 + "&is_default=false&session_id=1362404125&__user="******"&__a=1&__dyn=798aD5z5ynU&__req=z&fb_dtsg=" + fb_dtsg + "&phstamp=1658168111112559866165";
                       string res11 = HttpHelper.postFormData(new Uri(Url), posturl1);


                       try
                       {
                           source = res11.Substring(res11.IndexOf("source\":"), (res11.IndexOf(",", res11.IndexOf("source\":")) - res11.IndexOf("source\":"))).Replace("source\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();

                       }
                       catch (Exception ex)
                       {
                           GlobusLogHelper.log.Error(ex.StackTrace);
                       }
                       if (string.IsNullOrEmpty(source))
                       {
                           source = Utils.getBetween(res11, "source", "profile_id").Replace("\\\"", "").Replace(",", "").Replace(":", "").Trim();

                       }
                       try
                       {
                           profile_id = res11.Substring(res11.IndexOf("profile_id\":"), (res11.IndexOf("}", res11.IndexOf("profile_id\":")) - res11.IndexOf("profile_id\":"))).Replace("profile_id\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
                           if (profile_id.Contains(","))
                           {
                               profile_id = ParseEncodedJson(res11, "profile_id");
                           }
                           //"gridID":
                       }
                       catch { }
                       if (string.IsNullOrEmpty(profile_id))
                       {
                           profile_id = Utils.getBetween(res11, "profile_id", "}").Replace("\\\"", "").Replace(",", "").Replace(":", "").Trim();
                       }
                       try
                       {
                           gridID = res11.Substring(res11.IndexOf("gridID\":"), (res11.IndexOf(",", res11.IndexOf("gridID\":")) - res11.IndexOf("gridID\":"))).Replace("gridID\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
                       }
                       catch (Exception ex)
                       {
                           GlobusLogHelper.log.Error(ex.StackTrace);
                       }
                       if (string.IsNullOrEmpty(gridID))
                       {
                           gridID = Utils.getBetween(res11, "gridID", ",").Replace("\\\"", "").Replace(",", "").Replace(":", "").Trim(); ;
                       }


                       try
                       {
                           composer_session_id = res11.Substring(res11.IndexOf("composer_session_id\":"), (res11.IndexOf("}", res11.IndexOf("composer_session_id\":")) - res11.IndexOf("composer_session_id\":"))).Replace("composer_session_id\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
                       }
                       catch (Exception ex)
                       {
                           GlobusLogHelper.log.Error(ex.StackTrace);
                       }

                       try
                       {
                           if (string.IsNullOrEmpty(composer_session_id))
                           {
                               composer_session_id = res11.Substring(res11.IndexOf("composerID\":"), (res11.IndexOf("}", res11.IndexOf("composerID\":")) - res11.IndexOf("composerID\":"))).Replace("composerID\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();

                           }
                       }
                       catch (Exception ex)
                       {
                           GlobusLogHelper.log.Error(ex.StackTrace);
                       }

                       try
                       {
                           qn = getBetween(res11, "qn", "/>");
                           qn = qn.Replace("\\\\\\\"", "@");
                           qn = getBetween(qn, "@ value=@", "@");
                       }
                       catch (Exception ex)
                       {
                           GlobusLogHelper.log.Error(ex.StackTrace);
                       }
                   }
                   catch { }

                   NameValueCollection nvc1 = new NameValueCollection();
                   try
                   {
                       //message = Uri.EscapeDataString(message);
                   }
                   catch (Exception ex)
                   {
                       GlobusLogHelper.log.Error(ex.StackTrace);
                   }

                   //xhpc_composerid = GlobusHttpHelper.GetParamValue(pageSource_HomeData, "composerid");
                   //xhpc_targetid = GlobusHttpHelper.GetParamValue(pageSource_HomeData, "xhpc_targetid");
                   //-------------------------------
                   //nvc1.Add("fb_dtsg", fb_dtsg);
                   //nvc1.Add("source", source);
                   //nvc1.Add("profile_id", profile_id);
                   //nvc1.Add("grid_id", gridID);
                   //nvc1.Add("upload_id", "1024");
                   //-----------------------------------
                   nvc1.Add("fb_dtsg", fb_dtsg);
                   nvc1.Add("source", source);
                   nvc1.Add("profile_id", profile_id);
                   nvc1.Add("grid_id", gridID);
                   nvc1.Add("upload_id", "1024");
                   nvc1.Add("qn", qn);

                   //nvc1.Add("fb_dtsg", fb_dtsg);
                   //nvc1.Add("source", source);
                   //nvc1.Add("profile_id", profile_id);
                   //nvc1.Add("grid_id", gridID);
                   //nvc1.Add("upload_id", "1024");
                   //nvc1.Add("qn", qn);

                   string _rev = getBetween(pageSource, "svn_rev", ",");
                   _rev = _rev.Replace("\":", string.Empty);


                   string uploadURL = "https://upload.facebook.com/ajax/composerx/attachment/media/saveunpublished?target_id=" + xhpc_targetid + "&__user="******"&__a=1&__dyn=7n88Oq9ccmqDxl2u5Fa8HzCqm5Aqbx2mbAKGiBAGm&__req=1t&fb_dtsg=" + fb_dtsg + "&__rev=" + _rev + "";
                   tempresponse1 = HttpUploadFile_UploadPic_tempforsingle(ref HttpHelper, UsreId, uploadURL, "composer_unpublished_photo[]", "image/jpeg", localImagePath, nvc1, "", proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

                   if (tempresponse1.ToLower().Contains("errorsummary") && tempresponse1.ToLower().Contains("There was a problem with this request. We're working on getting it fixed as soon as we can".ToLower()))
                   {
                       if (tempCount < 2)
                       {
                           System.Threading.Thread.Sleep(15000);
                           tempCount++;
                           goto startAgain;
                       }
                       else
                       {
                           tempCountMain++;
                           return false;
                       }
                   }

                   //string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "https://upload.facebook.com/ajax/timeline/cover/upload/", "pic", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

                   //string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "http://upload.facebook.com/media/upload/photos/composer/?__a=1&__adt=3&__iframe=true&__user="******"file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

                   //tempresponse1 = HttpUploadFile_UploadPic_temp(ref HttpHelper, UsreId, "https://upload.facebook.com/ajax/composerx/attachment/media/saveunpublished?target_id=" + xhpc_targetid + "&__user="******"&__a=1&__dyn=7n88QoAMNoBwXAw&__req=l&fb_dtsg=" + fb_dtsg + "", "composer_unpublished_photo[]", "image/jpeg", localImagePath, nvc1, "", proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

               }

               NameValueCollection nvc = new NameValueCollection();
               try
               {
                   //message = Uri.EscapeDataString(message);
               }
               catch { }
               nvc.Add("fb_dtsg", fb_dtsg);
               nvc.Add("xhpc_targetid", xhpc_targetid);
               nvc.Add("xhpc_context", "profile");
               nvc.Add("xhpc_ismeta", "1");
               nvc.Add("xhpc_fbx", "1");
               nvc.Add("xhpc_timeline", "");
               nvc.Add("xhpc_composerid", xhpc_composerid);
               nvc.Add("xhpc_message_text", message);
               nvc.Add("xhpc_message", message);
               //nvc.Add("name", "file1");
               //nvc.Add("Content-Type:", "image/jpeg");
               //nvc.Add("filename=", "");


               string composer_unpublished_photo = "";
               try
               {
                   string start_composer_unpublished_photo = Regex.Split(tempresponse1, "},\"")[1];// 



                   int startIndex_composer_unpublished_photo = start_composer_unpublished_photo.IndexOf(",\"") + ",\"".Length;
                   int endIndex_composer_unpublished_photo = start_composer_unpublished_photo.IndexOf("\"", startIndex_composer_unpublished_photo + 1);

                   composer_unpublished_photo = start_composer_unpublished_photo.Substring(startIndex_composer_unpublished_photo, endIndex_composer_unpublished_photo - startIndex_composer_unpublished_photo);
               }

               catch (Exception ex)
               {
                   GlobusLogHelper.log.Error(ex.StackTrace);
               }

               if (tempresponse1.Contains("composer_unpublished_photo"))
               {
                   try
                   {
                       composer_unpublished_photo = tempresponse1.Substring(tempresponse1.IndexOf("composer_unpublished_photo[]"), tempresponse1.IndexOf("u003Cbutton") - tempresponse1.IndexOf("composer_unpublished_photo[]")).Replace("composer_unpublished_photo[]", "").Replace("value=", "").Replace("\\", "").Replace("\\", "").Replace("/>", "").Replace("\"", "").Trim();
                       //.Replace("composer_session_id\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
                   }
                   catch (Exception ex)
                   {
                       GlobusLogHelper.log.Error(ex.StackTrace);
                   }
               }
               ///New test upload pic post
               string waterfallid = GlobusHttpHelper.ParseJson(pageSource_Home, "waterfallID");

               if (waterfallid.Contains("ar"))
               {
                   waterfallid = qn;
               }


               string newpostURL = "https://upload.facebook.com/media/upload/photos/composer/?__user="******"&__a=1&__dyn=7n88QoAMNoBwXAw&__req=r&fb_dtsg=" + fb_dtsg + "";
               string newPostData = "";


               NameValueCollection newnvc = new NameValueCollection();
               try
               {
                   //message = Uri.EscapeDataString(message);
               }
               catch (Exception ex)
               {
                   GlobusLogHelper.log.Error(ex.StackTrace);
               }

               newnvc.Add("fb_dtsg", fb_dtsg);
               newnvc.Add("xhpc_targetid", xhpc_targetid);
               newnvc.Add("xhpc_context", "profile");
               newnvc.Add("xhpc_ismeta", "1");
               newnvc.Add("xhpc_fbx", "1");
               newnvc.Add("xhpc_timeline", "");
               newnvc.Add("xhpc_composerid", xhpc_composerid);
               newnvc.Add("xhpc_message_text",string.Empty);
               newnvc.Add("xhpc_message", string.Empty);

               newnvc.Add("composer_unpublished_photo[]", composer_unpublished_photo);
               newnvc.Add("album_type", "128");
               newnvc.Add("is_file_form", "1");
               newnvc.Add("oid", "");
               newnvc.Add("qn", waterfallid);
               newnvc.Add("application", "composer");
               newnvc.Add("is_explicit_place", "");
               newnvc.Add("composertags_place", "");
               newnvc.Add("composertags_place_name", "");
               newnvc.Add("composer_session_id", composer_session_id);
               newnvc.Add("composertags_city", "");
               newnvc.Add("vzdisable_location_sharing", "false");
               newnvc.Add("composer_predicted_city", "");

               // string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "https://upload.facebook.com/ajax/timeline/cover/upload/", "pic", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

               // string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "http://upload.facebook.com/media/upload/photos/composer/?__a=1&__adt=3&__iframe=true&__user="******"file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

               string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, newpostURL, "file1", "image/jpeg", localImagePath, newnvc, targeturl, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);//HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "http://upload.facebook.com/media/upload/photos/composer/?__user="******"&__a=1&__dyn=7n88O49ccm9o-2Ki&__req=1c&fb_dtsg=" + fb_dtsg + "", "file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);
               string messageId = Utils.getBetween(response, "message_id=", "&");
               string editUrl = "https://www.facebook.com/ajax/groups/mall/mall_post_menu.php?group_id=" + xhpc_targetid + "&message_id=" + composer_unpublished_photo + "&story_dom_id=" + xhpc_composerid + "&entstory_context=%7B%22fbfeed_context%22%3Atrue%2C%22location_type%22%3A2%2C%22outer_object_element_id%22%3A%22" + xhpc_composerid + "%22%2C%22object_element_id%22%3A%22" + xhpc_composerid + "%22%2C%22is_ad_preview%22%3Afalse%2C%22is_editable%22%3Afalse%7D";
               string editPost = "pmid=14&__user="******"&__a=1&__dyn=7nm8RW8BgBlynzpQ9UoHaEWCueyp9Esx6iWF3pqzCC-C26m6oKezpUgDyQqUkBBzEy6Kdy8-&__req=19&fb_dtsg="+fb_dtsg+"&ttstamp=26581721069876105685711711688&__rev=1557661";

               if (!response.Contains("Your post has been submitted and is pending approval by an admin"))
               {
                   GlobusLogHelper.log.Info("Delaying For " + delay + " Seconds For Editing Post");
                   Thread.Sleep(delay * 1000);
                   try
                   {
                       string editResp = HttpHelper.postFormData(new Uri(editUrl), editPost);

                       string editResp1 = HttpHelper.postFormData(new Uri("https://www.facebook.com/ajax/groups/mall/edit"), "fb_dtsg=" + fb_dtsg + "&edited_post_fbid=" + messageId + "&story_dom_id=" + xhpc_composerid + "&parent_story_dom_id=&target_id=" + xhpc_targetid + "&hey_kid_im_a_composer=1&display_context=group&xhpc_context=group&is_permalink=&entstory_context=%7B%22fbfeed_context%22%3Atrue%2C%22location_type%22%3A2%2C%22outer_object_element_id%22%3A%22" + xhpc_composerid + "%22%2C%22object_element_id%22%3A%22" + xhpc_composerid + "%22%2C%22is_ad_preview%22%3Afalse%2C%22is_editable%22%3Afalse%7D&status_text=" + message + "&status=" + message + "&save=1&__user="******"&__a=1&__dyn=7nm8RW8BgBlynzpQ9UoHaEWCueyp9Esx6iWF3pqzCC-C26m6oKezpUgDyQqUkBBzEy6Kdy8-&__req=1h&ttstamp=26581721069876105685711711688&__rev=1557661");
                   }
                   catch (Exception ex)
                   { };
                   try
                   {
                       string editAgain = HttpHelper.postFormData(new Uri("https://www.facebook.com/ajax/feed/edit_post.php"), "display_context=home&post_fbid=" + messageId + "&parent_story_dom_id=" + xhpc_composerid + "&story_dom_id=" + xhpc_composerid + "&target_id=" + UsreId + "&is_permalink=1&is_substory=0&entstory_id=S%3A_I" + UsreId + "%3A" + messageId + "&entstory_context=%7B%22is_viewer_page_admin%22%3Afalse%2C%22fbfeed_context%22%3Atrue%2C%22location_type%22%3A5%2C%22outer_object_element_id%22%3A%22" + xhpc_composerid + "%22%2C%22object_element_id%22%3A%22" + xhpc_composerid + "%22%2C%22is_ad_preview%22%3Afalse%2C%22is_editable%22%3Afalse%7D&__user="******"&__a=1&__dyn=7nmajEyl2qm9udDgDxyIGzGpUW9ACxO4p9GgSmEVFLFwxBxvyUW5ogDyQqUkBBzEy78S8zU&__req=k&fb_dtsg=" + fb_dtsg + "&ttstamp=26581698589751218677519098&__rev=1562552&ft[tn]=V&ft[fbfeed_location]=5");

                       string editAgainPostMsg = HttpHelper.postFormData(new Uri("https://www.facebook.com/ajax/edits/save/"), "fb_dtsg=" + fb_dtsg + "&edited_post_fbid=" + messageId + "&story_dom_id=" + xhpc_composerid + "&parent_story_dom_id=&target_id=" + xhpc_targetid + "&hey_kid_im_a_composer=1&display_context=group&xhpc_context=group&is_permalink=&entstory_context=%7B%22fbfeed_context%22%3Atrue%2C%22location_type%22%3A2%2C%22outer_object_element_id%22%3A%22" + xhpc_composerid + "%22%2C%22object_element_id%22%3A%22" + xhpc_composerid + "%22%2C%22is_ad_preview%22%3Afalse%2C%22is_editable%22%3Afalse%7D&status_text=" + message + "&status=" + message + "&save=1&__user="******"&__a=1&__dyn=7nm8RW8BgBlynzpQ9UoHaEWCueyp9Esx6iWF3pqzCC-C26m6oKezpUgDyQqUkBBzEy6Kdy8-&__req=1h&ttstamp=26581721069876105685711711688&__rev=1557661");
                   }
                   catch (Exception ex)
                   {
                       GlobusLogHelper.log.Error(ex.Message);
                   }



               }
               else
               {
                   try
                   {
                       string editAgain = HttpHelper.postFormData(new Uri("https://www.facebook.com/ajax/feed/edit_post.php"), "display_context=home&post_fbid=" + messageId + "&parent_story_dom_id=" + xhpc_composerid + "&story_dom_id=" + xhpc_composerid + "&target_id=" + UsreId + "&is_permalink=1&is_substory=0&entstory_id=S%3A_I" + UsreId + "%3A" + messageId + "&entstory_context=%7B%22is_viewer_page_admin%22%3Afalse%2C%22fbfeed_context%22%3Atrue%2C%22location_type%22%3A5%2C%22outer_object_element_id%22%3A%22" + xhpc_composerid + "%22%2C%22object_element_id%22%3A%22" + xhpc_composerid + "%22%2C%22is_ad_preview%22%3Afalse%2C%22is_editable%22%3Afalse%7D&__user="******"&__a=1&__dyn=7nmajEyl2qm9udDgDxyIGzGpUW9ACxO4p9GgSmEVFLFwxBxvyUW5ogDyQqUkBBzEy78S8zU&__req=k&fb_dtsg=" + fb_dtsg + "&ttstamp=26581698589751218677519098&__rev=1562552&ft[tn]=V&ft[fbfeed_location]=5");

                       string editAgainPostMsg = HttpHelper.postFormData(new Uri("https://www.facebook.com/ajax/edits/save/"), "fb_dtsg=" + fb_dtsg + "&edited_post_fbid=" + messageId + "&story_dom_id=" + xhpc_composerid + "&parent_story_dom_id=&target_id=" + xhpc_targetid + "&hey_kid_im_a_composer=1&display_context=group&xhpc_context=group&is_permalink=&entstory_context=%7B%22fbfeed_context%22%3Atrue%2C%22location_type%22%3A2%2C%22outer_object_element_id%22%3A%22" + xhpc_composerid + "%22%2C%22object_element_id%22%3A%22" + xhpc_composerid + "%22%2C%22is_ad_preview%22%3Afalse%2C%22is_editable%22%3Afalse%7D&status_text=" + message + "&status=" + message + "&save=1&__user="******"&__a=1&__dyn=7nm8RW8BgBlynzpQ9UoHaEWCueyp9Esx6iWF3pqzCC-C26m6oKezpUgDyQqUkBBzEy6Kdy8-&__req=1h&ttstamp=26581721069876105685711711688&__rev=1557661");
                   }
                   catch (Exception ex)
                   {
                       GlobusLogHelper.log.Error(ex.Message);
                   }
               }
               if (response.Contains("post this because it has a blocked link"))
               {
                   try
                   {
                       GlobusLogHelper.log.Info("-------blocked link-------");
                       return false;

                   }
                   catch (Exception ex)
                   {
                       GlobusLogHelper.log.Error(ex.StackTrace);
                   }

               }

               //http://upload.facebook.com/media/upload/photos/composer/?__a=1&__adt=3&__iframe=true&__user=100004608395129
               if (string.IsNullOrEmpty(response))
               {
                   try
                   {
                       //response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "https://upload.facebook.com/media/upload/photos/composer/?__a=1&__adt=3&__iframe=true&__user="******"file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);
                       response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "https://upload.facebook.com/media/upload/photos/composer/?__user="******"&__a=1&__dyn=7n88O49ccm9o-2Ki&__req=1c&fb_dtsg=" + fb_dtsg + "", "file1", "image/jpeg", localImagePath, nvc, targeturl, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);
                   }
                   catch (Exception ex)
                   {
                       GlobusLogHelper.log.Error(ex.StackTrace);
                   }
               }
               string posturl = "https://www.facebook.com/ajax/places/city_sharer_reset.php";
               string postdata = "__user="******"&__a=1&fb_dtsg=" + fb_dtsg + "&phstamp=1658167761111108210145";
               string responsestring = HttpHelper.postFormData(new Uri(posturl), postdata);
               try
               {
                   string okay = HttpHelper.getHtmlfromUrl(new Uri("https://3-pct.channel.facebook.com/pull?channel=p_" + UsreId + "&seq=3&partition=69&clientid=70e140db&cb=8p7w&idle=8&state=active&mode=stream&format=json"));
               }
               catch (Exception ex)
               {
                   GlobusLogHelper.log.Error(ex.StackTrace);
               }

               if (!string.IsNullOrEmpty(response) && response.Contains("payload\":{\"photo_fbid"))//response.Contains("photo.php?fbid="))
               {

                   #region PostData_ForCoverPhotoSelect
                   //fb_dtsg=AQCLSjCH&photo_id=130869487061841&profile_id=100004163701035&photo_offset=0&video_id=&save=Save%20Changes&nctr[_mod]=pagelet_main_column_personal&__user=100004163701035&__a=1&phstamp=165816776831066772182 
                   #endregion

                   try
                   {

                       if (!response.Contains("errorSummary") || !response.Contains("error"))
                       {
                           isSentPicMessage = true;
                       }
                       if (response.Contains("Your post has been submitted and is pending approval by an admin"))
                       {
                           GlobusLogHelper.log.Debug("Your post has been submitted and is pending approval by an admin." + "GroupUrl >>>" + targeturl +" So Unable To Edit Post");
                           GlobusLogHelper.log.Info("Your post has been submitted and is pending approval by an admin." + "GroupUrl >>>" + targeturl + " So Unable To Edit Post");
                       }
                   }
                   catch (Exception ex)
                   {
                       GlobusLogHelper.log.Error(ex.StackTrace);
                   }
                   #region CodeCommented
                   //    string photo_idValue = response.Substring(response.IndexOf("photo.php?fbid="), response.IndexOf(";", response.IndexOf("photo.php?fbid=")) - response.IndexOf("photo.php?fbid=")).Replace("photo.php?fbid=", string.Empty).Trim();
                   //    string[] arrphoto_idValue = Regex.Split(photo_idValue, "[^0-9]");

                   //    foreach (string item in arrphoto_idValue)
                   //    {
                   //        try
                   //        {
                   //            if (item.Length > 6)
                   //            {
                   //                photo_id = item;
                   //                break;
                   //            }
                   //        }
                   //        catch
                   //        {
                   //        }
                   //    }

                   //   // string postData = "fb_dtsg=" + fb_dtsg + "&photo_id=" + photo_id + "&profile_id=" + UsreId + "&photo_offset=0&video_id=&save=Save%20Changes&nctr[_mod]=pagelet_main_column_personal&__user="******"&__a=1&phstamp=165816776831066772182 ";
                   //   // string postResponse = HttpHelper.postFormData(new Uri("https://www.facebook.com/ajax/timeline/cover_photo_select.php"), postData);

                   //    //if (!postResponse.Contains("error"))
                   //    //{
                   //    //    //string ok = "ok";
                   //    //    isSentPicMessage = true;
                   //    //}
                   //    //if (string.IsNullOrEmpty(postResponse) || string.IsNullOrWhiteSpace(postResponse))
                   //    //{
                   //    //    status = "Response Is Null !";
                   //    //}
                   //    //if (postResponse.Contains("errorSummary"))
                   //    //{
                   //    //    string summary = GlobusHttpHelper.ParseJson(postResponse, "errorSummary");
                   //    //    string errorDescription = GlobusHttpHelper.ParseJson(postResponse, "errorDescription");

                   //    //    status = "Posting Error: " + summary + " | Error Description: " + errorDescription;
                   //    //    //FanPagePosterLogger("Posting Error: " + summary + " | Error Description: " + errorDescription);
                   //    //}
                   //}
                   //catch
                   //{
                   //} 
                   #endregion

               }

           }
           catch (Exception ex)
           {
               GlobusLogHelper.log.Error(ex.StackTrace);
           }
           return isSentPicMessage;

       }
Ejemplo n.º 13
0
        public bool LogoutHttpHelper(ref GlobusHttpHelper HttpHelper)
        {
            try
            {
                //string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/"));
                string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/"));
                if (pageSource1.Contains("\"h\"") && pageSource1.Contains("post_form_id") && pageSource1.Contains("fb_dtsg"))
                {
                    string h = string.Empty;
                    string post_form_id = string.Empty;
                    string fb_dtsg = string.Empty;

                    if (pageSource1.Contains("\"h\""))
                    {
                        string strTemp = pageSource1.Substring(pageSource1.IndexOf("\"h\""), 200);
                        string[] ArrTemp = strTemp.Split('"');
                        h = ArrTemp[3];
                    }
                    if (pageSource1.Contains("post_form_id") && pageSource1.Contains("fb_dtsg"))
                    {
                        string strTemp = pageSource1.Substring(pageSource1.IndexOf("post_form_id"), 200);
                        string[] ArrTemp = strTemp.Split('"');
                        post_form_id = ArrTemp[2];
                        fb_dtsg = ArrTemp[6];

                    }

                    string ResponseLogout = HttpHelper.postFormData(new Uri("http://www.facebook.com/logout.php"), "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&ref=mb&h=" + h);
                    return true;
                }
                return false;
            }
            catch (Exception ex)
            {
                return false;
                Console.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 14
0
        private void SearchByPeople(ref GlobusHttpHelper HttpHelper)
        {
            try
            {
                Log("[ " + DateTime.Now + " ] => [ Starting Search By People With UserName : "******" ]");

                _Search = _Search.ToLower();
                _Keyword = _Keyword.ToLower();
                string Facets_Order = string.Empty;
                //if (SearchCriteria.starter)
                {
                    #region Serch

                    //For Data postURL
                    string pageSourceaAdvanceSearch = string.Empty;
                    try
                    {
                        pageSourceaAdvanceSearch = HttpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/vsearch/f?adv=true&trk=federated_advs"));

                        if (pageSourceaAdvanceSearch == "" || pageSourceaAdvanceSearch.Contains("Make sure you have cookies and Javascript enabled in your browser before signing in."))
                        {
                            pageSourceaAdvanceSearch = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/vsearch/f?adv=true&trk=federated_advs"));
                        }

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

                        string PplsearchOrigin = string.Empty;
                        try
                        {
                            PplsearchOrigin = pageSourceaAdvanceSearch.Substring(pageSourceaAdvanceSearch.IndexOf("pplSearchOrigin"), 200);

                            string[] Arr2 = PplsearchOrigin.Split('"');
                            PplsearchOrigin = Arr2[4];
                            PplsearchOrigin = PplsearchOrigin.Replace(":", "%3A");
                        }
                        catch (Exception ex)
                        {

                        }
                        string tempsorceurl2 = "csrfToken=" + csrfToken1 + "&keepFacets=true&pplSearchOrigin=ADVS&keywords=&fname" + SearchCriteria.FirstName + "=&lname=" + SearchCriteria.LastName + "&searchLocationType=" + SearchCriteria.Location + "&countryCode=" + SearchCriteria.Country + "&postalCode=&title=" + SearchCriteria.Title + "&currentTitle=CP&company=" + SearchCriteria.Company + "&currentCompany=CP&school=&I=" + SearchCriteria.IndustryType + "select-all&FG=" + SearchCriteria.Group + "select-all&facet_N=F&L=select-all&sortCriteria=C&viewCriteria=2&%2Fsearch%2Ffpsearch=Search";
                        string tempsorceurl1 = "csrfToken=" + csrfToken1 + "&keepFacets=true&pplSearchOrigin=ADVS&keywords=" + SearchCriteria.Keyword + "&fname=" + SearchCriteria.FirstName + "&lname=" + SearchCriteria.LastName + "&searchLocationType=" + SearchCriteria.Location + "&countryCode=" + SearchCriteria.Country + "&postalCode=" + SearchCriteria.PostalCode + "&title=" + SearchCriteria.Title + "&company=" + SearchCriteria.Company + "&school=" + SearchCriteria.Education + "&%2Fsearch%2Ffpsearch=Search&I=select-all&N=select-all&L=select-all&CS=select-all&SE=select-all&P=select-all&F=select-all&sortCriteria=R&viewCriteria=1";

                        string Search = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/search?trk=advsrch"));
                    }
                    catch
                    {
                    }
                    if (_Keyword.Contains("or")||(_Keyword.Contains("and"))||(_Keyword.Contains("not")))
                    {
                        try
                        {
                            _Keyword = _Keyword.Replace(" or "," OR ");
                            _Keyword = _Keyword.Replace(" and ", " AND ");
                            _Keyword = _Keyword.Replace(" not ", " NOT ");
                        }
                        catch{}
                    }
                    try
                    {
                        ResponseWallPostForPremiumAcc = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/search/fpsearch?type=people&keywords=" + _Keyword + "&pplSearchOrigin=GLHD&pageKey=fps_results"));

                    }
                    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, "<p class=\"summary\">");

                if (Arr12.Count() == 1)
                {
                    Arr12 = Regex.Split(ResponseWallPostForPremiumAcc, "resultCount");  //formattedResultCount
                }

                foreach (string item in Arr12)
                {
                    try
                    {
                        if (!item.Contains("<!DOCTYPE"))
                        {
                            if (item.Contains("<strong>"))
                            {
                                try
                                {
                                    string pageNO = item.Substring(item.IndexOf("<strong>"), item.IndexOf("</strong>", item.IndexOf("<strong>")) - item.IndexOf("<strong>")).Replace("<strong>", string.Empty).Replace(",", string.Empty).Trim();

                                    string[] arrPageNO = Regex.Split(pageNO, "[^0-9]");

                                    foreach (string item1 in arrPageNO)
                                    {
                                        try
                                        {
                                            if (!string.IsNullOrEmpty(item1))
                                            {
                                                strPageNumber = item1;
                                            }
                                        }
                                        catch
                                        {
                                        }
                                    }
                                }
                                catch
                                {
                                }
                            }
                            else
                            {
                                try
                                {
                                    string pageNO = item.Substring(item.IndexOf("<p class=\"summary\">"), item.IndexOf("</p>", item.IndexOf("<p class=\"summary\">")) - item.IndexOf("<p class=\"summary\">")).Replace("<p class=\"summary\">", string.Empty).Replace(",", string.Empty).Trim();
                                    string[] arrPageNO = Regex.Split(pageNO, "[^0-9]");

                                    foreach (string item1 in arrPageNO)
                                    {
                                        try
                                        {
                                            if (!string.IsNullOrEmpty(item1))
                                            {
                                                strPageNumber = item1;
                                            }
                                        }
                                        catch
                                        {
                                        }
                                    }
                                }
                                catch
                                {
                                }
                            }
                        }
                    }
                    catch
                    {
                    }
                }

                foreach (string item in Arr12)
                {
                    try
                    {
                        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
                        }
                    }
                    catch
                    {
                    }
                }

                if (strPageNumber == string.Empty)
                {
                    foreach (string item in Arr12)
                    {
                        try
                        {

                            #region Loop
                            if (!item.Contains("<!DOCTYPE"))
                            {
                                if (item.Contains(":"))
                                {
                                    string data = RemoveAllHtmlTag.StripHTML(item);
                                    data = data.Replace("\n", "");
                                    if (data.Contains(">"))
                                    {
                                        string[] ArrTemp = Regex.Split(data,"primaryUrlAlias");
                                        data = ArrTemp[0];
                                        data = data.Replace(":", string.Empty);
                                        data = data.Trim();
                                        string[] ArrTemp1 = data.Split(' ');
                                        if (ArrTemp1[0].Contains(","))
                                        {
                                            data = ArrTemp1[0].Split(',')[0];
                                        }
                                        else
                                        {
                                            data = ArrTemp1[0].Replace(',', ' ').Trim();
                                        }

                                        strPageNumber = data.Replace(" ", string.Empty).Replace("\"", string.Empty).Replace("sorry_no_sim_job__i18n", string.Empty).Replace("i18n_author_contentPosts", string.Empty).Replace("i18n_survey_feedback_thanksThanks!", string.Empty).Replace("i18n_survey_feedback_thanks¡Gracias!", string.Empty).Replace(".", "").Trim();
                                        break;
                                    }

                                }
                            }
                            #endregion

                        }
                        catch
                        {
                        }
                    }
                }

                try
                {
                    strPageNumber = strPageNumber.Replace(".", string.Empty);
                    if (strPageNumber != string.Empty || strPageNumber == "0")
                    {
                        Log("[ " + DateTime.Now + " ] => [ Total Results found: " + strPageNumber + " ]");
                    }
                    pagenumber = int.Parse(strPageNumber);
                }
                catch (Exception)
                {

                }
                pagenumber = (pagenumber / 10) + 1;

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

                if (pagenumber >= 1)
                {
                    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=" + _Keyword + "&searchLocationType=Y&search=&pplSearchOrigin=GLHD&viewCriteria=2&sortCriteria=R&facetsOrder=CC%2CN%2CG%2CI%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR&page_num=" + i + "&openFacets=CC%2CN%2CG";//"fname=" + SearchCriteria.FirstName + "&lname=" + SearchCriteria.LastName + "&searchLocationType=" + SearchCriteria.Location + "&countryCode=" + SearchCriteria.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 { }
                            }
                            else if (ResponseWallPostForPremiumAcc.Contains("Account: Basic") || ResponseWallPostForPremiumAcc.Contains("Cuenta: Básica"))
                            {
                                try
                                {
                                    PostRequestURL = "http://www.linkedin.com/search/fpsearch?";
                                    PostdataForPagination = "type=people&keywords="+_Keyword+"&page_num="+i;
                                    PostResponce = HttpHelper.postFormData(new Uri(PostRequestURL),PostdataForPagination);
                                }
                                catch { }

                            }

                            else if (ResponseWallPostForPremiumAcc.Contains("Account Type:</span> Executive"))
                            {
                                try
                                {
                                    PostRequestURL = "http://www.linkedin.com/search/hits";
                                    PostdataForPagination = "type=people&keywords=" + _Keyword + "&page_num=" + i;
                                    PostResponce = HttpHelper.postFormData(new Uri(PostRequestURL), PostdataForPagination);
                                }
                                catch { }

                            }
                            else
                            {
                                try
                                {

                                    PostRequestURL = "http://www.linkedin.com/search/fpsearch?";
                                    PostdataForPagination = "type=people&keywords=" + _Keyword + "&page_num=" + i;
                                    PostResponce = HttpHelper.postFormData(new Uri(PostRequestURL), PostdataForPagination);
                                }
                                catch { }
                            }

                            if (PostResponce.Contains("/profile/view?id"))
                            {
                                string[] URL = Regex.Split(PostResponce, "profile/view");
                                List<string> PageSerchUrl1 = URL.ToList<string>();
                                //PageSerchUrl = PageSerchUrl.Distinct().ToList();

                                List<string> PageSerchUrl = ChilkatBasedRegex.GettingAllUrls(PostResponce, "profile/view?id");

                                string[] profileUrl = Regex.Split(PostResponce, "linkAuto_voltron_people_search_1");

                                {
                                    foreach (string item in profileUrl)
                                    {
                                        if (!(item.Contains("<!DOCTYPE html>")))
                                        {
                                        try
                                        {
                                            int startindex = item.IndexOf("pid=");
                                            string start = item.Substring(startindex).Replace("pid=", string.Empty);
                                            int endindex = start.IndexOf(",");
                                            string end = start.Substring(0, endindex).Replace(",", string.Empty).Trim();
                                            string basicUrl = end;
                                            string modifiedProfUrl = "https://www.linkedin.com/profile/view?id=" + basicUrl;
                                            string urlSerch = modifiedProfUrl;
                                            Log("[ " + DateTime.Now + " ] => [ " + urlSerch + " ]");
                                            RecordURL.Add(urlSerch);
                                        }
                                        catch
                                        { }
                                        }
                                    }
                                }

                                //if (PageSerchUrl.Count == 0)
                                //{

                                //    Log("[ " + DateTime.Now + " ] => [ On the basis of you Account you can able to see " + RecordURL.Count + "Results ]");
                                //    break;
                                //}
                                //foreach (string item in PageSerchUrl)
                                //{
                                //    try
                                //    {
                                //        //if (SearchCriteria.starter)
                                //        {
                                //            if (item.Contains("authType="))
                                //            {

                                //                string modifiedProfUrl = item;

                                //                // string urlSerch = "http://www.linkedin.com" + modifiedProfUrl;
                                //                string urlSerch = modifiedProfUrl;
                                //                Log("[ " + DateTime.Now + " ] => [ " + urlSerch + " ]");
                                //                RecordURL.Add(urlSerch);
                                //            }
                                //        }
                                //    }
                                //    catch
                                //    {
                                //    }
                                //}
                            }

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

                            if (!PostResponce.Contains("authType=") && (PostResponce.Contains("Upgrade your account to see more results") || (PostResponce.Contains("Abónate para ver más resultados"))))
                            {
                                break;
                            }

                            #endregion

                        }

                    }

                }

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

                                Log("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("authType="))
                                    {

                                        string urlSerch = "http://www.linkedin.com" + item;
                                        Log(urlSerch);
                                        RecordURL.Add(urlSerch);
                                    }
                                }
                            }
                        }

                        #endregion

                    }

                }

                #endregion
                RecordURL.Distinct();

                //Log("Toatl Find URL >>> " + RecordURL.Count.ToString());
                //if (SearchCriteria.starter)
                {

                    forUrl(ref HttpHelper);
                    //new Thread(() =>
                    //{
                    //    test();
                    //}).Start();
                }

            }

            catch
            {
            }
        }
Ejemplo n.º 15
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);
            }
        }
Ejemplo n.º 16
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 { }
        }
Ejemplo n.º 17
0
        public string PostSearchGroupAddFinal(ref GlobusHttpHelper HttpHelper, string Screen_name, string pass, List<string> SelectedItem, int mindelay, int maxdelay)
        {
            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 GroupName = string.Empty;

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

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

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

                 postUrl = "https://www.linkedin.com/uas/login-submit";
                 postdata = "session_key=" + Screen_name + "&session_password="******"&source_app=&trk=guest_home_login&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;
                 ResLogin = HttpHelper.postFormData(new Uri(postUrl), postdata);

                 try
                 {
                     foreach (string Itemgid in SelectedItem)
                     {
                         try
                         {
                             string GoBack = "/%2Eanb_" + Itemgid.Split(':')[1];
                             Log("[ " + DateTime.Now + " ] => [ Joining Group: " + Itemgid.Split(':')[0] + " ]");
                             string pageGetreq = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/groupRegistration?gid=" + Itemgid.Split(':')[1] + "&csrfToken=" + csrfToken + "&trk=group-join-button"));

                             Thread.Sleep(2000);

                             if (pageGetreq.Contains("Your request to join the"))
                             {
                                 ReturnString = "Your request to join the: " + Itemgid.Split(':')[0] + " group has been received.";
                                 Log("[ " + DateTime.Now + " ] => [ " + ReturnString + " ]");
                                 GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + ReturnString, Globals.path_JoinSearchGroupSuccess);
                             }
                             else if (pageGetreq.Contains("Welcome to the"))
                             {
                                 ReturnString = "Welcome to the: " + Itemgid.Split(':')[0] + " group on LinkedIn.";
                                 Log("[ " + DateTime.Now + " ] => [ " + ReturnString + " ]");
                                 GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + ReturnString, Globals.path_JoinSearchGroupSuccess);
                             }
                             else if (pageGetreq.Contains("You're already a member of the"))
                             {
                                 ReturnString = "[ " + DateTime.Now + " ] => [ You're already a member of the: " + Itemgid.Split(':')[0] + " ]";
                                 Log("" + ReturnString + "");
                                 GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + ReturnString, Globals.path_JoinSearchGroupSuccess);
                             }
                             else if (pageGetreq.Contains("Your settings have been updated"))
                             {
                                 ReturnString = "Your request to join the: " + Itemgid.Split(':')[0] + " group has been received.";
                                 Log("[ " + DateTime.Now + " ] => [ " + ReturnString + " ]");
                                 GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + ReturnString, Globals.path_JoinSearchGroupSuccess);
                             }
                             else if (pageGetreq.Contains("We’re sorry, this group has reached its maximum number of members allowed. If you have any questions, please contact the group manager for more information"))
                             {
                                 Log("[ " + DateTime.Now + " ] => [ We’re sorry, this group has reached its maximum number of members allowed. ]");
                                 GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + "We’re sorry, this group has reached its maximum number of members allowed.", Globals.path_JoinSearchGroupFail);
                             }
                             else if (pageGetreq.Contains("reached or exceeded the maximum number of pending group applications."))
                             {
                                 Log("[ " + DateTime.Now + " ] => [ We’re sorry...You’ve reached or exceeded the maximum number of pending group applications. Please wait for your pending requests to be approved by a group manager or withdraw pending requests before joining new groups. ]");
                                 GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + "We’re sorry...You’ve reached or exceeded the maximum number of pending group applications. Please wait for your pending requests to be approved by a group manager or withdraw pending requests before joining new groups. ", Globals.path_JoinSearchGroupFail);
                                 break;
                             }
                             else if (pageGetreq.Contains("reached or exceeded the maximum number of confirmed and pending groups."))
                             {
                                 ReturnString = "You’ve reached or exceeded the maximum number of confirmed and pending groups.";
                                 Log("[ " + DateTime.Now + " ] => [ You’ve reached or exceeded the maximum number of confirmed and pending groups. ]");
                                 GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + ReturnString, Globals.path_JoinSearchGroupFail);
                                 break;
                             }
                             else if (pageGetreq.Contains("Error"))
                             {
                                 Log("[ " + DateTime.Now + " ] => [ Error In Joining Group ]");
                                 GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + "Error In Joining Group", Globals.path_JoinSearchGroupFail);
                             }
                             else
                             {
                                 Log("[ " + DateTime.Now + " ] => [ Group Could Not Be Joined ]");
                                 GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + "Group Could Not Be Joined", Globals.path_JoinSearchGroupFail);
                             }

                             if (SelectedItem.Count > 1)
                             {
                                 int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                                 Log("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                                 Thread.Sleep(delay * 1000);
                             }
                         }
                         catch { }
                     }
                     Log("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                     Log("------------------------------------------------------------------------------------------------------------------------------------");
                 }
                 catch (Exception ex)
                 {
                     Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");
                 }
             }
             catch (Exception ex)
             {
                 GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> PostSearchGroupAddFinal() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                 GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> PostSearchGroupAddFinal() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddSearchGroupErrorLogs);
                 ReturnString = "Error";
             }
             return ReturnString;
        }
        private void SendInvitation(ref GlobusHttpHelper httpHelper, string pageSource, string key1, string authToken1, string goback1, string firstName_Guest1, string lastName_Guest1)
        {
            try
            {
                Log("[ " + DateTime.Now + " ] => [ Start Sending Invitation With Username >>> " + _UserName + " ]");

                string reason = string.Empty;
                string existingPositionIC = string.Empty;
                string greeting = string.Empty;
                string key = string.Empty;
                string firstName_Guest = string.Empty;
                string lastName_Guest = string.Empty;
                string authToken = string.Empty;
                string subject = string.Empty;
                string defaultText = string.Empty;
                string csrfToken = string.Empty;
                string sourceAlias = string.Empty;
                string goback = string.Empty;
                string userName = string.Empty;
                string userFirstName = string.Empty;
                string userLastName = string.Empty;
                string 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).Replace(",", string.Empty);
                    userLastName = resultForUserDetails.Split(' ')[1].Replace("\"", string.Empty).Replace(",", string.Empty);
                }
                catch { }

                firstName_Guest = GetValue(pageSource, "firstName");

                if (string.IsNullOrEmpty(firstName_Guest))
                {
                    firstName_Guest = firstName_Guest1;
                }

                lastName_Guest = GetValue(pageSource, "lastName");

                if (string.IsNullOrEmpty(lastName_Guest))
                {
                    lastName_Guest = lastName_Guest1;
                }

                reason = GetValue(pageSource, "reason");

                existingPositionIC = GetValue(pageSource, "existingPositionIC");
                firstName_Guest = firstName_Guest.Replace("&quot;", "\"");

                greeting = PersonalNote.Replace("<FIRSTNAME>", firstName_Guest).Replace("<PROFILEFIRSTNAME>", userFirstName).Trim();
                ClsInviteMemberThroughProfileURL.Listgreetmsg = SpinnedListGenerator.GetSpinnedList(new List<string> { greeting });
                string messagebody = string.Empty;
                messagebody = greeting;

                if (spintaxsearch)
                {
                    try
                    {
                        messagebody = Listgreetmsg[RandomNumberGenerator.GenerateRandom(0, Listgreetmsg.Count - 1)];
                    }
                    catch
                    { }

                }

                key = GetValue(pageSource, "key");

                if (string.IsNullOrEmpty(key))
                {
                    key = key1;
                }

                authToken = GetValue(pageSource, "authToken");

                if (string.IsNullOrEmpty(authToken))
                {
                    authToken = authToken1;
                }

                subject = GetValue(pageSource, "subject");

                defaultText = GetValue(pageSource, "defaultText");

                csrfToken = GetValue(pageSource, "csrfToken");

                sourceAlias = GetValue(pageSource, "sourceAlias");

                goback = GetValue(pageSource, "goback").Replace("/", "%2F");

                if (string.IsNullOrEmpty(goback))
                {
                    goback = goback1;
                }

                string postData = "existingPositionIC=&companyName.0=&titleIC.0=&startYearIC.0=&endYearIC.0=&schoolText=&schoolID=&existingPositionIB=&companyName.1=&titleIB.0=&startYearIB.0=&endYearIB.0=&reason=IF&otherEmail=&greeting=" + Uri.EscapeDataString(messagebody) + "&iweReconnectSubmit=Send+Invitation&key=" + key + "&firstName=" + firstName_Guest + "&lastName=" + lastName_Guest + "&authToken=" + authToken + "&authType=name&trk=prof-0-sb-connect-button&iweLimitReached=false&companyID.0=&companyID.1=&schoolID=&schoolcountryCode=&schoolprovinceCode=&javascriptEnabled=false&existingAssociation=Job+Openings%2C+Job+Leads+and+Job+Connections%21&subject=" + subject + "&defaultText=" + defaultText + "&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias + "&goback=" + goback + "";
                string postResponse = httpHelper.postFormData(new Uri("http://www.linkedin.com/people/iweReconnectAction"), postData);

                if (postResponse.Contains("Invitation to") || postResponse.Contains("invitación a"))
                {
                    Log("[ " + DateTime.Now + " ] => [ Invitation Sent successfully To >>> " + firstName_Guest + " With Username >>> " + _UserName + " ]");

                    #region Data Saved In CSV File

                    if (!string.IsNullOrEmpty(firstName_Guest) || !string.IsNullOrEmpty(_UserName))
                    {
                        try

                        {
                            string CSVHeader = "_UserName" + "," + "firstName_Guest" + "," + "lastName_Guest" + "," + "userFirstName" + "," + "userLastName" + ",";
                            string CSV_Content = _UserName + "," + firstName_Guest + "," + lastName_Guest + "," + userFirstName + "," + userLastName + ",";// +TypeOfProfile + ",";
                            CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_LinkedininvitememberResultUrlData);//path_LinkedinSearchSearchByProfileURL);
                            Log("[ " + DateTime.Now + " ] => [ Data Saved In CSV File ! ]");
                        }
                        catch { }

                    }

                    #endregion

                    int delay = new Random().Next(MinDelay, MaxDelay);
                    Log("[ " + DateTime.Now + " ] => [ Delay >>> " + delay + " Seconds With Username >>> " + _UserName + " ]");
                    Log("[ " + DateTime.Now + " ] => [---------------------------------------------------------------------]");
                    Thread.Sleep(delay * 1000);

                }
                else if (postResponse.Contains("Request Error") || postResponse.Contains("Solicitud de error"))
                {
                    Log("[ " + DateTime.Now + " ] => [ Request Error With Username >>> " + _UserName + " ]");

                    if (pageSource.Contains("Sorry, there was a problem processing your request. Please try again"))
                    {
                        Log("[ " + DateTime.Now + " ] => [ Sorry, there was a problem processing your request. Please try again With Username >>> " + _UserName + " ]");
                    }

                    if (pageSource.Contains("You have no confirmed email addresses"))
                    {
                        Log("[ " + DateTime.Now + " ] => [ You have no confirmed email addresses With Username >>> " + _UserName + " ]");
                    }
                }
                else
                {
                    if (pageSource.Contains("Sorry, there was a problem processing your request. Please try again"))
                    {
                        Log("[ " + DateTime.Now + " ] => [ Sorry, there was a problem processing your request. Please try again With Username >>> " + _UserName + " ]");
                    }

                    else if (pageSource.Contains("You have no confirmed email addresses"))
                    {
                        Log("[ " + DateTime.Now + " ] => [ You have no confirmed email addresses With Username >>> " + _UserName + " ]");
                    }
                    else
                    {
                        Log("[ " + DateTime.Now + " ] => [ Error in request With Username >>> " + _UserName + " ]");
                    }
                    int delay = new Random().Next(MinDelay, MaxDelay);
                    Log("[ " + DateTime.Now + " ] => [ Delay >>> " + delay + " Seconds With Username >>> " + _UserName + " ]");
                    Log("[ " + DateTime.Now + " ] => [---------------------------------------------------------------------]");
                    Thread.Sleep(delay * 1000);
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine("Error >>> " + ex.StackTrace);
            }
        }
Ejemplo n.º 19
0
        //private void PostMessageToAllAccounts_1By1(ref GlobusHttpHelper HttpHelper, Dictionary<string, string> dTotalFriends, string msg, string body, string UserEmail, string FromemailId, string FromEmailNam, int mindelay, int maxdelay)
        private void PostMessageToAllAccounts_1By1(ref GlobusHttpHelper HttpHelper, Dictionary<string, string> dTotalFriends, List<string> msgsubject, string userText, string UserEmail, 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;
                 string FString = string.Empty;
                 //string Nstring = string.Empty;
                 //string connId = string.Empty;
                 string FullName = string.Empty;
                 string ToMsg = string.Empty;

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

                     try
                     {
                         pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));
                     }
                     catch (Exception ex)
                     {
                         Console.WriteLine("ex.Message >>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + "  ex.Stack Trace >>> " + ex.StackTrace);
                     }

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

                             if (string.IsNullOrEmpty(pageSource))
                             {
                                 Log("[ " + DateTime.Now + " ] => [ Page Source Is Null With Username >>> " + UserEmail + " ]");
                                 return;
                             }
                         }
                         catch (Exception ex)
                         {
                             Console.WriteLine("ex.Message >>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + "  ex.Stack Trace >>> " + ex.StackTrace);

                         }

                     }

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

                     if (pageSource.Contains("sourceAlias"))
                     {
                         try
                         {
                             sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100);
                             string[] Arr = sourceAlias.Split('"');
                             sourceAlias = Arr[2];
                         }
                         catch (Exception ex)
                         {
                             Console.WriteLine("ex.Message >>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + "  ex.Stack Trace >>> " + ex.StackTrace);
                         }
                     }

                     //string ContactName = string.Empty;

                     int counter = 1;

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

                             if (!IsAllAccounts)
                             {
                                 if (counter > NoOfFriends)
                                 {
                                     break;
                                 }
                             }

                             counter++;

                             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 tempsubject = string.Empty;

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

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

                             Nstring += "}";

                             try
                             {
                                 string PostMessage;
                                 string ResponseStatusMsg;
                                 Log("[ " + DateTime.Now + " ] => [ Sending Message ]");
                                 tempBody = GlobusSpinHelper.spinLargeText(new Random(), userText);
                                 //tempBody = msgbody[RandomNumberGenerator.GenerateRandom(0, msgbody.Count - 1)];
                                 tempsubject = msgsubject[RandomNumberGenerator.GenerateRandom(0, msgsubject.Count - 1)];

                                 //if (body.Contains("<Insert Name>"))
                                 {
                                     tempBody = tempBody.Replace("<Insert Name>", FName);
                                 }

                                 //if (body.Contains("<Insert From Email>"))
                                 {
                                     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);

                                 //PostMessage = "csrfToken=" + csrfToken + "&subject=" + txtMsgSubject.Text.ToString() + "&body=" + txtMsgBody.Text.ToString() + "&submit=Send Message&showRecipeints=showRecipeints&ccSender=ccSender&fromName=" + FromEmailNam + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=" + Nstring + "&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&goback=.rmg_*1_*1_*1_*1_*1_*1_*1_*1_*1";
                                 //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=&goback=.smg_*1_*1_*1_*1_*1_*1_*1_*1_*1";
                                 PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(tempsubject.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=&goback=.smg_*1_*1_*1_*1_*1_*1_*1_*1_*1";
                                 //IncodePost = Uri.EscapeUriString(PostMessage).Replace(":", "%3A").Replace("%20", "+").Replace("++", "+");
                                 ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/msgToConns"), PostMessage);

                                 if (ResponseStatusMsg.Contains("Your message was successfully sent."))
                                 {
                                     Log("[ " + DateTime.Now + " ] => [ Subject Posted : " + tempsubject + " ]");
                                     Log("[ " + DateTime.Now + " ] => [ Body Text Posted : " + tempBody.ToString() + " ]");
                                     Log("[ " + DateTime.Now + " ] => [ Message Posted To All Selected Accounts With Username >>> " + UserEmail + " ]");
                                     ReturnString = "Your message was successfully sent.";
                                     string bdy = string.Empty;
                                     try
                                     {
                                         bdy = tempBody.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                                     }
                                     catch (Exception ex)
                                     {
                                         Console.WriteLine("ex.Message >>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + "  ex.Stack Trace >>> " + ex.StackTrace);
                                     }
                                     if (string.IsNullOrEmpty(bdy))
                                     {
                                         bdy = tempBody.ToString().Replace(",", ":");
                                     }
                                     string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                     string CSV_Content = UserEmail + "," + tempsubject + "," + bdy + "," + ContactName;
                                     CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_ComposeMessageSent);

                                     //GlobusFileHelper.AppendStringToTextfileNewLine("Subject Posted : " + txtMsgSubject.Text.ToString() + " To: " + ToMsg + " From: " + FromSendMsg.ToString(), Globals.path_ComposeMessage);
                                     //GlobusFileHelper.AppendStringToTextfileNewLine("Body Text Posted : " + body.ToString() + " To: " + ToMsg + " From: " + FromSendMsg.ToString(), Globals.path_ComposeMessage);
                                     //GlobusFileHelper.AppendStringToTextfileNewLine("-------------------------------------------------------------------------------------------------------", Globals.path_ComposeMessage);
                                 }
                                 else if (ResponseStatusMsg.Contains("There was an unexpected problem that prevented us from completing your request."))
                                 {
                                     Log("[ " + DateTime.Now + " ] => [ Error In Message Posting ]");
                                     GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", Globals.path_ComposeMessage);
                                 }
                                 else
                                 {
                                     Log("[ " + DateTime.Now + " ] => [ Failed In Message Posting ]");
                                     GlobusFileHelper.AppendStringToTextfileNewLine("Failed In Message Posting", Globals.path_ComposeMessage);
                                 }

                                 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.StackTrace + " ]");
                                 GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_ComposeMessage);
                             }
                         }
                         catch (Exception ex)
                         {
                             Console.WriteLine("ex.Message >>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + "  ex.Stack Trace >>> " + ex.StackTrace);
                         }
                     }

                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine("ex.Message >>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + "  ex.Stack Trace >>> " + ex.StackTrace);
                 }
             }
             catch (Exception ex)
             {
                 Console.WriteLine("ex.Message >>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + "  ex.Stack Trace >>> " + ex.StackTrace);
             }
        }
        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 ]");
            }
        }
Ejemplo n.º 21
0
        private void PostMessageToAllAccounts(ref GlobusHttpHelper HttpHelper,Dictionary<string, string> SlectedContacts, Dictionary<string, string> dTotalFriends, string msg, string body, string UserEmail, string FromemailId, string FromEmailNam,int mindelay, int maxdelay)
        {
            string postdata = string.Empty;
                 string postUrl = string.Empty;
                 string ResLogin = string.Empty;
                 string csrfToken = string.Empty;
                 string sourceAlias = string.Empty;
                 string ReturnString = string.Empty;
                 string PostMsgSubject = string.Empty;
                 string PostMsgBody = string.Empty;
                 string FString = string.Empty;
                 string Nstring = string.Empty;
                 string connId = string.Empty;
                 string FullName = string.Empty;
                 string ToMsg = string.Empty;

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

                     try
                     {
                         pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));
                     }
                     catch (Exception ex)
                     {
                         Console.WriteLine("ex.Message >>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + "  ex.Stack Trace >>> " + ex.StackTrace);
                     }

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

                             if (string.IsNullOrEmpty(pageSource))
                             {
                                 Log("[ " + DateTime.Now + " ] => [ Page Source Is Null With Username >>> " + UserEmail + " ]");
                                 return;
                             }
                         }
                         catch (Exception ex)
                         {
                             Console.WriteLine("ex.Message >>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + "  ex.Stack Trace >>> " + ex.StackTrace);

                         }
                     }

                     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<script src",string.Empty);
                             csrfToken = csrfToken.Trim();
                         }
                         catch (Exception ex)
                         {
                             Console.WriteLine("ex.Message >>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + "  ex.Stack Trace >>> " + ex.StackTrace);
                         }
                     }

                     if (pageSource.Contains("sourceAlias"))
                     {
                         try
                         {
                             sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100);
                             string[] Arr = sourceAlias.Split('"');
                             sourceAlias = Arr[2];
                         }
                         catch (Exception ex)
                         {
                             Console.WriteLine("ex.Message >>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + "  ex.Stack Trace >>> " + ex.StackTrace);
                         }
                     }

                     string ContactName = string.Empty;
                     Dictionary<string, string> SlectedSentContacts = new Dictionary<string, string>();
                     int counter = 1;

                    // foreach (KeyValuePair<string, string> itemChecked in dTotalFriends)
                         foreach (KeyValuePair<string, string> itemChecked in SlectedContacts )
                     {
                             if (IsAllAccounts)
                             {
                                   if (counter > NoOfFriends)
                                    {
                                        break;
                                    }
                             }

                             if (counter < 50)
                                 {

                                     SlectedSentContacts.Add(itemChecked.Key, itemChecked.Value);

                                     try
                                     {
                                         string FName = string.Empty;
                                         string Lname = string.Empty;

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

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

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

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

                                         try
                                         {
                                             //ToCd = itemChecked.Key.Split(':')[1];
                                             ToCd = itemChecked.Key.ToString();
                                         }
                                         catch { }

                                         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 += "}";

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

                                     }

                                 }

                                 counter++;
                               }

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

                     try
                     {
                         string PostMessage;
                         string ResponseStatusMsg;
                         Log("[ " + DateTime.Now + " ] => [ Sending Message ]");

                         //PostMessage = "csrfToken=" + csrfToken + "&subject=" + txtMsgSubject.Text.ToString() + "&body=" + txtMsgBody.Text.ToString() + "&submit=Send Message&showRecipeints=showRecipeints&ccSender=ccSender&fromName=" + FromEmailNam + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=" + Nstring + "&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&goback=.rmg_*1_*1_*1_*1_*1_*1_*1_*1_*1";

                         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";
                         //string PostMessage1 = "senderEmail=" + FromemailId + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(body.ToString()) + "&showRecipients=showRecipients&isReply=&isForward=&itemId=&recipients=" + connId + "&recipientNames=" + Uri.EscapeUriString(Nstring) + "&groupId=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias + "&submit=Send+Message";
                         //IncodePost = Uri.EscapeUriString(PostMessage).Replace(":", "%3A").Replace("%20", "+").Replace("++", "+");
                         ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/msgToConns"), PostMessage);
                        // string ResponseStatusMsg1 = HttpHelper.postFormData(new Uri("http://www.linkedin.com/msgToConns"), PostMessage);
                         //int totPost = counter--;

                         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 With Username >>> " + UserEmail + " ]");
                             ReturnString = "Your message was successfully sent.";
                             string bdy = string.Empty;
                             try
                             {
                                 bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                             }
                             catch (Exception ex)
                             {
                                 Console.WriteLine("ex.Message >>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + "  ex.Stack Trace >>> " + ex.StackTrace);
                             }
                             if (string.IsNullOrEmpty(bdy))
                             {
                                 bdy = body.ToString().Replace(",", ":");
                             }
                             string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                             string CSV_Content = UserEmail + "," + msg + "," + bdy + "," + ContactName;
                             CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_ComposeMessageSent);

                             //GlobusFileHelper.AppendStringToTextfileNewLine("Subject Posted : " + txtMsgSubject.Text.ToString() + " To: " + ToMsg + " From: " + FromSendMsg.ToString(), Globals.path_ComposeMessage);
                             //GlobusFileHelper.AppendStringToTextfileNewLine("Body Text Posted : " + body.ToString() + " To: " + ToMsg + " From: " + FromSendMsg.ToString(), Globals.path_ComposeMessage);
                             //GlobusFileHelper.AppendStringToTextfileNewLine("-------------------------------------------------------------------------------------------------------", Globals.path_ComposeMessage);
                         }
                         //else if(ResponseStatusMsg.Contains("You have reached the daily login limit for your email provider. Please try again tomorrow."))
                         //{
                         //    Log("You have reached the daily login limit for your email provider. Please try again tomorrow.");
                         //    GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", Globals.path_ComposeMessage);
                         //}
                         else if (ResponseStatusMsg.Contains("There was an unexpected problem that prevented us from completing your request."))
                         {
                             Log("[ " + DateTime.Now + " ] => [ Error In Message Posting ]");
                             GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", Globals.path_ComposeMessage);
                         }
                         else
                         {
                             Log("[ " + DateTime.Now + " ] => [ Failed In Message Posting ]");
                             GlobusFileHelper.AppendStringToTextfileNewLine("Failed In Message Posting", Globals.path_ComposeMessage);
                         }

                         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.StackTrace + " ]");
                         GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_ComposeMessage);
                     }
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine("ex.Message >>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + "  ex.Stack Trace >>> " + ex.StackTrace);
                 }
        }
       public bool AddaPicture(ref GlobusHttpHelper HttpHelper, string Username, string Password, string localImagePath, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, string targeturl, string message, ref string status, string pageSource_Home, string xhpc_targetid, string xhpc_composerid, string message_text, string fb_dtsg, string UsreId)
       {

           string pageSource = HttpHelper.getHtmlfromUrl(new Uri(targeturl));



           bool isSentPicMessage = false;
           //string fb_dtsg = string.Empty;
           string photo_id = string.Empty;
           //string UsreId = string.Empty;
           //xhpc_composerid = string.Empty;
           //xhpc_targetid = string.Empty;
           //message_text = string.Empty;

           try
           {
               #region commentedCode


               //string pageSource_Home = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/home.php"));

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

               //fb_dtsg = GlobusHttpHelper.GetParamValue(pageSource_Home, "fb_dtsg");//pageSourceHome.Substring(pageSourceHome.IndexOf("fb_dtsg") + 16, 8);
               //if (string.IsNullOrEmpty(fb_dtsg))
               //{
               //    fb_dtsg = GlobusHttpHelper.ParseJson(pageSource_Home, "fb_dtsg");
               //}


               //string pageSource_HomeData = HttpHelper.getHtmlfromUrl(new Uri(targeturl));
               //xhpc_composerid = GlobusHttpHelper.GetParamValue(pageSource_HomeData, "composerid");
               //xhpc_targetid = GlobusHttpHelper.GetParamValue(pageSource_HomeData, "xhpc_targetid"); 
               #endregion

               string composer_session_id = "";

               string tempresponse1 = "";
               ///temp post
               {
                   string source = "";
                   string profile_id = "";
                   string gridID = "";
                   string qn = string.Empty;

                   try
                   {
                       string Url = "https://upload.facebook.com/ajax/composerx/attachment/media/saveunpublished?target_id=139180732957326&__user=100007423262870&__a=1&__dyn=7n88Oq9ccmqDxl2u5Fa8HzCqm5Aqbx2mbAKGiBAGm&__req=1t&fb_dtsg=AQCehhQg&__rev=1062230";
                       string posturl1 = "fb_dtsg=" + fb_dtsg + "&composerid=" + xhpc_composerid + "&targetid=" + xhpc_targetid + "&loaded_components[0]=maininput&loaded_components[1]=cameraicon&loaded_components[2]=withtaggericon&loaded_components[3]=placetaggericon&loaded_components[4]=mainprivacywidget&loaded_components[5]=cameraicon&loaded_components[6]=mainprivacywidget&loaded_components[7]=withtaggericon&loaded_components[8]=placetaggericon&loaded_components[9]=maininput&nctr[_mod]=pagelet_group_composer&__user="******"&__a=1&__dyn=7n88QoAMNoBwXAw&__req=i&phstamp=16581688688747595501";    //"fb_dtsg=" + fb_dtsg + "&composerid=" + xhpc_composerid + "&targetid=" + xhpc_targetid + "&istimeline=1&timelinelocation=composer&loaded_components[0]=maininput&loaded_components[1]=mainprivacywidget&loaded_components[2]=mainprivacywidget&loaded_components[3]=maininput&loaded_components[4]=explicitplaceinput&loaded_components[5]=hiddenplaceinput&loaded_components[6]=placenameinput&loaded_components[7]=hiddensessionid&loaded_components[8]=withtagger&loaded_components[9]=backdatepicker&loaded_components[10]=placetagger&loaded_components[11]=withtaggericon&loaded_components[12]=backdateicon&loaded_components[13]=citysharericon&nctr[_mod]=pagelet_timeline_recent&__user="******"&__a=1&__dyn=7n88QoAMNoBwXAw&__req=18&phstamp=1658168111112559866679";
                       // string PostUrl = "city_id=" + CityIDS1 + "&city_page_id=" + city_page_id + "&city_name=" + CityName1 + "&is_default=false&session_id=1362404125&__user="******"&__a=1&__dyn=798aD5z5ynU&__req=z&fb_dtsg=" + fb_dtsg + "&phstamp=1658168111112559866165";
                       string res11 = pageSource_Home;//HttpHelper.postFormData(new Uri(Url), posturl1);


                       try
                       {
                           source = res11.Substring(res11.IndexOf("source\":"), (res11.IndexOf(",", res11.IndexOf("source\":")) - res11.IndexOf("source\":"))).Replace("source\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
                       }
                       catch { }
                       try
                       {
                           profile_id = res11.Substring(res11.IndexOf("profile_id\":"), (res11.IndexOf("}", res11.IndexOf("profile_id\":")) - res11.IndexOf("profile_id\":"))).Replace("profile_id\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
                           if (profile_id.Contains(","))
                           {
                               profile_id = ParseEncodedJson(res11, "profile_id");
                           }
                           //"gridID":
                       }
                       catch { }
                       try
                       {
                           gridID = res11.Substring(res11.IndexOf("gridID\":"), (res11.IndexOf(",", res11.IndexOf("gridID\":")) - res11.IndexOf("gridID\":"))).Replace("gridID\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
                       }
                       catch { }
                       try
                       {
                           composer_session_id = res11.Substring(res11.IndexOf("composer_session_id\":"), (res11.IndexOf("}", res11.IndexOf("composer_session_id\":")) - res11.IndexOf("composer_session_id\":"))).Replace("composer_session_id\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
                       }
                       catch { }

                       try
                       {
                           if (string.IsNullOrEmpty(composer_session_id))
                           {
                               composer_session_id = res11.Substring(res11.IndexOf("composerID\":"), (res11.IndexOf("}", res11.IndexOf("composerID\":")) - res11.IndexOf("composerID\":"))).Replace("composerID\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();

                           }
                       }
                       catch { }

                       try
                       {
                           qn = getBetween(res11, "qn\\\" value=\\\"", "\\\" \\/>");
                       }
                       catch { }
                   }
                   catch { }

                   NameValueCollection nvc1 = new NameValueCollection();
                   try
                   {
                       //message = Uri.EscapeDataString(message);
                   }
                   catch { }

                   //xhpc_composerid = GlobusHttpHelper.GetParamValue(pageSource_HomeData, "composerid");
                   //xhpc_targetid = GlobusHttpHelper.GetParamValue(pageSource_HomeData, "xhpc_targetid");
                   //-------------------------------
                   //nvc1.Add("fb_dtsg", fb_dtsg);
                   //nvc1.Add("source", source);
                   //nvc1.Add("profile_id", profile_id);
                   //nvc1.Add("grid_id", gridID);
                   //nvc1.Add("upload_id", "1024");
                   //-----------------------------------
                   nvc1.Add("fb_dtsg", fb_dtsg);
                   nvc1.Add("source", source);
                   nvc1.Add("profile_id", profile_id);
                   nvc1.Add("grid_id", gridID);
                   nvc1.Add("upload_id", "1024");
                   nvc1.Add("qn", qn);

                   //nvc1.Add("fb_dtsg", fb_dtsg);
                   //nvc1.Add("source", source);
                   //nvc1.Add("profile_id", profile_id);
                   //nvc1.Add("grid_id", gridID);
                   //nvc1.Add("upload_id", "1024");
                   //nvc1.Add("qn", qn);

                   string _rev = getBetween(pageSource, "svn_rev", ",");
                   _rev = _rev.Replace("\":", string.Empty);


                   string uploadURL = "https://upload.facebook.com/ajax/composerx/attachment/media/saveunpublished?target_id=139180732957326&__user=100007423262870&__a=1&__dyn=7n88Oq9ccmqDxl2u5Fa8HzCqm5Aqbx2mbAKGiBAGm&__req=1t&fb_dtsg=AQCehhQg&__rev=1062230";
                   tempresponse1 = HttpUploadFile_UploadPic_temp(ref HttpHelper, UsreId, uploadURL, "composer_unpublished_photo[]", "image/jpeg", localImagePath, nvc1, "", proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

                   //string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "https://upload.facebook.com/ajax/timeline/cover/upload/", "pic", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

                   //string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "http://upload.facebook.com/media/upload/photos/composer/?__a=1&__adt=3&__iframe=true&__user="******"file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

                   tempresponse1 = HttpUploadFile_UploadPic_temp(ref HttpHelper, UsreId, "https://upload.facebook.com/ajax/composerx/attachment/media/saveunpublished?target_id=" + xhpc_targetid + "&__user="******"&__a=1&__dyn=7n88QoAMNoBwXAw&__req=l&fb_dtsg=" + fb_dtsg + "", "composer_unpublished_photo[]", "image/jpeg", localImagePath, nvc1, "", proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

               }

               NameValueCollection nvc = new NameValueCollection();
               try
               {
                   //message = Uri.EscapeDataString(message);
               }
               catch { }
               nvc.Add("fb_dtsg", fb_dtsg);
               nvc.Add("xhpc_targetid", xhpc_targetid);
               nvc.Add("xhpc_context", "profile");
               nvc.Add("xhpc_ismeta", "1");
               nvc.Add("xhpc_fbx", "1");
               nvc.Add("xhpc_timeline", "");
               nvc.Add("xhpc_composerid", xhpc_composerid);
               nvc.Add("xhpc_message_text", message);
               nvc.Add("xhpc_message", message);
               //nvc.Add("name", "file1");
               //nvc.Add("Content-Type:", "image/jpeg");
               //nvc.Add("filename=", "");



               string composer_unpublished_photo = "";
               string start_composer_unpublished_photo = Regex.Split(tempresponse1, "},\"")[1];// 
               int startIndex_composer_unpublished_photo = start_composer_unpublished_photo.IndexOf(",\"") + ",\"".Length;
               int endIndex_composer_unpublished_photo = start_composer_unpublished_photo.IndexOf("\"", startIndex_composer_unpublished_photo + 1);

               composer_unpublished_photo = start_composer_unpublished_photo.Substring(startIndex_composer_unpublished_photo, endIndex_composer_unpublished_photo - startIndex_composer_unpublished_photo);

               ///New test upload pic post
               string waterfallid = GlobusHttpHelper.ParseJson(pageSource_Home, "waterfallID");

               string newpostURL = "https://upload.facebook.com/media/upload/photos/composer/?__user="******"&__a=1&__dyn=7n88QoAMNoBwXAw&__req=r&fb_dtsg=" + fb_dtsg + "";
               string newPostData = "";


               NameValueCollection newnvc = new NameValueCollection();
               try
               {
                   //message = Uri.EscapeDataString(message);
               }
               catch { }
               newnvc.Add("fb_dtsg", fb_dtsg);
               newnvc.Add("xhpc_targetid", xhpc_targetid);
               newnvc.Add("xhpc_context", "profile");
               newnvc.Add("xhpc_ismeta", "1");
               newnvc.Add("xhpc_fbx", "1");
               newnvc.Add("xhpc_timeline", "");
               newnvc.Add("xhpc_composerid", xhpc_composerid);
               newnvc.Add("xhpc_message_text", message);
               newnvc.Add("xhpc_message", message);

               newnvc.Add("composer_unpublished_photo[]", composer_unpublished_photo);
               newnvc.Add("album_type", "128");
               newnvc.Add("is_file_form", "1");
               newnvc.Add("oid", "");
               newnvc.Add("qn", waterfallid);
               newnvc.Add("application", "composer");
               newnvc.Add("is_explicit_place", "");
               newnvc.Add("composertags_place", "");
               newnvc.Add("composertags_place_name", "");
               newnvc.Add("composer_session_id", composer_session_id);
               newnvc.Add("composertags_city", "");
               newnvc.Add("vzdisable_location_sharing", "false");
               newnvc.Add("composer_predicted_city", "");

               // string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "https://upload.facebook.com/ajax/timeline/cover/upload/", "pic", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

               // string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "http://upload.facebook.com/media/upload/photos/composer/?__a=1&__adt=3&__iframe=true&__user="******"file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

               string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, newpostURL, "file1", "image/jpeg", localImagePath, newnvc, targeturl, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);//HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "http://upload.facebook.com/media/upload/photos/composer/?__user="******"&__a=1&__dyn=7n88O49ccm9o-2Ki&__req=1c&fb_dtsg=" + fb_dtsg + "", "file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);



               //http://upload.facebook.com/media/upload/photos/composer/?__a=1&__adt=3&__iframe=true&__user=100004608395129
               if (string.IsNullOrEmpty(response))
               {
                   try
                   {
                       //response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "https://upload.facebook.com/media/upload/photos/composer/?__a=1&__adt=3&__iframe=true&__user="******"file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);
                       response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "https://upload.facebook.com/media/upload/photos/composer/?__user="******"&__a=1&__dyn=7n88O49ccm9o-2Ki&__req=1c&fb_dtsg=" + fb_dtsg + "", "file1", "image/jpeg", localImagePath, nvc, targeturl, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

                   }
                   catch { }
               }
               string posturl = "https://www.facebook.com/ajax/places/city_sharer_reset.php";
               string postdata = "__user="******"&__a=1&fb_dtsg=" + fb_dtsg + "&phstamp=1658167761111108210145";
               string responsestring = HttpHelper.postFormData(new Uri(posturl), postdata);
               try
               {
                   string okay = HttpHelper.getHtmlfromUrl(new Uri("https://3-pct.channel.facebook.com/pull?channel=p_" + UsreId + "&seq=3&partition=69&clientid=70e140db&cb=8p7w&idle=8&state=active&mode=stream&format=json"));
               }
               catch
               {
               }

               if (!string.IsNullOrEmpty(response) && response.Contains("photo.php?fbid="))
               {

                   #region PostData_ForCoverPhotoSelect
                   //fb_dtsg=AQCLSjCH&photo_id=130869487061841&profile_id=100004163701035&photo_offset=0&video_id=&save=Save%20Changes&nctr[_mod]=pagelet_main_column_personal&__user=100004163701035&__a=1&phstamp=165816776831066772182 
                   #endregion

                   try
                   {

                       if (!response.Contains("errorSummary") || !response.Contains("error"))
                       {
                           isSentPicMessage = true;
                       }
                       if (response.Contains("Your post has been submitted and is pending approval by an admin"))
                       {
                           GlobusLogHelper.log.Debug("Your post has been submitted and is pending approval by an admin." + "GroupUrl >>>" + targeturl);
                           GlobusLogHelper.log.Info("Your post has been submitted and is pending approval by an admin." + "GroupUrl >>>" + targeturl);
                       }
                   }
                   catch { }
                   #region CodeCommented
                   //    string photo_idValue = response.Substring(response.IndexOf("photo.php?fbid="), response.IndexOf(";", response.IndexOf("photo.php?fbid=")) - response.IndexOf("photo.php?fbid=")).Replace("photo.php?fbid=", string.Empty).Trim();
                   //    string[] arrphoto_idValue = Regex.Split(photo_idValue, "[^0-9]");

                   //    foreach (string item in arrphoto_idValue)
                   //    {
                   //        try
                   //        {
                   //            if (item.Length > 6)
                   //            {
                   //                photo_id = item;
                   //                break;
                   //            }
                   //        }
                   //        catch
                   //        {
                   //        }
                   //    }

                   //   // string postData = "fb_dtsg=" + fb_dtsg + "&photo_id=" + photo_id + "&profile_id=" + UsreId + "&photo_offset=0&video_id=&save=Save%20Changes&nctr[_mod]=pagelet_main_column_personal&__user="******"&__a=1&phstamp=165816776831066772182 ";
                   //   // string postResponse = HttpHelper.postFormData(new Uri("https://www.facebook.com/ajax/timeline/cover_photo_select.php"), postData);

                   //    //if (!postResponse.Contains("error"))
                   //    //{
                   //    //    //string ok = "ok";
                   //    //    isSentPicMessage = true;
                   //    //}
                   //    //if (string.IsNullOrEmpty(postResponse) || string.IsNullOrWhiteSpace(postResponse))
                   //    //{
                   //    //    status = "Response Is Null !";
                   //    //}
                   //    //if (postResponse.Contains("errorSummary"))
                   //    //{
                   //    //    string summary = GlobusHttpHelper.ParseJson(postResponse, "errorSummary");
                   //    //    string errorDescription = GlobusHttpHelper.ParseJson(postResponse, "errorDescription");

                   //    //    status = "Posting Error: " + summary + " | Error Description: " + errorDescription;
                   //    //    //FanPagePosterLogger("Posting Error: " + summary + " | Error Description: " + errorDescription);
                   //    //}
                   //}
                   //catch
                   //{
                   //} 
                   #endregion
               }
           }
           catch
           {
           }
           return isSentPicMessage;
       }
Ejemplo n.º 23
0
        public void PostFinalMsgGroupMember(ref GlobusHttpHelper HttpHelper, Dictionary<string, string> SlectedContacts, string msg, string body, string UserName)
        {
            try
            {
                string postdata = string.Empty;
                string postUrl = string.Empty;
                string ResLogin = string.Empty;
                string csrfToken = string.Empty;
                string sourceAlias = string.Empty;
                string ReturnString = string.Empty;
                string PostMsgSubject = string.Empty;
                string PostMsgBody = string.Empty;
                string FString = string.Empty;
                string Nstring = string.Empty;
                string connId = string.Empty;
                string FullName = string.Empty;
                try
                {
                    string MessageText = string.Empty;
                    string PostedMessage = string.Empty;

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

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

                    if (chkListGroupMembers.CheckedItems.Count > 0)
                    {
                        string ContactName = string.Empty;
                        foreach (KeyValuePair<string, string> itemChecked in SlectedContacts)
                        {
                            try
                            {
                                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
                                {
                                }
                                AddLoggerComposeMessage("[ " + 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;
                            AddLoggerGroupMemMessage("[ " + DateTime.Now + " ] => [ Sending Message ]");
                            //PostMessage = "csrfToken=" + csrfToken + "&subject=" + txtMsgSubject.Text.ToString() + "&body=" + txtMsgBody.Text.ToString() + "&submit=Send Message&showRecipeints=showRecipeints&ccSender=ccSender&fromName=" + FromEmailNam + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=" + Nstring + "&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&goback=.rmg_*1_*1_*1_*1_*1_*1_*1_*1_*1";
                            PostMessage = "csrfToken=" + csrfToken + "&subject=" + msg.ToString() + "&body=" + 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";
                            //IncodePost = Uri.EscapeUriString(PostMessage).Replace(":", "%3A").Replace("%20", "+").Replace("++", "+");
                            ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/msgToConns"), PostMessage);

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

                                #region CSV

                                string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                string CSV_Content = UserName + "," + txtSubject.Text.ToString() + "," + body.ToString() + "," + ContactName;
                                CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_AddConnectionSuccessWith2ndDegree);

                                #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."))
                            {
                                AddLoggerGroupMemMessage("[ " + DateTime.Now + " ] => [ Error In Message Posting ]");
                                GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", Globals.path_MessageGroupMember);
                            }
                        }
                        catch (Exception ex)
                        {
                            //AddLoggerGroupMemMessage("[ " + 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_LinkedinComposeMessageErrorLogs);
                }
            }
            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);
            }
            finally
            {
                //counter_compose_message--;
                //if (counter_compose_message == 0)
                //{
                if (btnGroupMessage.InvokeRequired)
                {
                    btnGroupMessage.Invoke(new MethodInvoker(delegate
                    {
                        //pictureBox10Red.Visible = false;
                        //pictureBox10Green.Visible = true;
                        AddLoggerGroupMemMessage("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                        AddLoggerGroupMemMessage("-------------------------------------------------------------------------------------------------------------------------------");
                    }));
                }
                //}
            }
        }
        public bool AddaCover(ref GlobusHttpHelper HttpHelper, string Username, string Password, string localImagePath, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, ref string status)
        {
            bool isAddaCover = false;
            string fb_dtsg = string.Empty;
            string photo_id = string.Empty;
            string UsreId = string.Empty;

            try
            {

                string pageSource_Home = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/home.php"));

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

                fb_dtsg = GlobusHttpHelper.GetParamValue(pageSource_Home, "fb_dtsg");//pageSourceHome.Substring(pageSourceHome.IndexOf("fb_dtsg") + 16, 8);
                if (string.IsNullOrEmpty(fb_dtsg))
                {
                    fb_dtsg = GlobusHttpHelper.ParseJson(pageSource_Home, "fb_dtsg");
                }

                NameValueCollection nvc = new NameValueCollection();

                nvc.Add("fb_dtsg", fb_dtsg);
                //nvc.Add("filename=", fb_dtsg);
                nvc.Add("Content-Type:", "image/jpeg");

                string response = HttpUploadFile_AddaCover(ref HttpHelper, UsreId, "https://upload.facebook.com/ajax/timeline/cover/upload/", "pic", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

                try
                {
                    string okay = HttpHelper.getHtmlfromUrl(new Uri("http://3-pct.channel.facebook.com/pull?channel=p_" + UsreId + "&seq=3&partition=69&clientid=70e140db&cb=8p7w&idle=8&state=active&mode=stream&format=json"));
                }
                catch
                {
                }

                if (!string.IsNullOrEmpty(response) && response.Contains("photo.php?fbid="))
                {
                    #region PostData_ForCoverPhotoSelect
                    //fb_dtsg=AQCLSjCH&photo_id=130869487061841&profile_id=100004163701035&photo_offset=0&video_id=&save=Save%20Changes&nctr[_mod]=pagelet_main_column_personal&__user=100004163701035&__a=1&phstamp=165816776831066772182 
                    #endregion
                    try
                    {
                        string photo_idValue = response.Substring(response.IndexOf("photo.php?fbid="), response.IndexOf(";", response.IndexOf("photo.php?fbid=")) - response.IndexOf("photo.php?fbid=")).Replace("photo.php?fbid=", string.Empty).Trim();
                        string[] arrphoto_idValue = Regex.Split(photo_idValue, "[^0-9]");

                        foreach (string item in arrphoto_idValue)
                        {
                            try
                            {
                                if (item.Length > 6)
                                {
                                    photo_id = item;
                                    break;
                                }
                            }
                            catch
                            {
                            }
                        }

                        string postData = "fb_dtsg=" + fb_dtsg + "&photo_id=" + photo_id + "&profile_id=" + UsreId + "&photo_offset=0&video_id=&save=Save%20Changes&nctr[_mod]=pagelet_main_column_personal&__user="******"&__a=1&phstamp=165816776831066772182 ";
                        string postResponse = HttpHelper.postFormData(new Uri("https://www.facebook.com/ajax/timeline/cover_photo_select.php"), postData);

                        if (!postResponse.Contains("error"))
                        {
                            //string ok = "ok";
                            isAddaCover = true;
                        }
                        if (string.IsNullOrEmpty(postResponse) || string.IsNullOrWhiteSpace(postResponse))
                        {
                            status = "Response Is Null !";
                        }
                        if (postResponse.Contains("errorSummary"))
                        {
                            string summary = GlobusHttpHelper.ParseJson(postResponse, "errorSummary");
                            string errorDescription = GlobusHttpHelper.ParseJson(postResponse, "errorDescription");

                            status = "Posting Error: " + summary + " | Error Description: " + errorDescription;
                            //FanPagePosterLogger("Posting Error: " + summary + " | Error Description: " + errorDescription);
                        }
                    }
                    catch
                    {
                    }
                }
                else
                {
                    if (response.Contains("Please choose an image that"))
                    {
                        status = "Please choose an image that's at least 399 pixels wide";
                    }

                }
            }
            catch
            {
            }
            return isAddaCover;
        }
Ejemplo n.º 25
0
        public void PostGroupMsg(List<string> selectedItems, object parameter)
        {
            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 PostGrpDiscussion = string.Empty;
            string PostGrpMoreDetails = string.Empty;
            string PostGrpKey = string.Empty;

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

                Array paramsArray = new object[1];

                paramsArray = (Array)parameter;

                KeyValuePair<string, LinkedInMaster> item = (KeyValuePair<string, LinkedInMaster>)paramsArray.GetValue(0);
                LinkedinLogin Login = new LinkedinLogin();

                Login.accountUser = item.Key;
                Login.accountPass = item.Value._Password;
                Login.proxyAddress = item.Value._ProxyAddress;
                Login.proxyPort = item.Value._ProxyPort;
                Login.proxyUserName = item.Value._ProxyUsername;
                Login.proxyPassword = item.Value._ProxyPassword;

                GlobusHttpHelper HttpHelper = new GlobusHttpHelper();

                if (!Login.IsLoggedIn)
                {
                    Login.LoginHttpHelper(ref HttpHelper);
                }

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

                if (pageSource.Contains("csrfToken"))
                {
                    string pattern = @"\";
                    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.Replace(pattern, string.Empty.Trim());
                }

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

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

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

                try
                {
                    string PostGroupstatus;
                    string ResponseStatusMsg;
                    foreach (var Itegid in selectedItems)
                    {
                        lock (GroupStatus.Locked_GrpKey_Post)
                        {
                            if (GroupStatus.Que_GrpKey_Post.Count > 0)
                            {
                                try
                                {
                                    PostGrpKey = GroupStatus.Que_GrpKey_Post.Dequeue();
                                }
                                catch
                                {
                                }
                            }
                        }

                        lock (GroupStatus.Locked_GrpPostTitle_Post)
                        {
                            if (GroupStatus.Que_GrpPostTitle_Post.Count > 0)
                            {
                                try
                                {
                                    PostGrpDiscussion = GroupStatus.Que_GrpPostTitle_Post.Dequeue();
                                }
                                catch
                                {
                                }
                            }
                        }

                        lock (GroupStatus.Locked_GrpMoreDtl_Post)
                        {
                            if (GroupStatus.Que_GrpMoreDtl_Post.Count > 0)
                            {
                                try
                                {
                                    PostGrpMoreDetails = GroupStatus.Que_GrpMoreDtl_Post.Dequeue();
                                }
                                catch
                                {
                                }
                            }
                        }

                        string[] grpDisplay = Itegid.Split(':');
                        string GrpName = Itegid.ToString().Replace(",", ":").Replace("[", string.Empty).Replace("]", string.Empty).Trim();
                        string[] PostGid = GrpName.Split(':');
                        string Gid = string.Empty;

                        try
                        {
                            if (NumberHelper.ValidateNumber(PostGid[1].Trim()))
                            {
                                Gid = PostGid[1].Trim();
                            }
                            else if (NumberHelper.ValidateNumber(PostGid[2].Trim()))
                            {
                                Gid = PostGid[2].Trim();
                            }
                            else if (NumberHelper.ValidateNumber(PostGid[3].Trim()))
                            {
                                Gid = PostGid[3].Trim();
                            }
                            else if (NumberHelper.ValidateNumber(PostGid[4].Trim()))
                            {
                                Gid = PostGid[4].Trim();
                            }
                            else if (NumberHelper.ValidateNumber(PostGid[5].Trim()))
                            {
                                Gid = PostGid[5].Trim();
                            }
                            else if (NumberHelper.ValidateNumber(PostGid[6].Trim()))
                            {
                                Gid = PostGid[6].Trim();
                            }
                        }
                        catch
                        {
                        }

                        PostGroupstatus = "csrfToken=" + csrfToken + "&postTitle=" + PostGrpDiscussion + "&postText=" + PostGrpMoreDetails + "&pollChoice1-ANetPostForm=&pollChoice2-ANetPostForm=&pollChoice3-ANetPostForm=&pollChoice4-ANetPostForm=&pollChoice5-ANetPostForm=&pollEndDate-ANetPostForm=0&contentImageCount=0&contentImageIndex=-1&contentImage=&contentEntityID=&contentUrl=&contentTitle=&contentSummary=&contentImageIncluded=true&%23=&gid=" + Gid.Trim() + "&postItem=&ajax=true&tetherAccountID=&facebookTetherID=";

                        ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groups"), PostGroupstatus);
                        Thread.Sleep(2000);

                        if (ResponseStatusMsg.Contains("SUCCESS"))
                        {
                            AddLoggerGroupStatus("[ " + DateTime.Now + " ] => [ Message Header Posted : " + PostGrpDiscussion + " Successfully on Group : " + grpDisplay[2] + " ]");
                            AddLoggerGroupStatus("[ " + DateTime.Now + " ] => [ Message More Details Posted : " + PostGrpMoreDetails + " Successfully on Group : " + grpDisplay[2] + " ]");

                            GlobusFileHelper.AppendStringToTextfileNewLine("Message Header Posted : " + PostGrpDiscussion + " Successfully on Group : " + grpDisplay[2], Globals.path_GroupUpdate);
                            GlobusFileHelper.AppendStringToTextfileNewLine("Message More Details Posted : " + PostGrpMoreDetails + " Successfully on Group : " + grpDisplay[2], Globals.path_GroupUpdate);
                        }
                        else if (ResponseStatusMsg.Contains("Your request to join is still pending"))
                        {
                            AddLoggerGroupStatus("[ " + DateTime.Now + " ] => [ Your membership is pending approval on a Group:" + grpDisplay[2] + " ]");
                            AddLoggerGroupStatus("[ " + DateTime.Now + " ] => [ Message Header: " + PostGrpDiscussion + " Not Posted on Group:" + grpDisplay[2] + " Because Your membership is pending for approval. ]");
                            AddLoggerGroupStatus("[ " + DateTime.Now + " ] => [ Message More Details: " + PostGrpMoreDetails + " Not Posted on Group:" + grpDisplay[2] + " Because Your membership is pending for approval. ]");

                            GlobusFileHelper.AppendStringToTextfileNewLine("Your membership is pending approval on a Group:" + grpDisplay[2], Globals.path_GroupUpdate);
                            GlobusFileHelper.AppendStringToTextfileNewLine("Message Header: " + PostGrpDiscussion + " Not Posted on Group:" + grpDisplay[2] + " Because Your membership is pending for approval. ", Globals.path_GroupUpdate);
                            GlobusFileHelper.AppendStringToTextfileNewLine("Message More Details: " + PostGrpMoreDetails + " Not Posted on Group:" + grpDisplay[2] + " Because Your membership is pending for approval. ", Globals.path_GroupUpdate);
                        }
                        else if (ResponseStatusMsg.Contains("Your post has been submitted for review"))
                        {
                            AddLoggerGroupStatus("[ " + DateTime.Now + " ] => [ Message Header Posted : " + PostGrpDiscussion + " Successfully on Group : " + grpDisplay[2] + " ]");
                            AddLoggerGroupStatus("[ " + DateTime.Now + " ] => [ Message More Details Posted : " + PostGrpMoreDetails + " Successfully on Group : " + grpDisplay[2] + " ]");
                            AddLoggerGroupStatus("[ " + DateTime.Now + " ] => [ Your post has been submitted for review ]");

                            GlobusFileHelper.AppendStringToTextfileNewLine("Message Header Posted : " + PostGrpDiscussion + " Successfully on Group : " + grpDisplay[2], Globals.path_GroupUpdate);
                            GlobusFileHelper.AppendStringToTextfileNewLine("Message More Details Posted : " + PostGrpMoreDetails + " Successfully on Group : " + grpDisplay[2], Globals.path_GroupUpdate);
                            GlobusFileHelper.AppendStringToTextfileNewLine("Your post has been submitted for review", Globals.path_GroupUpdate);
                        }
                        else if (ResponseStatusMsg.Contains("Error"))
                        {
                            AddLoggerCreateGroup("[ " + DateTime.Now + " ] => [ Error in Post ]");
                            GlobusFileHelper.AppendStringToTextfileNewLine("Error in Post", Globals.path_GroupUpdate);
                        }
                        else
                        {
                            AddLoggerCreateGroup("[ " + DateTime.Now + " ] => [ Message Not Posted ]");
                            GlobusFileHelper.AppendStringToTextfileNewLine("Message Not Posted", Globals.path_GroupUpdate);
                        }
                    }
                }
                catch (Exception ex)
                {
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update --> cmbGroupUser_SelectedIndexChanged() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update --> cmbGroupUser_SelectedIndexChanged() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                    //AddLoggerGroupStatus("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");
                }
                finally
                {
                    counter_GroupMemberSearch--;
                    int cnt = LinkedInManager.linkedInDictionary.Count - 1;
                    if (counter_GroupMemberSearch == cnt)
                    {
                        if (btnGroupUpdate.InvokeRequired)
                        {
                            btnGroupUpdate.Invoke(new MethodInvoker(delegate
                            {
                                //AddLoggerGroupStatus("Process Complete..");
                                btnGroupUpdate.Enabled = true;

                            }));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update --> cmbGroupUser_SelectedIndexChanged() ---2--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update --> cmbGroupUser_SelectedIndexChanged() ---2--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
            }
        }
Ejemplo n.º 26
0
        public void UrlShare(ref GlobusHttpHelper objGlobusHttpHelper, string username, string password, string proxyAddress, string proxyPort, string proxyUserName, string proxyPassword, string webUrlAndText)
        {
            try
            {
                if (_isStop_Share)
                {
                    return;
                }
                lstShareThread.Add(Thread.CurrentThread);
                lstShareThread = lstShareThread.Distinct().ToList();
                Thread.CurrentThread.IsBackground = true;

                AddLoggerShare("[ " + DateTime.Now + " ] => [ Starting process to share the link on account : " + username + " ]");

                string getResponseWebUrl = string.Empty;
                string shareUrl = string.Empty;
                string csrfToken = string.Empty;
                string contentId = string.Empty;
                string contentUrl = string.Empty;
                string contentResolvedUrl = string.Empty;
                string contentType = string.Empty;
                string contentTitle = string.Empty;
                string contentDescription = string.Empty;
                string mentions = "%5B%5D";
                string shareText = string.Empty;
                string webUrl = string.Empty;
                string distNetwork = string.Empty;
                try
                {
                    if (webUrlAndText.Contains(";"))
                    {
                        string[] url_Text_Split = Regex.Split(webUrlAndText, ";");
                        webUrl = url_Text_Split[0];
                        shareText = url_Text_Split[1];
                    }
                    else
                    {
                        webUrl = webUrlAndText;
                    }

                }
                catch
                { }

                try
                {
                    if (!webUrl.Contains("http"))
                    {
                        webUrl = "http://" + webUrl;
                    }
                }
                catch
                { }

                getResponseWebUrl = objGlobusHttpHelper.getHtmlfromUrl(new Uri(webUrl));
                shareUrl = "https://www.linkedin.com/sharing/share?url=" + Uri.EscapeDataString(webUrl) + "&trk=LI_BADGE";
                string getResponseShareUrl = objGlobusHttpHelper.getHtmlfromUrl(new Uri(shareUrl));
                if (!getResponseShareUrl.Contains("csrfToken"))
                {
                    Thread.Sleep(3000);
                    getResponseShareUrl = objGlobusHttpHelper.getHtmlfromUrl(new Uri(shareUrl));
                    if (!getResponseShareUrl.Contains("csrfToken"))
                    {
                        Thread.Sleep(3000);
                        getResponseShareUrl = objGlobusHttpHelper.getHtmlfromUrl(new Uri(shareUrl));
                    }
                }
                csrfToken = getBetween(getResponseShareUrl, "\"csrfToken\":\"", "\"");
                contentId = getBetween(getResponseShareUrl, "name=\"content.id\" value=\"", "\"");
                contentUrl = getBetween(getResponseShareUrl, "name=\"content.url\" value=\"", "\"");
                contentResolvedUrl = getBetween(getResponseShareUrl, "name=\"content.resolvedUrl\" value=\"", "\"");
                contentType = getBetween(getResponseShareUrl, "name=\"contentType\" value=\"", "\"");
                contentTitle = getBetween(getResponseShareUrl, "name=\"content.title\" value=\"", "\"");
                distNetwork = "PUBLIC";

                string webActionTrackUrl = "https://www.linkedin.com/lite/web-action-track?csrfToken=" + Uri.EscapeDataString(csrfToken);
                string webActionPostData = "pkey=cws-share-widget&tcode=shr-unwnd-sccss&plist=";
                string postResponseWebAction = objGlobusHttpHelper.postFormData(new Uri(webActionTrackUrl), webActionPostData);

                string postResponseInfluencer = objGlobusHttpHelper.postFormData(new Uri("https://www.linkedin.com/nhome/influencer-entitlement"), string.Empty);

                string finalPostUrl = "https://www.linkedin.com/sharing/share?trk=LI_BADGE";
                string postDataFinalPost = "csrfToken=" + csrfToken + "&content.id=" + contentId + "&content.url=" + Uri.EscapeDataString(contentUrl) + "&content.resolvedUrl=" + Uri.EscapeDataString(contentResolvedUrl) + "&contentType=" + contentType + "&content.title=" + contentTitle + "&content.description=" + contentDescription + "&mentions=" + mentions + "&shareText=" + shareText.Replace(" ", "+") + "&dist.networks%5B0%5D=" + distNetwork;
                string responseFinalPost = objGlobusHttpHelper.postFormData(new Uri(finalPostUrl), postDataFinalPost);

                if (responseFinalPost.Contains("\"status\":\"SUCCESS\""))
                {
                    AddLoggerShare("[ " + DateTime.Now + " ] => [ Successfully shared URL" + shareUrl + " on the account : " + username + " ]");
                }
                else
                {
                    AddLoggerShare("[ " + DateTime.Now + " ] => [ Sharing unsuccessful URL" + shareUrl + " on the account : " + username + " ]");
                }

            }
            catch
            { }
        }
Ejemplo n.º 27
0
        private List<string> ScarppLinkedinDataByPageNumber(int pagerecords, ref GlobusHttpHelper HttpHelper, string Pagesource, string LastName, string countrycd, string postalcd, string distance, string indstrycd)
        {
            List<string> lstRecordurl = new List<string>();
            try
            {
                string ResponseForPremiumAcc = Pagesource;
                int pagenumber = (pagerecords / 10) + 1;// (pagerecords / 10) - 1;

                string GetResponce = string.Empty;
                string GetRequestURL = string.Empty;
                string PostRequestURL = string.Empty;
                string PostdataForPagination = string.Empty;
                string PostResponce = string.Empty;
                if (pagenumber >= 1)//(pagenumber > 1)
                {
                    for (int i = 1; i <= pagenumber; i++)
                    {
                        PostRequestURL = string.Empty;
                        PostdataForPagination = string.Empty;
                        PostResponce = string.Empty;
                        //if (SearchCriteria.starter)
                        {
                            // #region loop

                            if (ResponseForPremiumAcc.Contains("Account Type:</span> Basic"))
                            {
                                try
                                {
                                    PostRequestURL = "http://www.linkedin.com/search/hits";
                                    PostdataForPagination = "lname=" + lastName + "&searchLocationType=I&countryCode=" + countrycd + "&postalCode=" + postalcd + "&distance=" + distance + "&keepFacets=keepFacets&facet_I=" + indstrycd + "&pplSearchOrigin=ADVS&viewCriteria=2&sortCriteria=R&facetsOrder=I%2CCC%2CN%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR%2CG&page_num=" + i + "&openFacets=I%2CCC%2CN";
                                    //PostdataForPagination = "keywords=" + _Keyword + "&searchLocationType=Y&search=&pplSearchOrigin=GLHD&viewCriteria=2&sortCriteria=R&facetsOrder=CC%2CN%2CG%2CI%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR&page_num=" + i + "&openFacets=CC%2CN%2CG";//"fname=" + SearchCriteria.FirstName + "&lname=" + SearchCriteria.LastName + "&searchLocationType=" + SearchCriteria.Location + "&countryCode=" + SearchCriteria.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 { }
                            }

                            else if (ResponseForPremiumAcc.Contains(""))
                            {
                                try
                                {
                                    PostRequestURL = "http://www.linkedin.com/search/hits";
                                    PostdataForPagination = "lname=" + lastName + "&searchLocationType=I&countryCode=" + countrycd + "&postalCode=" + postalcd + "&distance=" + distance + "&keepFacets=keepFacets&facet_I=" + indstrycd + "&pplSearchOrigin=ADVS&viewCriteria=2&sortCriteria=R&facetsOrder=I%2CCC%2CN%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR%2CG&page_num=" + i + "&openFacets=I%2CCC%2CN";
                                    //PostdataForPagination = "keywords=" + _Keyword + "&searchLocationType=Y&search=&pplSearchOrigin=GLHD&viewCriteria=2&sortCriteria=R&facetsOrder=CC%2CN%2CG%2CI%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR&page_num=" + i + "&openFacets=CC%2CN%2CG";//"fname=" + SearchCriteria.FirstName + "&lname=" + SearchCriteria.LastName + "&searchLocationType=" + SearchCriteria.Location + "&countryCode=" + SearchCriteria.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);
                                    if (string.IsNullOrEmpty(PostResponce))
                                    {
                                        PostRequestURL = "http://www.linkedin.com/search/hits";
                                        //PostRequestURL = "http://www.linkedin.com/vsearch/p?";
                                        PostdataForPagination = "lname=" + lastName + "&searchLocationType=I&countryCode=" + countrycd + "&postalCode=" + postalcd + "&distance=" + distance + "&keepFacets=keepFacets&facet_I=" + indstrycd + "&pplSearchOrigin=ADVS&viewCriteria=2&sortCriteria=R&facetsOrder=I%2CCC%2CN%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR%2CG&page_num=" + i + "&openFacets=I%2CCC%2CN";
                                        //PostdataForPagination = "keywords=" + _Keyword + "&searchLocationType=Y&search=&pplSearchOrigin=GLHD&viewCriteria=2&sortCriteria=R&facetsOrder=CC%2CN%2CG%2CI%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR&page_num=" + i + "&openFacets=CC%2CN%2CG";//"fname=" + SearchCriteria.FirstName + "&lname=" + SearchCriteria.LastName + "&searchLocationType=" + SearchCriteria.Location + "&countryCode=" + SearchCriteria.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 { }

                            }
                            else if (ResponseForPremiumAcc.Contains("Account Type:</span> Executive"))
                            {
                                try
                                {
                                    PostRequestURL = "http://www.linkedin.com/search/hits";
                                    //PostdataForPagination = "fname=" + SearchCriteria.FirstName + "&lname=" + SearchCriteria.LastName + "&searchLocationType=" + SearchCriteria.Location + "&countryCode=" + SearchCriteria.Country + "&keepFacets=keepFacets&I=" + SearchCriteria.IndustryType + "&SE=" + SearchCriteria.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";
                                    PostdataForPagination = "lname=" + lastName + "&searchLocationType=I&countryCode=" + countrycd + "&postalCode=" + postalcd + "&distance=" + distance + "&keepFacets=keepFacets&facet_I=" + indstrycd + "&pplSearchOrigin=ADVS&viewCriteria=2&sortCriteria=R&facetsOrder=I%2CCC%2CN%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR%2CG&page_num=" + i + "&openFacets=I%2CCC%2CN";

                                    PostResponce = HttpHelper.postFormData(new Uri(PostRequestURL), PostdataForPagination);
                                }
                                catch { }

                            }

                            if (PostResponce.Contains("/profile/view?id"))
                            {

                                List<string> PageSerchUrl = ChilkatBasedRegex.GettingAllUrls(PostResponce, "profile/view?id");
                                if (PageSerchUrl.Count == 0)
                                {
                                    string[] Url_Split = Regex.Split(PostResponce, "link_nprofile_view_3");
                                    foreach(string item in Url_Split)
                                    {
                                        if (!item.Contains("<!DOCTYPE html>"))
                                        {
                                            try
                                            {
                                                int startIndex = item.IndexOf("\":\"");
                                                string Start = item.Substring(startIndex).Replace("\":\"", string.Empty);
                                                int endIndex = Start.IndexOf("\",\"");
                                                string End = Start.Substring(0, endIndex).Replace("\",\"", string.Empty).Trim();
                                                PageSerchUrl.Add(End);
                                            }
                                            catch
                                            { }
                                        }
                                    }
                                }

                                if (PageSerchUrl.Count == 0)
                                {

                                    //Log("On the basis of you Account you can able to see " + RecordURL.Count + "Results");
                                    break;
                                }
                                foreach (string item in PageSerchUrl)
                                {
                                    try
                                    {
                                        //if (SearchCriteria.starter)
                                        {
                                            if (item.Contains("authType=") && item.Contains("profile/view?id"))
                                            {
                                                string urlSerch = string.Empty;
                                                try
                                                {
                                                    //if (!item.Contains("http://www.linkedin.com"))
                                                    if (!item.Contains("//www.linkedin.com"))
                                                    {
                                                         urlSerch = "https://www.linkedin.com" + item;
                                                    }
                                                    else
                                                    {
                                                        urlSerch = item;
                                                    }
                                                    // Log(urlSerch);
                                                    //string[] aaa = Regex.Split(urlSerch, "&pvs");
                                                    lstRecordurl.Add(urlSerch);
                                                    lstRecordurl = lstRecordurl.Distinct().ToList();
                                                }
                                                catch { }
                                            }
                                        }
                                    }
                                    catch
                                    {
                                    }
                                }
                            }

                            else if (!string.IsNullOrEmpty(PostResponce) && !PostResponce.Contains("authType=") && PostResponce.Contains("Custom views are no longer supported. Please select either Basic or Expanded view"))
                            {
                                break;
                            }
                            if (string.IsNullOrEmpty(PostResponce))
                            {
                                string GetRequestUrl = "https://www.linkedin.com/vsearch/p?page_num=" + i + "&orig=ADVS&lastName=" + LastName + "&distance=" + distance + "&countryCode=" + countrycd + "&postalCode=" + postalcd + "&f_I=" + indstrycd;
                                string GetResponse = HttpHelper.getHtmlfromUrl1(new Uri(GetRequestUrl));
                                try
                                {
                                    if (GetResponse.Contains("link_nprofile_view_3"))
                                    {
                                        string[] PageSerchUrl = Regex.Split(GetResponse, "link_nprofile_view_3");
                                        if (PageSerchUrl.Length == 0)
                                        {
                                            break;
                                        }
                                        foreach (string item in PageSerchUrl)
                                        {
                                            if (!item.Contains("<!DOCTYPE html>"))
                                            {
                                                try
                                                {
                                                    int startindex = item.IndexOf("\":\"");
                                                    string start = item.Substring(startindex).Replace("\":\"", string.Empty);
                                                    int endindex = start.IndexOf(",");
                                                    string end = start.Substring(0, endindex).Replace(",", string.Empty);
                                                    string Url = end.Trim();
                                                    if (Url.Contains("authType="))
                                                    {
                                                        string urlSerch = string.Empty;
                                                        try
                                                        {
                                                            if (!Url.Contains("//www.linkedin.com"))
                                                            {
                                                                urlSerch = "https://www.linkedin.com" + Url;
                                                            }
                                                            else
                                                            {
                                                                urlSerch = Url;
                                                            }
                                                            Log("[ URL scraped : " + urlSerch + " ]");
                                                            lstRecordurl.Add(urlSerch);
                                                            lstRecordurl = lstRecordurl.Distinct().ToList();
                                                        }
                                                        catch { }
                                                    }
                                                }
                                                catch
                                                {
                                                }
                                            }
                                        }
                                        if (GetResponse.Contains("link_nprofile_view_headless"))
                                        {
                                            string[] PagerSerchUrl1 = Regex.Split(GetResponse, "link_nprofile_view_headless");
                                            foreach (string item in PagerSerchUrl1)
                                            {
                                                if (!item.Contains("<!DOCTYPE html>"))
                                                {
                                                    try
                                                    {
                                                        int startindex = item.IndexOf("\":\"");
                                                        string start = item.Substring(startindex).Replace("\":\"", string.Empty);
                                                        int endindex = start.IndexOf(",");
                                                        string end = start.Substring(0, endindex).Replace(",", string.Empty);
                                                        string Url = end.Trim();
                                                        if (Url.Contains("authType="))
                                                        {
                                                            string urlSerch = string.Empty;
                                                            try
                                                            {
                                                                if (!Url.Contains("//www.linkedin.com"))
                                                                {
                                                                    urlSerch = "https://www.linkedin.com" + Url;
                                                                }
                                                                else
                                                                {
                                                                    urlSerch = Url;
                                                                }
                                                                Log("[ URL scraped : " + urlSerch + " ]");
                                                                lstRecordurl.Add(urlSerch);
                                                                lstRecordurl = lstRecordurl.Distinct().ToList();
                                                            }
                                                            catch { }
                                                        }
                                                    }
                                                    catch
                                                    { }

                                                }
                                            }
                                        }

                                    }

                                }
                                catch
                                { }
                            }
                        }
                    }
                }
                else
                {
                    if (ResponseForPremiumAcc.Contains("Account Type:</span> Basic"))
                    {
                        try
                        {
                            PostRequestURL = "http://www.linkedin.com/search/hits";
                            PostdataForPagination = "lname=" + lastName + "&searchLocationType=I&countryCode=" + countrycd + "&postalCode=" + postalcd + "&distance=" + distance + "&keepFacets=keepFacets&facet_I=" + indstrycd + "&pplSearchOrigin=ADVS&viewCriteria=2&sortCriteria=R&facetsOrder=I%2CCC%2CN%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR%2CG&page_num=1&openFacets=I%2CCC%2CN";
                            //PostdataForPagination = "keywords=" + _Keyword + "&searchLocationType=Y&search=&pplSearchOrigin=GLHD&viewCriteria=2&sortCriteria=R&facetsOrder=CC%2CN%2CG%2CI%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR&page_num=" + i + "&openFacets=CC%2CN%2CG";//"fname=" + SearchCriteria.FirstName + "&lname=" + SearchCriteria.LastName + "&searchLocationType=" + SearchCriteria.Location + "&countryCode=" + SearchCriteria.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 { }
                    }
                    else if (ResponseForPremiumAcc.Contains("Account Type:</span> Executive"))
                    {
                        try
                        {
                            PostRequestURL = "http://www.linkedin.com/search/hits";
                            //PostdataForPagination = "fname=" + SearchCriteria.FirstName + "&lname=" + SearchCriteria.LastName + "&searchLocationType=" + SearchCriteria.Location + "&countryCode=" + SearchCriteria.Country + "&keepFacets=keepFacets&I=" + SearchCriteria.IndustryType + "&SE=" + SearchCriteria.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";
                            PostdataForPagination = "lname=" + lastName + "&searchLocationType=I&countryCode=" + countrycd + "&postalCode=" + postalcd + "&distance=" + distance + "&keepFacets=keepFacets&facet_I=" + indstrycd + "&pplSearchOrigin=ADVS&viewCriteria=2&sortCriteria=R&facetsOrder=I%2CCC%2CN%2CPC%2CED%2CL%2CFG%2CTE%2CFA%2CSE%2CP%2CCS%2CF%2CDR%2CG&page_num=1&openFacets=I%2CCC%2CN";

                            PostResponce = HttpHelper.postFormData(new Uri(PostRequestURL), PostdataForPagination);
                        }
                        catch { }

                    }

                    if (PostResponce.Contains("/profile/view?id"))
                    {

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

                            //Log("On the basis of you Account you can able to see " + RecordURL.Count + "Results");
                            // break;
                        }
                        foreach (string item in PageSerchUrl)
                        {
                            try
                            {
                                //if (SearchCriteria.starter)
                                {
                                    if (item.Contains("authType="))
                                    {
                                        string urlSerch = "http://www.linkedin.com" + item;
                                        lstRecordurl.Add(urlSerch);
                                    }
                                }
                            }
                            catch
                            {
                            }
                        }
                    }

                }
            }
            catch { }
            return lstRecordurl;
        }
Ejemplo n.º 28
0
        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);
             }
        }
Ejemplo n.º 29
0
        private void SearchByCompany(ref GlobusHttpHelper HttpHelper)
        {
            try
            {

                Log("[ " + DateTime.Now + " ] => [ Starting Search By Company With UserName : "******" ]");
                _Search = _Search.ToLower();
                _Keyword = _Keyword.ToLower();

               string CompanySearchGetRequest = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/vsearch/c?type=companies&keywords=" + _Keyword.ToLower() + "&orig=GLHD&rsid=&pageKey=nprofile_v2_edit_fs"));
               //Temporosy code for client
               GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Comp Scpr Pagesource 1 >>>> " + CompanySearchGetRequest, Globals.Path_LinkedinCompanyScrapperPagesource);
               List<string> lstCompanyUrls = GettingAllUrlswithCompanyFilter(CompanySearchGetRequest);

                // call to GetDataFromCompanyURL
                GetDataFromCompanyURL(ref HttpHelper, lstCompanyUrls);

                // call to get page no

                int TotUrl = GetPageNo(CompanySearchGetRequest);
                int pagenumber = 0;

                try
                {
                    Log("[ " + DateTime.Now + " ] => [ Total Urls : " + TotUrl.ToString() + " ]");
                    pagenumber = int.Parse(TotUrl.ToString()) / 10 + 1;
                }
                catch (Exception)
                {

                }

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

                if (pagenumber > 1)
                {
                    try
                    {

                        //string posturl = "http://www.linkedin.com/csearch/hits";
                        string posturl = "http://www.linkedin.com/vsearch/c?keywords=" + _Keyword + "";
                        for (int s = 2; s <= pagenumber; s++)
                        {
                            try
                            {
                                //l%26T
                                if (_Keyword.Contains("&"))
                                {
                                    _Keyword = _Keyword.Replace("&", "%26");

                                }

                                string PostData = "&orig=GLHD&pageKey=voltron_company_search_internal_jsp&search=Search&openFacets=N,CCR,JO&page_num=" + s + "&pt=companies";
                                string Responses = HttpHelper.postFormData(new Uri(posturl), PostData);

                                //Temporosy code for client
                                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Comp Scpr Pagesource 2 >>>> " + Responses, Globals.Path_LinkedinCompanyScrapperPagesource);

                                List<string> lstCompanyURLs = GettingAllUrlswithCompanyFilter(Responses);

                                if (lstCompanyURLs.Count == 0)
                                {
                                    lstCompanyURLs = GettingAllUrlswithCompanyFilter(Responses);
                                }

                                // call to GetDataFromCompanyURL
                                GetDataFromCompanyURL(ref HttpHelper, lstCompanyURLs);

                                int aa = s;

                            }
                            catch { }

                        }
                    }
                    catch
                    {
                    }
                }

                string getsize = string.Empty;
                //obj_NewHireexcel.WritedataIntoExcel(Workbooks, Workbook, ComapanyName, link, industry, companysize, website, Founded, DateTime.Now.ToString(), Token1, Token2, Token3, Token4, starttime.ToString());
                try
                {
                    // getsize = companysize.Replace("employees", string.Empty).Trim();
                }
                catch { }
            }
            catch { }
            Log("[ " + DateTime.Now + " ] => [ " +  "PROCESS COMPLETED With UserName : "******" ]");
        }