private void StartLinkedInCompanySearch()
        {
            try
            {
                if (IsStop_InBoardProGetDataThread)
                {
                    return;
                }

                lstInBoardProGetDataThraed.Add(Thread.CurrentThread);
                lstInBoardProGetDataThraed = lstInBoardProGetDataThraed.Distinct().ToList();
                Thread.CurrentThread.IsBackground = true;

                HttpHelper = new GlobusHttpHelper();
                LinkedinSearch objlinkscrCompanyFilter = new LinkedinSearch();
                bool isLoggedIn = Login_InBoardProGetData();

                LinkedinSearch._Search = "CompaniesWithFilter";

                //AddLoggerScrapeUsers("[ " + DateTime.Now + " ] => [ Start LinkedIn Crawling ]");

                if (isLoggedIn)
                {
                    AddLoggerScrapeUsers("[ " + DateTime.Now + " ] => [ Start LinkedIn Crawling ]");
                    objlinkscrCompanyFilter.StartLinkedInSearch(ref HttpHelper);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error >>> " + ex.StackTrace);
            }
            finally
            {
                try
                {
                    this.Invoke(new MethodInvoker(delegate
                    {
                        btnStopScraper.Enabled = true;
                        btnSearchScraper.Enabled = true;
                        btnSearchScraper.Cursor = Cursors.Default;
                    }));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
            }
        }
예제 #2
0
        private void StartLinkedinSearch()
        {
            try
            {
                #region Check condition Thread is Stop or Not

                if (_IsStop_LinkedinSearch)
                {
                    return;
                }

                lstLinkedinSearchThraed.Add(Thread.CurrentThread);
                lstLinkedinSearchThraed = lstLinkedinSearchThraed.Distinct().ToList();
                Thread.CurrentThread.IsBackground = true;

                #endregion

                //foreach (KeyValuePair<string, LinkedInMaster> item in LinkedInManager.linkedInDictionary)
                {
                    try
                    {
                        if (Globals.scrapeWithoutLoggingIn)
                        {

                        }

                        if (SearchCriteria.SignIN)
                        {
                            LinkedinLogin Login = new LinkedinLogin();
                            //For Sign Out
                            Login.LogoutHttpHelper();

                            SearchCriteria.SignOut = true;
                        }
                        //Run a separate thread for each account

                        if (SearchCriteria.SignOut)
                        {
                            LinkedInMaster item = null;
                            LinkedInManager.linkedInDictionary.TryGetValue(_LinkedinSearchSelectedEmailId, out item);

                            if (rdbLinkedinSearchKeyword.Checked)
                            {
                                //AddLoggerLinkedinSearch("[ " + DateTime.Now + " ] => [ Please Wait Login In With UserName >>> " + _LinkedinSearchSelectedEmailId + " ]");
                                item.LoginHttpHelper(ref HttpHelper);

                                if (item.IsLoggedIn)
                                {
                                    if (SearchCriteria.loginREsponce.Contains("[ " + DateTime.Now + " ] => [ Your LinkedIn account has been temporarily restricted ]"))
                                    {
                                        AddLoggerLinkedinSearch("[ " + DateTime.Now + " ] => [ " + _LinkedinSearchSelectedEmailId + "Your LinkedIn account has been temporarily restricted ]");

                                        if (rdbLinkedinSearchKeyword.Checked)
                                        {
                                            return;
                                        }
                                    }

                                    if (SearchCriteria.loginREsponce.Contains("Please confirm your email address"))
                                    {
                                        AddLoggerLinkedinSearch("[ " + DateTime.Now + " ] => [ " + _LinkedinSearchSelectedEmailId + " account has been temporarily restricted Please confirm your email address ]");

                                        if (rdbLinkedinSearchKeyword.Checked)
                                        {
                                            return;
                                        }
                                    }
                                    SearchCriteria.SignIN = true;
                                    SearchCriteria.SignOut = false;
                                    if (item.IsLoggedIn)
                                    {
                                        AddLoggerLinkedinSearch("[ " + DateTime.Now + " ] => [ Logged in Successfully With UserName >>> " + _LinkedinSearchSelectedEmailId + " ]");
                                    }
                                    else
                                    {
                                        AddLoggerLinkedinSearch("[ " + DateTime.Now + " ] => [ Couldn't Login   With UserName >>> " + _LinkedinSearchSelectedEmailId + " ]");
                                    }
                                }
                                else
                                {
                                    AddLoggerLinkedinSearch("[ " + DateTime.Now + " ] => [ Couldn't Login With UserName >>> " + _LinkedinSearchSelectedEmailId + " ]");
                                    return;
                                }
                            }

                            if (rdbLinkedinSearchKeyword.Checked)
                            {
                                AddLoggerLinkedinSearch("[ " + DateTime.Now + " ] => [ Keyword Search Process Starting..... ]");
                            }
                            if (rdbLinkedinSearchURL.Checked)
                            {
                                AddLoggerLinkedinSearch("[ " + DateTime.Now + " ] => [ Profile Search Process Starting..... ]");
                            }

                            InBoardProGetData.LinkedinSearch obj_LinkedinSearch = new InBoardProGetData.LinkedinSearch(item._Username, item._Password, item._ProxyAddress, item._ProxyPort, item._ProxyUsername, item._ProxyPassword);

                            SearchCriteria.LoginID = item._Username;

                            if (_IsKeyword_LinkedinSearch)
                            {
                                obj_LinkedinSearch._RdbKeyword = true;
                                obj_LinkedinSearch._RdbURL = false;
                            }
                            if (_IsProfileURL_LinkedinSearch)
                            {
                                obj_LinkedinSearch._RdbKeyword = false;
                                obj_LinkedinSearch._RdbURL = true;
                            }

                            obj_LinkedinSearch.logger.addToLogger += new EventHandler(LinkedinSearchLogEvents_addToLogger);

                            obj_LinkedinSearch.StartLinkedInSearch(ref HttpHelper);

                            obj_LinkedinSearch.logger.addToLogger -= new EventHandler(LinkedinSearchLogEvents_addToLogger);
                        }
                    }
                    catch
                    {
                    }
                }
            }
            catch
            {
            }
            finally
            {
                btnLinkedinSearch.Invoke(new MethodInvoker(delegate
                {
                    AddLoggerLinkedinSearch("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                    AddLoggerLinkedinSearch("------------------------------------------------------------------------------------------------------------------------------------");
                    btnLinkedinSearch.Cursor = Cursors.Default;
                }));
            }
        }
        private void StartCompanyEmployeeSearch()
        {
            if (IsStop_CompanyEmployeeScraperThread)
            {
                return;
            }

            lstCompanyEmployeeScraperThread.Add(Thread.CurrentThread);
            lstCompanyEmployeeScraperThread = lstCompanyEmployeeScraperThread.Distinct().ToList();
            Thread.CurrentThread.IsBackground = true;

            HttpHelper = new GlobusHttpHelper();
            LinkedinSearch objlinkscrCompanyFilter = new LinkedinSearch();
            bool isLoggedIn = Login_InBoardProGetData();

            if (rdbCompanyEmployeeScraperKeyword.Checked)
            {
                rdbCompanyEmployeeScraperKeyword.Checked = false;
                //AddLoggerCompanyEmployeeSearch("[ " + DateTime.Now + " ] => [ Search Through Keyword ]");
                //_IsKeyword_CompanyEmployeeScraper = true;
                //objlinkscrCompanyFilter._RdbCompanyEmployeeSearchKeyword = true;
                //InBoardPro.LinkedinSearch._Keyword = txtCompanyEmployeeScraperKeyword.Text;
            }

            if (!(rdbCompnayEmployeeScraperURL.Checked))
            {
                rdbCompnayEmployeeScraperURL.Checked = true;
                AddLoggerCompanyEmployeeSearch("[ " + DateTime.Now + " ] => [ Search Through Url ]");
                _IsProfileURL_CompanyEmployeeScraper = true;
                objlinkscrCompanyFilter._RdbCompanyEmployeeSearchURL = true;
            }

            LinkedinSearch._Search = "CompanyEmployeeSearch";
            if (isLoggedIn)
            {
                AddLoggerCompanyEmployeeSearch("[ " + DateTime.Now + " ] => [ Start LinkedIn Crawling ]");
                objlinkscrCompanyFilter.StartLinkedInSearch(ref HttpHelper);
            }
        }