public void chekLicense()
        {
            #region FreeTrial
            try
            {

                ChilkatHttpHelpr objCjilkatHttpHelper = new ChilkatHttpHelpr();
                string strdateTime_DataBase = ("2016-02-06 23:59:59").ToString();// string strdateTime_DataBase = ("2016-02-04 23:59:59").ToString();

                DateTime dt = DateTime.Parse(strdateTime_DataBase);
                strdateTime_DataBase = dt.ToString("yyyy-MM-dd hh:mm:ss");

                string dateTime = objCjilkatHttpHelper.GetHtml("http://licensing.facedominator.com/licensing/FD/Datetime.php");

                DateTime dt_now = DateTime.Parse(dateTime);

                TimeSpan dt_Difference = dt_now.Subtract(dt);

                if (dt_Difference.Days >= 1)
                {
                    //ModernDialog.ShowMessage("Your Trial Version of Software Has Been Expired!!","Warning Message",MessageBoxButton.OK,this.OwnedWindows);  
                    MessageBox.Show("Your Trial Version of Software Has Been Expired!!");
                    mainFormReference.Close();
                    return;
                }
                

            }
            catch { }
            #endregion
        }
        public static string GetUserIDFromUsername(string username, out string Status)
        {
            string GetStatus = string.Empty;
            Globussoft.GlobusHttpHelper httpHelper = new Globussoft.GlobusHttpHelper();

            clsDBQueryManager DB = new clsDBQueryManager();
            DataSet ds = DB.GetUserId(username);
            string user_id = string.Empty;

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dataRow in ds.Tables["tb_UsernameDetails"].Rows)
                {
                    user_id = dataRow.ItemArray[0].ToString();
                    Status = "No Error";
                    return user_id;
                }
            }


            try
            {
                string id = string.Empty;

                ChilkatHttpHelpr httpHelper1 = new ChilkatHttpHelpr();
                string pagesource = httpHelper1.GetHtml("https://api.twitter.com/1/users/show.xml?screen_name=" + username);

                if (!pagesource.Contains("Rate limit exceeded. Clients may not make more than 150 requests per hour.") && !pagesource.Contains("Sorry, that page does not exist") && !pagesource.Contains("User has been suspended"))
                {
                    int length = pagesource.IndexOf("</id>");
                    id = pagesource.Substring(pagesource.IndexOf("<id>"), length - pagesource.IndexOf("<id>")).Replace("<id>", "");
                    user_id = id;
                    GetStatus = "No Error";
                }
                else if (pagesource.Contains("Rate limit exceeded. Clients may not make more than 150 requests per hour."))
                {
                    GetStatus = "Rate limit exceeded";
                }
                else if (pagesource.Contains("Sorry, that page does not exist"))
                {
                    GetStatus = "Sorry, that page does not exist";
                }
                else if (pagesource.Contains("User has been suspended"))
                {
                    GetStatus = "User has been suspended";
                }
            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetUserIDFromUsername() -- " + username + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetUserIDFromUsername() -- " + username + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
                GetStatus = "Error";
            }
            Status = GetStatus;
            return user_id;
        }
        public string CreateBoard_new(string BoardName, string Category, ref PinInterestUser objPinUser)
        {
            try
            {
                string Checking = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com/settings/"));
                string ScreenName = objPinUser.ScreenName; //ObjAccountManager.Getscreen_NameRepin(ref objPinUser);
                if (Checking.Contains("profileName"))
                {
                }
                else
                {
                    ObjAccountManager.LoginPinterestAccount(ref objPinUser);
                }
                string redirectDomain = GlobusHttpHelper.valueURl.Split('.')[0];
                string newHomePageUrl = redirectDomain + "." + "pinterest.com";

                if (!string.IsNullOrEmpty(Checking))
                {
                    ChilkatHttpHelpr objChilkatHttpHelpr = new ChilkatHttpHelpr();

                    //string newpostdata = "source_url=%2F" + ScreenName + "%2F&data=%7B%22options%22%3A%7B%22name%22%3A%22" + (BoardName.Replace(" ", "+")) + "%22%2C%22category%22%3A%22other%22%2C%22description%22%3A%22%22%2C%22privacy%22%3A%22public%22%2C%22layout%22%3A%22default%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App()%3EUserProfilePage(resource%3DUserResource(username%3D" + ScreenName + "%2C+invite_code%3Dnull))%3EUserProfileContent(resource%3DUserResource(username%3D" + objPinUser.ScreenName + "%2C+invite_code%3Dnull))%3EUserBoards()%3EGrid(resource%3DProfileBoardsResource(username%3D" + ScreenName + "))%3EGridItems(resource%3DProfileBoardsResource(username%3D" + ScreenName + "))%3EBoardCreateRep(ga_category%3Dboard_create%2C+text%3DCreate+a+board%2C+submodule%3D%5Bobject+Object%5D)%23Modal(module%3DBoardCreate())";
                    string newpostdata = "source_url=%2F" + ScreenName + "%2F&data=%7B%22options%22%3A%7B%22name%22%3A%22" + (BoardName.Replace(" ", "+")) + "%22%2C%22category%22%3A%22other%22%2C%22description%22%3A%22%22%2C%22privacy%22%3A%22public%22%2C%22layout%22%3A%22default%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EUserProfilePage%3EUserProfileContent%3EUserBoards%3EGrid%3EGridItems%3EBoardCreateRep(ga_category%3Dboard_create%2C+text%3DCreate+a+board%2C+submodule%3D%5Bobject+Object%5D)%23App%3EModalManager%3EModal(showCloseModal%3Dtrue%2C+mouseDownInModal%3Dfalse)";
                    string PostUrlBoard = redirectDomain + ".pinterest.com/resource/BoardResource/create/";
                    try
                    {
                        CreatedBoardPageSource = objPinUser.globusHttpHelper.postFormDataProxyPin(new Uri(PostUrlBoard), newpostdata, newHomePageUrl);
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                    }

                    if (CreatedBoardPageSource.Contains("error\": null"))
                    {
                        if (newpostdata.Contains("You already have a board with that name."))
                        {
                            GlobusLogHelper.log.Info(" => [ You already have a board with this name. " + BoardName + " For " + objPinUser.Username + " ]");
                            return null;
                        }
                        try
                        {
                            string ModuleName = "AddBoardName";
                            string Status = "Board_Created";
                            QueryManager qm = new QueryManager();
                            qm.insertAccRePort(objPinUser.Username, ModuleName, "", BoardName, "", "", "", "", Status, "", "", DateTime.Now);
                            //qm.insertBoard_AddBoardName(objPinUser.Username, ModuleName, BoardName, Status);
                            objDelegateAccountReport();
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Info(" => [ Board Created " + BoardName + " ]");
                            return null;
                        }
                        
                        GlobusLogHelper.log.Info(" => [ Successfully Created Board " + BoardName + " For " + objPinUser.Username + " ]");
                        string BoardId = objAddNewPinManager.GetBoardId_Board(BoardName, ref objPinUser);//GetBoardId(BoardName, ref pinterestAccountManager);
                        return BoardId;

                    }
                    else if (CreatedBoardPageSource.Contains("You have a board with this name."))
                    {
                        GlobusLogHelper.log.Info(" => [ You already have a board with this name. " + BoardName + " For " + objPinUser.Username + " ]");
                        string BoardId = objAddNewPinManager.GetBoardId_Board(BoardName, ref objPinUser);
                        return BoardId;
                    }
                    else
                    {
                        GlobusLogHelper.log.Info(" => [ Board Creation Process Failed " + BoardName + " ]");
                        return CreatedBoardPageSource;
                    }
                }
                else
                {
                    GlobusLogHelper.log.Info(" => [ Login Issue " + " For " + objPinUser.Username + " ]");
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Info(" => [ Board Creation Process Failed " + BoardName + " ]");
                return null;
            }
            return null;
        }
        public List<string> ExtractFriendIDs_URLSpecific(ref GlobusHttpHelper HttpHelper, ref string userID, string specificURL, ref List<string> lstFriend_Suggestions)
        {
            try
            {
                string pgSrc_HomePage = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/"));
                string ProFileURL = string.Empty;

                string UserId = string.Empty;

                #region Get User or Account ID
                if (pgSrc_HomePage.Contains("http://www.facebook.com/profile.php?id="))
                {
                    ///Modified Sumit [10-12-2011]
                    #region

                    int startIndx = pgSrc_HomePage.IndexOf("http://www.facebook.com/profile.php?id=");
                    int endIndx = pgSrc_HomePage.IndexOf("\"", startIndx + 1);
                    ProFileURL = pgSrc_HomePage.Substring(startIndx, endIndx - startIndx);
                    if (ProFileURL.Contains("&"))
                    {
                        string[] Arr = ProFileURL.Split('&');
                        ProFileURL = Arr[0];
                    }

                    #endregion
                }
                if (ProFileURL.Contains("http://www.facebook.com/profile.php?id="))
                {
                    UserId = ProFileURL.Replace("http://www.facebook.com/profile.php?id=", "");
                    if (UserId.Contains("&"))
                    {
                        UserId = UserId.Remove(UserId.IndexOf("&"));
                    }
                    //userID = UserId;
                }
                #endregion

                List<string> lstFriend_Requests = new List<string>();
                //List<string> lstFriend_Suggestions = new List<string>();

                string pgSrc_FriendsPage = HttpHelper.getHtmlfromUrl(new Uri(specificURL));

                ChilkatHttpHelpr chilkatHelpr = new ChilkatHttpHelpr();

                //List<string> aTags = chilkatHelpr.GetDataTag(pgSrc_FriendsPage, "a");

                //List<string> spanTags = chilkatHelpr.GetDataTag(pgSrc_FriendsPage, "span");

                List<string> requestProfileURLs_FR_Requests = chilkatHelpr.GetHrefsByTagAndAttributeName(pgSrc_FriendsPage, "span", "title fsl fwb fcb");
                lstFriend_Requests.AddRange(requestProfileURLs_FR_Requests);

                List<string> requestProfileURLs_FR_Suggestions = chilkatHelpr.GetElementsbyTagAndAttributeName(pgSrc_FriendsPage, "div", "title fsl fwb fcb", "id");
                lstFriend_Suggestions.AddRange(requestProfileURLs_FR_Suggestions);

                #region Old Code

                //if (pgSrc_FriendsPage.Contains("http://www.facebook.com/profile.php?id="))
                //{
                //    string[] arr = Regex.Split(pgSrc_FriendsPage, "href");
                //    foreach (string strhref in arr)
                //    {
                //        if (!strhref.Contains("<!DOCTYPE"))
                //        {
                //            if (strhref.Contains("profile.php?id"))
                //            {
                //                int startIndx = strhref.IndexOf("profile.php?id") + "profile.php?id".Length + 1;
                //                int endIndx = strhref.IndexOf("\"", startIndx);

                //                string profileID = strhref.Substring(startIndx, endIndx - startIndx);

                //                if (profileID.Contains("&"))
                //                {
                //                    profileID = profileID.Remove(profileID.IndexOf("&"));
                //                }
                //                if (profileID.Contains("\\"))
                //                {
                //                    profileID = profileID.Replace("\\", "");
                //                }
                //                lstFriend.Add(profileID);
                //            }
                //        }
                //    }
                //} 
                #endregion
                List<string> itemId = lstFriend_Requests.Distinct().ToList();
                return itemId;
            }
            catch (Exception)
            {
                return null;
            }
        }
Example #5
0
        public static void RequestJSCSSIMG(string pageSource, ref Chilkat.Http http)
        {
            ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };

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

            ChilkatHttpHelpr HttpHelper = new ChilkatHttpHelpr();


            //CSS Request
            foreach (string item in GetHrefsFromString(pageSource))
            {
                if (item.Contains(".css"))
                {
                    string cssSource = item.Replace(" ", "").Trim();
                    try
                    {
                        //string res = HttpHelper.GetHtmlProxy(cssSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                        listURLs.Add(cssSource);
                    }
                    catch (Exception)
                    {
                        Thread.Sleep(500);
                        try
                        {
                            string res = HttpHelper.GetHtmlProxy(cssSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
            }

            //JS Request
            string[] scriptArr = Regex.Split(pageSource, "/script>");
            foreach (string item in scriptArr)
            {
                try
                {
                    if (item.Contains("static.ak.") || item.Contains("profile.ak."))
                    {
                        int    startIndx = item.LastIndexOf("src=") + "src=".Length + 1;
                        int    endIndx   = item.IndexOf(">", startIndx) - 1;
                        string jsSource  = item.Substring(startIndx, endIndx - startIndx);
                        //if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak."))
                        if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak.") || jsSource.StartsWith("http://profile.ak.") || jsSource.StartsWith("https://profile.ak.") || jsSource.StartsWith("http://s-profile.ak.") || jsSource.StartsWith("https://s-profile.ak."))
                        {
                            try
                            {
                                //string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                                listURLs.Add(jsSource);
                            }
                            catch (Exception)
                            {
                                Thread.Sleep(500);
                                try
                                {
                                    string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                                }
                                catch (Exception)
                                {
                                }
                            }
                        }
                    }
                }
                catch (Exception)
                {
                }
            }

            string[] moreScriptArray = Regex.Split(pageSource, "\"src\":");
            foreach (string item in moreScriptArray)
            {
                try
                {
                    int    startIndx = 1;
                    int    endIndx   = item.IndexOf("\"", startIndx);
                    string jsSource  = item.Substring(startIndx, endIndx - startIndx).Replace("\\", "");
                    if (jsSource.Contains(".js"))
                    {
                        //string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                        listURLs.Add(jsSource);
                    }
                }
                catch (Exception)
                {
                }
            }

            ///IMG Request
            string[] imageArr = Regex.Split(pageSource, "<img");
            foreach (string item in imageArr)
            {
                try
                {
                    if (item.Contains("static.ak.") || item.Contains("profile.ak."))
                    {
                        int    startIndx = item.IndexOf("src=") + "src=".Length + 1;
                        int    endIndx   = item.IndexOf("\"", startIndx + 1);
                        string jsSource  = item.Substring(startIndx, endIndx - startIndx);
                        //if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak."))
                        if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak.") || jsSource.StartsWith("http://profile.ak.") || jsSource.StartsWith("https://profile.ak.") || jsSource.StartsWith("http://s-profile.ak.") || jsSource.StartsWith("https://s-profile.ak."))
                        {
                            if (jsSource.Contains(".png") || jsSource.Contains(".gif") || jsSource.Contains(".jpg") || jsSource.Contains(".jpeg"))
                            {
                                try
                                {
                                    //string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                                    listURLs.Add(jsSource);
                                }
                                catch (Exception)
                                {
                                    Thread.Sleep(500);
                                    try
                                    {
                                        string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                                    }
                                    catch (Exception)
                                    {
                                    }
                                }
                            }
                        }
                    }
                }
                catch { };
            }

            listURLs = listURLs.Distinct().ToList();
            foreach (string item in listURLs)
            {
                try
                {
                    string res = HttpHelper.GetHtmlProxy(item, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);
                }
                catch { };
            }
        }
Example #6
0
        public void DataParserAjax(string response, ref FacebookUser fbUser)
        {
            try
            {
                try
                {
                    string Response = response;
                    ChilkatHttpHelpr objChilkat = new ChilkatHttpHelpr();

                    string FirstPgaeName = string.Empty;
                    string SecondPgaeName = string.Empty;
                    string otherPgaeName = string.Empty;



                    string PageTitle = string.Empty;
                    string PageTitleLink = string.Empty;

                    string SourceTitle = string.Empty;
                    string SourceTitleLink = string.Empty;

                    string memberCount = string.Empty;

                    string FirstPgaeNameLink = string.Empty;
                    string SecondPgaeNameLink = string.Empty;
                    string otherPgaeNameLink = string.Empty;

                    string likerData = string.Empty;
                    string SecondlikerData = string.Empty;
                    string ThirdlikerData = string.Empty;


                    bool MemberPage = false;
                    Response = Response.Replace("\\", "").Replace("u003C", "<");

                    string[] DataList = System.Text.RegularExpressions.Regex.Split(Response, "<div class=\"");
                    foreach (string item2 in DataList)
                    {

                        #region Title

                        if (item2.Contains("&quot;title&quot"))
                        {
                            List<string> hrefLink = objChilkat.GetHrefFromString(item2);

                            try
                            {

                                string titleData = item2.Substring(item2.IndexOf("\"><a") + 5);
                                string DataPage = GetSbstringData(titleData, "\">", "<");

                                PageTitle = DataPage;
                                PageTitleLink = hrefLink[0].ToString();


                            }
                            catch { };


                        }



                        #endregion


                        #region GroupSource

                        if (item2.Contains("quot;sub_headers&quot"))
                        {
                            List<string> hrefLink = objChilkat.GetHrefFromString(item2);

                            try
                            {

                                string titleData = item2.Substring(item2.IndexOf("\"><a") + 5);
                                string DataPage = GetSbstringData(titleData, "\">", "<");

                                SourceTitle = DataPage;
                                if (hrefLink.Count() > 0)
                                {
                                    SourceTitleLink = hrefLink[0].ToString();
                                }


                            }
                            catch { };


                        }



                        #endregion


                        # region Memebers
                        if (item2.Contains("members") && item2.Count() < 150 && MemberPage == false)
                        {
                            MemberPage = true;
                            try
                            {
                                string MemeberData = GetSbstringData(item2, "\">", "<").Replace("members", "").Replace(",", "");
                                memberCount = MemeberData;
                            }
                            catch { };


                        }
                        #endregion


                    }

                    string Username = string.Empty;
                    if (!string.IsNullOrEmpty(PageTitle))
                    {
                        string data = PageTitleLink.Substring(0, PageTitleLink.IndexOf("?"));

                        Username = data.Split('/')[3];

                        // Username = PageTitle + " : " + PageTitleLink;
                    }


                    string Likes = string.Empty;
                    if (!string.IsNullOrEmpty(FirstPgaeName))
                    {
                        //Likes ="Likes "+ FirstPgaeName + " : " + FirstPgaeNameLink;
                        Likes = "Likes " + FirstPgaeNameLink;
                    }
                    if (!string.IsNullOrEmpty(SecondPgaeName))
                    {
                        // Likes = Likes + " and " + SecondPgaeName + " : " + SecondPgaeNameLink;
                        Likes = Likes + " and " + SecondPgaeNameLink;
                    }
                    if (!string.IsNullOrEmpty(otherPgaeName))
                    {
                        // Likes = Likes + " and " + otherPgaeName + " : " + otherPgaeNameLink;
                        Likes = Likes + " and " + otherPgaeNameLink;
                    }



                    if (Username.Count() > 5)
                    {
                        try
                        {
                            string FollowerData = string.Empty;
                            string FileData = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\FBScraperGroupData\\SearchUrlUserId.txt";
                            if (!File.Exists(FileData))
                            {
                                try
                                {
                                    string DataHeader = " UserId " + "\t" + " Likes " + "\t" + " Studied In " + " \\t " + " Listens " + " \\t " + "Followers" + "\\t " + "Watches";

                                    GlobusFileHelper.AppendStringToTextfileNewLine(DataHeader, exportFilePathAccountVerification + "\\NoOptionForConfirmationEmailResend.txt");
                                }
                                catch { };
                            }

                            //string Data = MainUrl + "\t" + Username.Replace(",", "") + "\t" + Likes.Replace(",", "") + "\t" + studyData.Replace(",", "") + "\t" + Listens.Replace(",", "") + "\t" + FollowerData.Replace(",", "") + " \\t " + Watches.Replace(",", "");



                            //AppendStringToTextFileNewLine(Data, FileData);
                        }
                        catch { };
                    }


                }
                catch { };



            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }
Example #7
0
        public static void RequestJSCSSIMG(string pageSource, ref Chilkat.Http http)
        {
            ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
            List<string> listURLs = new List<string>();
            ChilkatHttpHelpr HttpHelper = new ChilkatHttpHelpr();

            //CSS Request
            foreach (string item in GetHrefsFromString(pageSource))
            {
                if (item.Contains(".css"))
                {
                    string cssSource = item.Replace(" ", "").Trim();
                    try
                    {
                        //string res = HttpHelper.GetHtmlProxy(cssSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                        listURLs.Add(cssSource);
                    }
                    catch (Exception)
                    {
                        Thread.Sleep(500);
                        try
                        {
                            string res = HttpHelper.GetHtmlProxy(cssSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
            }

            //JS Request
            string[] scriptArr = Regex.Split(pageSource, "/script>");
            foreach (string item in scriptArr)
            {
                try
                {
                    if (item.Contains("static.ak.") || item.Contains("profile.ak."))
                    {
                        int startIndx = item.LastIndexOf("src=") + "src=".Length + 1;
                        int endIndx = item.IndexOf(">", startIndx) - 1;
                        string jsSource = item.Substring(startIndx, endIndx - startIndx);
                        //if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak."))
                        if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak.") || jsSource.StartsWith("http://profile.ak.") || jsSource.StartsWith("https://profile.ak.") || jsSource.StartsWith("http://s-profile.ak.") || jsSource.StartsWith("https://s-profile.ak."))
                        {
                            try
                            {
                                //string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                                listURLs.Add(jsSource);
                            }
                            catch (Exception)
                            {
                                Thread.Sleep(500);
                                try
                                {
                                    string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                                }
                                catch (Exception)
                                {
                                }
                            }
                        }
                    }
                }
                catch (Exception)
                {
                }
            }

            string[] moreScriptArray = Regex.Split(pageSource, "\"src\":");
            foreach (string item in moreScriptArray)
            {
                try
                {
                    int startIndx = 1;
                    int endIndx = item.IndexOf("\"", startIndx);
                    string jsSource = item.Substring(startIndx, endIndx - startIndx).Replace("\\", "");
                    if (jsSource.Contains(".js"))
                    {
                        //string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                        listURLs.Add(jsSource);
                    }
                }
                catch (Exception)
                {
                }
            }

            ///IMG Request
            string[] imageArr = Regex.Split(pageSource, "<img");
            foreach (string item in imageArr)
            {
                try
                {
                    if (item.Contains("static.ak.") || item.Contains("profile.ak."))
                    {
                        int startIndx = item.IndexOf("src=") + "src=".Length + 1;
                        int endIndx = item.IndexOf("\"", startIndx + 1);
                        string jsSource = item.Substring(startIndx, endIndx - startIndx);
                        //if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak."))
                        if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak.") || jsSource.StartsWith("http://profile.ak.") || jsSource.StartsWith("https://profile.ak.") || jsSource.StartsWith("http://s-profile.ak.") || jsSource.StartsWith("https://s-profile.ak."))
                        {
                            if (jsSource.Contains(".png") || jsSource.Contains(".gif") || jsSource.Contains(".jpg") || jsSource.Contains(".jpeg"))
                            {
                                try
                                {
                                    //string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                                    listURLs.Add(jsSource);
                                }
                                catch (Exception)
                                {
                                    Thread.Sleep(500);
                                    try
                                    {
                                        string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                                    }
                                    catch (Exception)
                                    {
                                    }
                                }
                            }
                        }
                    }
                }
                catch { };
            }

            listURLs = listURLs.Distinct().ToList();
            foreach (string item in listURLs)
            {
                try
                {
                    string res = HttpHelper.GetHtmlProxy(item, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);
                }
                catch { };
            }
        }
        public void getpageSourceFromProxy(object item)
        {
            if (proxyStop)
                return;
            try
            {
                Thread.CurrentThread.IsBackground = true;
                lstProxyThread.Add(Thread.CurrentThread);
                lstProxyThread = lstProxyThread.Distinct().ToList();
            }
            catch { }

            countParseProxiesThreads++;

            Array Item_value = (Array)item;
            string ClGlobul_ProxyList_item = (string)Item_value.GetValue(0);          
            Globussoft.GlobusHttpHelper GlobusHttpHelper = new Globussoft.GlobusHttpHelper();
            ChilkatHttpHelpr objchilkat = new ChilkatHttpHelpr();
            string proxyad = string.Empty;
            string proxyport = string.Empty;
            string proxyusername = string.Empty;
            string proxyPassword = string.Empty;
            string pagesource1 = string.Empty;
            string pagesource = string.Empty;


            try
            {
                string[] proxyLst = ClGlobul_ProxyList_item.Split(':');
                if (proxyLst.Count() > 3)
                {
                    proxyad = proxyLst[0];
                    proxyport = proxyLst[1];
                    proxyusername = proxyLst[2];
                    proxyPassword = proxyLst[3];
                }
                else if (proxyLst.Count() > 0 && proxyLst.Count() < 3)
                {
                    proxyad = proxyLst[0];
                    proxyport = proxyLst[1];
                }
                else
                {
                    return;
                }

                try
                {
                    if (proxyStop)
                        return;

                    pagesource1 = GlobusHttpHelper.getHtmlfromUrlProxy(new Uri(IGGlobals.Instance.IGWEPME), proxyad, Convert.ToInt16(proxyport), proxyusername, proxyPassword);
                }
                catch { };

                if (string.IsNullOrEmpty(pagesource1))
                {
                    pagesource1 = string.Empty;
                    // pagesource1 = GlobusHttpHelper.getHtmlfromUrlProxy(new Uri("http://web.stagram.com/"), proxyad, Convert.ToInt32(proxyport), proxyusername, proxyPassword);
                    pagesource1 = objchilkat.GetHtmlProxy(IGGlobals.Instance.IGWEPME, proxyad, (proxyport), proxyusername, proxyPassword);
                }
                if (pagesource1.Contains("Access Denied"))
                {
                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Proxy Is not Working : " + proxyad + ":" + proxyport + ":" + proxyusername + ":" + proxyPassword + " ]");
                }


                //int FirstPointClientId = pagesource1.IndexOf("client_id=");
                //string FirstClientIdSubString = pagesource1.Substring(FirstPointClientId);
                //int SecondPointClientId = FirstClientIdSubString.IndexOf("&redirect_uri=");
                //string ClientId = FirstClientIdSubString.Substring(0, SecondPointClientId).Replace("'", string.Empty).Replace("client_id=", string.Empty).Trim();

                //string LoginUrl = "https://instagram.com/accounts/login/?next=/oauth/authorize/%3Fclient_id%3D" + ClientId + "%26redirect_uri%3Dhttp%253A%252F%252Fweb.stagram.com%252F%26response_type%3Dcode%26scope%3Dlikes%2Bcomments%2Brelationships";

                //pagesource = GlobusHttpHelper.getHtmlfromUrlProxy(new Uri(LoginUrl), proxyad, Convert.ToInt16(proxyport), proxyusername, proxyPassword);

                //if (string.IsNullOrEmpty(pagesource))
                //{
                //    pagesource = string.Empty;
                //    pagesource = GlobusHttpHelper.getHtmlfromUrlProxy(new Uri(LoginUrl), proxyad, Convert.ToInt16(proxyport), proxyusername, proxyPassword);
                //}

                //ADD in List list of Finally chacked.....
                if (!string.IsNullOrEmpty(pagesource1))
                {
                    if (proxyStop)
                        return;
                    addInFinalCheckedProxyist(proxyad, proxyport, proxyusername, proxyPassword, pagesource1);
                }
                else
                {
                    if (proxyStop)
                        return;
                    ClGlobul.isProxyCheckComplete = true;
                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Proxy Is not Working : " + proxyad + ":" + proxyport + ":" + proxyusername + ":" + proxyPassword + " ]");
                    lock (lockerforNonWorkingProxies)
                    {
                        GlobusFileHelper.AppendStringToTextfileNewLine(proxyad + ":" + proxyport + ":" + proxyusername + ":" + proxyPassword, GlobusFileHelper.NonWorkingProxiesList);
                    }
                }

            }
            catch (Exception)
            {
                if (proxyStop)
                    return;
                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Proxy Is not Working : " + proxyad + ":" + proxyport + ":" + proxyusername + ":" + proxyPassword + " ]");

                lock (lockerforNonWorkingProxies)
                {
                    GlobusFileHelper.AppendStringToTextfileNewLine(proxyad + ":" + proxyport + ":" + proxyusername + ":" + proxyPassword, GlobusFileHelper.NonWorkingProxiesList);
                }
            }
            finally
            {

                lock (lockerforProxies)
                {
                    countParseProxiesThreads--;
                    Monitor.Pulse(lockerforProxies);
                }
                Proxystatus--;
                if (Proxystatus == 0)
                {
                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                    GlobusLogHelper.log.Info("-----------------------------------------------------------------------------------------------------------------------------------");
                }
            }

        }
Example #9
0
        public void LoginWithChilkatHelper(ref ChilkatHttpHelpr HttpHelper1)
        {
            try
            {

                ChilkatHttpHelpr HttpHelper = HttpHelper1;

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

                if (pageSrcLogin.Contains("redirectUrl\":\"https://www.linkedin.com/nhome/"))
                {
                    pageSrcLogin = HttpHelper.GetHtml("https://www.linkedin.com/nhome/");
                }

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

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

                    }

                }

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

                    }

                }
                catch { }

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

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

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

                }
                catch { }

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

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

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

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

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

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

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

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

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

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

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

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

                    }
                    catch { }
                }
                else if (ResLogin.Contains("logout?session_full_logout"))
                {
                    SearchCriteria.loginREsponce = string.Empty;
                    IsLoggedIn = true;
                    //string Search = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/search?trk=advsrch"));
                    //SearchCriteria.loginREsponce = Search;

                }
                else if (ResLogin.Contains("Sign-In Verification"))
                {
                    Log("[ " + DateTime.Now + " ] => [ Verification required : " + accountUser + " ]");
                }
                else if (ResLogin.Contains("Your LinkedIn account has been temporarily restricted"))
                {
                    Log("[ " + DateTime.Now + " ] => [ Your LinkedIn account : " + accountUser + " has been temporarily restricted ]");
                    //GlobusFileHelper.WriteStringToTextfile(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.path_FailLogin);
                }
                else
                {
                    Log("[ " + DateTime.Now + " ] => [ NotLogged In With Account : " + accountUser + " ]");
                    GlobusFileHelper.WriteStringToTextfile(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.path_FailLogin);
                }

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

                //LogoutHttpHelper(ref HttpHelper);

                //Url = "http://www.linkedin.com/home?trk=hb_tab_home_top";
                //pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, 888, proxyUserName, proxyPassword);
                #endregion
            }
            catch (Exception ex)
            {
                Log("[ " + DateTime.Now + " ] => [ NotLogged In With Account : " + accountUser + " ]");
                GlobusFileHelper.WriteStringToTextfile(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.path_FailLogin);
            }
        }
        public List<string> GetTweetData_Scrape(string keyword, out string returnStatus)
        {
            string status = string.Empty;
            List<string> lst_TweetIDs = new List<string>();
            try
            {
                string user_id = string.Empty;

                #region old code
                //if (!NumberHelper.ValidateNumber(keyword))
                //{
                //    user_id = GetUserIDFromUsername(keyword);
                //}
                //else
                //{
                //    user_id = keyword;
                //}

                //if (!string.IsNullOrEmpty(user_id))
                //{
                //screen_name  
                #endregion

                string searchURL = string.Empty;
                if (NumberHelper.ValidateNumber(keyword))
                {
                    searchURL = "https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&id=" + keyword + "&count=" + TweetExtractCount;
                }
                else
                {
                    searchURL = "https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=" + keyword + "&count=" + TweetExtractCount;
                }
                //string res_Get_searchURL = globushttpHelper.getHtmlfromUrl(new Uri(searchURL), "", "");
                ChilkatHttpHelpr HttpHelper = new ChilkatHttpHelpr();
                string res_Get_searchURL = HttpHelper.GetHtml(searchURL);

                if (!res_Get_searchURL.Contains("Rate limit exceeded") && !res_Get_searchURL.Contains("Sorry, that page does not exist") && !res_Get_searchURL.Contains("Not authorized") && res_Get_searchURL.Contains("created_at") && !string.IsNullOrEmpty(res_Get_searchURL))
                {
                    string[] splitRes = Regex.Split(res_Get_searchURL, "{\"created_at");//Regex.Split(res_Get_searchURL, "{\"created_at\"");
                    splitRes = splitRes.Skip(1).ToArray();

                    foreach (string item in splitRes)
                    {
                        //string text = Globussoft.GlobusHttpHelper.ParseJson(modified_Item, "<text>");
                        string Tweet = Globussoft.GlobusHttpHelper.ParseJson(item, "text");//Globussoft.GlobusHttpHelper.parseText(item);
                        string data = keyword + ":" + Tweet;
                        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(data, Globals.Path_TweetExtractor);
                        lst_TweetIDs.Add(data);
                    }
                    status = "No Error";
                }
                else if (res_Get_searchURL.Contains("Rate limit exceeded"))
                {
                    status = "Rate limit exceeded";
                }
                else if (res_Get_searchURL.Contains("Sorry, that page does not exist"))
                {
                    status = "Sorry, that page does not exist";
                }
                else if (res_Get_searchURL.Contains("Not authorized"))
                {
                    status = "Not Authorized";
                }
                else if (string.IsNullOrEmpty(res_Get_searchURL))
                {
                    status = "Not Authorized";
                }
                else
                {
                    status = "Empty";
                }
            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetTweetData_Scrape() -- " + keyword + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetTweetData_Scrape() -- " + keyword + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
                status = "Error";
            }
            returnStatus = status;
            return lst_TweetIDs;
        }
        public static string GetPhotoFromUsername(string username)
        {
            //Globussoft.GlobusHttpHelper httpHelper = new Globussoft.GlobusHttpHelper();
            ChilkatHttpHelpr httpHelper = new ChilkatHttpHelpr();

            string user_id = string.Empty;
            string containsImage = "false";
            try
            {
                string ImageLink = string.Empty;
                string PageSource = string.Empty;
                //http://a0.twimg.com/sticky/default_profile_images/default_profile_0_normal.png
                if (!string.IsNullOrEmpty(username) && NumberHelper.ValidateNumber(username))
                {
                    //PageSource = httpHelper.getHtmlfromUrl(new Uri("https://api.twitter.com/1/users/show.xml?user_id=" + username + "&include_entities=true"), "", "");
                    PageSource = httpHelper.GetHtml("https://api.twitter.com/1/users/show.xml?user_id=" + username + "&include_entities=true");
                }
                else
                {
                    //PageSource = httpHelper.getHtmlfromUrl(new Uri("https://api.twitter.com/1/users/show.xml?screen_name=" + username + "&include_entities=true"), "", "");
                    PageSource = httpHelper.GetHtml("https://api.twitter.com/1/users/show.xml?screen_name=" + username + "&include_entities=true");
                }

                if (!string.IsNullOrEmpty(PageSource))
                {
                    try
                    {
                        int indexStart = PageSource.IndexOf("<profile_image_url>");
                        if (PageSource.Contains("<profile_image_url>"))
                        {
                            string start = PageSource.Substring(indexStart);
                            int endIndex = start.IndexOf("</profile_image_url>");
                            string end = start.Substring(0, endIndex);
                            ImageLink = end.Replace("<profile_image_url>", "");
                        }

                        if (!string.IsNullOrEmpty(ImageLink) && ImageLink.Contains("/sticky/default_profile_images/default_profile"))
                        {
                            containsImage = "false";
                        }
                        else if (PageSource.Contains("Sorry, that page does not exist"))
                        {
                            containsImage = "false";
                        }
                        else
                        {
                            containsImage = "true";
                        }
                    }
                    catch (Exception ex)
                    {
                        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetPhotoFromUsername() -- " + username + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetPhotoFromUsername() -- " + username + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
                    }
                }
                else if (PageSource.Contains("Clients may not make more than 150 requests per hour") && PageSource.Contains("Rate limit exceeded"))
                {
                    containsImage = "Rate limit exceeded";
                }
            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetPhotoFromUsername() -- " + username + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetPhotoFromUsername() -- " + username + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
            }

            return containsImage;
        }
        /// <summary>
        /// Checks the status of the CPUID from Database
        /// If status is Active, MainFrm starts
        /// </summary>
        public bool ValidateCPUID(ref string statusMessage, string servr, ref string username,ref string Password , ref string txnID, string freeTrialKey, string cpuID,ref string Email)
        {
            //string cpuID = getCPUID();
            try
            {
              
                #region Drct
                //string cpuID = FetchMacId();
                //string SelectQuery = "Select * from users where cpuid='" + cpuID + "'";
                //DataSet ds = DataBaseHandler.SelectQuery(SelectQuery, "users");
                //if (ds.Tables[0].Rows.Count == 1)
                //{
                //    string status = ds.Tables[0].Rows[0]["status"].ToString();
                //    if (status.ToLower() == "active")
                //    {
                //        statusMessage = "active";
                //        return true;
                //    }
                //    else if (status.ToLower() == "nonactive")
                //    {
                //        statusMessage = "nonactive";
                //        return false;
                //    }
                //    else if (status.ToLower() == "suspended")
                //    {
                //        statusMessage = "suspended";
                //        return false;
                //    }
                //}

                #endregion

                #region Through php

               
                //string cpuID = FetchMacId();
                //ChilkatHttpHelpr HttpHelpr = new ChilkatHttpHelpr();
                HttpHelpr = new ChilkatHttpHelpr();

                #region Servr 1
                {
                    string res = string.Empty;
                    res = HttpHelpr.GetHtml("http://" + servr + "/GetUserData.php?cpid=" + cpuID + "");
                   
                    if (string.IsNullOrEmpty(res))
                    {
                        System.Threading.Thread.Sleep(1000);
                        res = HttpHelpr.GetHtml("http://" + servr + "/releases/GetUserData.php?cpid=" + cpuID + "");
                    }



                    if (!string.IsNullOrEmpty(res))
                    {
                        string activationstatus = string.Empty;
                        string dateTime = string.Empty;
                  
                        string trimmed_response = res.Replace("<pre>", "").Replace("</pre>", "").Trim().ToLower();

                        string[] array_status = System.Text.RegularExpressions.Regex.Split(trimmed_response, "<:>");
                        try
                        {
                            activationstatus = array_status[0].ToLower();
                        }
                        catch { }
                        try
                        {
                            dateTime = array_status[1].ToLower();
                        }
                        catch { }
                        try
                        {
                            username = array_status[2].ToLower();
                        }
                        catch { }
                        try
                        {
                            Password = array_status[3].ToLower();
                        }
                        catch { };

                        try
                        {
                            txnID = array_status[4].ToLower();
                        }
                        catch { }
                        try
                        {
                            Email = array_status[5].ToLower();
                        }
                        catch { };

                        try
                        {
                            if (txnID.Contains("freetrial"))
                            {
                                Globals.Licence_Details = username + ":" + dateTime + "&" + "FreeTrial" + "";
                            }
                            else
                            {
                                Globals.Licence_Details = username + ":" + dateTime + "&" + "Full Version" + "";
                            }
                        }
                        catch { }

                        if (trimmed_response.ToLower().Contains(freeTrialKey) && ((activationstatus.ToLower() == "active") || (activationstatus.ToLower() == "nonactive")))
                        {
                            
                        

                            if (CheckActivationUpdateStatus(cpuID, dateTime, activationstatus, servr))
                            {
                                statusMessage = "active";
                                return true;
                            }
                            else
                            {
                                statusMessage = "trialexpired";
                                return false;
                            }

                            if (activationstatus.ToLower() == "active")
                            {
                                statusMessage = "active";
                                return true;
                            }
                            else//else if (activationstatus.ToLower() == "nonactive")
                            {
                                //Update status as Active
                                string updateRes = HttpHelpr.GetHtml("http://" + servr + "/UpdateStatus.php?cpid=" + cpuID + "&status=" + "Active");
                                if (string.IsNullOrEmpty(updateRes))
                                {
                                    System.Threading.Thread.Sleep(1000);
                                    updateRes = HttpHelpr.GetHtml("http://" + servr + "/UpdateStatus.php?cpid=" + cpuID + "&status=" + "Active");
                                }
                                MessageBox.Show("Your Free Version is Activated");
                                return true;
                            }

                     
                            

                           
                        }
                        else if (activationstatus.ToLower() == "active")
                        {
                            statusMessage = "active";
                          
                            return true;
                            // DisableControls();
                        }
                        else if (activationstatus.ToLower() == "nonactive")
                        {
                            statusMessage = "nonactive";
                          
                            MessageBox.Show("Verification of your txn is under process.\n Please wait for your Transaction to be verified.\n Please Contact To Support Team to activate your license,   Skype Id Is :- Facedominatorsupport");
                            return false;
                            //DisableControls();
                        }
                        else if (trimmed_response.Contains("trialexpired"))
                        {
                            statusMessage = "trialexpired";
                            MessageBox.Show("Your 3 Days Trial Version has Expired. Please visit our site: facedominator.com to purchase your License");
                            return false;
                        }
                        else if (trimmed_response.ToLower() == "suspended")
                        {
                            statusMessage = "suspended";
                            return false;
                        }
                        else if (trimmed_response.Contains("no record found"))
                        {
                            statusMessage = "norecordfound";
                            return false;
                        }
                        else
                        {
                            statusMessage = "Some Error in Licensing Server";
                            return false;
                        }

                    }
                    else
                    {
                        statusMessage = "ServerDown";
                        return false;
                    }
                }
                #endregion
                #endregion
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                statusMessage = "Error in License Validation";
                MessageBox.Show(ex.StackTrace);
            }
            return false;
        }
        public string RegisterUser(string Username, string Password, string cpuID, string TransactionID, string Email, string servr)
        {
            ChilkatHttpHelpr HttpHelpr = new ChilkatHttpHelpr();
            string res = string.Empty;
            try
            {
                string regUrl = "http://" + servr + "/register.php?user="******"&pass="******"&cpid=" + cpuID + "&transid=" + TransactionID + "&email=" + Email + "";
                res = HttpHelpr.GetHtml("http://" + servr + "/register.php?user="******"&pass="******"&cpid=" + cpuID + "&transid=" + TransactionID + "&email=" + Email + "");

                if (string.IsNullOrEmpty(res))
                {
                    System.Threading.Thread.Sleep(1000);
                    res = HttpHelpr.GetHtml("http://" + servr + "/register.php?user="******"&pass="******"&cpid=" + cpuID + "&transid=" + TransactionID + "&email=" + Email + "");
                }

                if (string.IsNullOrEmpty(res))
                {
                    MessageBox.Show("Error Connecting to Facedominator Server,Please check if www.facedominator.com is opening for you.");
                   // Application.Exit();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return res;
        }
Example #14
0
        public List<string> ExtractRequestSendFriendIDs_URLSpecific(ref GlobusHttpHelper HttpHelper, ref string userID, string specificURL, ref List<string> lstFriend_Suggestions)
        {
            try
            {
                string pgSrc_HomePage = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/"));
                string ProFileURL = string.Empty;

                string UserId = string.Empty;

                #region Get User or Account ID
                if (pgSrc_HomePage.Contains("http://www.facebook.com/profile.php?id="))
                {
                    ///Modified Sumit [10-12-2011]
                    #region

                    int startIndx = pgSrc_HomePage.IndexOf("http://www.facebook.com/profile.php?id=");
                    int endIndx = pgSrc_HomePage.IndexOf("\"", startIndx + 1);
                    ProFileURL = pgSrc_HomePage.Substring(startIndx, endIndx - startIndx);
                    if (ProFileURL.Contains("&"))
                    {
                        string[] Arr = ProFileURL.Split('&');
                        ProFileURL = Arr[0];
                    }

                    #endregion
                }
                if (ProFileURL.Contains("http://www.facebook.com/profile.php?id="))
                {
                    UserId = ProFileURL.Replace("http://www.facebook.com/profile.php?id=", "");
                    if (UserId.Contains("&"))
                    {
                        UserId = UserId.Remove(UserId.IndexOf("&"));
                    }
                    //userID = UserId;
                }
                #endregion

                List<string> lstFriend_Requests = new List<string>();
                //List<string> lstFriend_Suggestions = new List<string>();

                string pgSrc_FriendsPage = HttpHelper.getHtmlfromUrl(new Uri(specificURL));

                ChilkatHttpHelpr chilkatHelpr = new ChilkatHttpHelpr();

                //List<string> aTags = chilkatHelpr.GetDataTag(pgSrc_FriendsPage, "a");

                //List<string> spanTags = chilkatHelpr.GetDataTag(pgSrc_FriendsPage, "span");

                List<string> requestProfileURLs_FR_Requests = chilkatHelpr.GetHrefsByTagAndAttributeName(pgSrc_FriendsPage, "span", "title fsl fwb fcb");
                lstFriend_Requests.AddRange(requestProfileURLs_FR_Requests);

                List<string> requestProfileURLs_FR_Suggestions = chilkatHelpr.GetElementsbyTagAndAttributeName(pgSrc_FriendsPage, "div", "title fsl fwb fcb", "id");
                lstFriend_Suggestions.AddRange(requestProfileURLs_FR_Suggestions);

                #region Old Code

                if (pgSrc_FriendsPage.Contains("data-profileid="))
                {
                    string[] arr = Regex.Split(pgSrc_FriendsPage, "data-profileid=");
                    foreach (string strhref in arr)
                    {
                        if (!strhref.Contains("<!DOCTYPE"))
                        {
                                string profileID=Utils.getBetween(strhref, "\"", "\"");
                                lstFriend_Requests.Add(profileID);
                           
                        }
                    }
                } 
                #endregion
                int Count = 0;
                if (pgSrc_FriendsPage.Contains("pager_id="))
                {
                    string Pager_ID = Utils.getBetween(pgSrc_FriendsPage, "pager_id=", "\"");
                    string page = Utils.getBetween(pgSrc_FriendsPage, "more/?page=", "&amp;");
                    while (true)
                    {
                        Count = Count + 1;
                        pgSrc_FriendsPage = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/friends/requests/outgoing/more/?page=" + page + "&page_size=10&pager_id=" + Pager_ID + "&__user="******"&__a=1&__dyn=7n8ahyj35zoSt2u6aAix90BCxO4oKAdBGfirWo8pojByUW5ogxd6K4bBxi&__req=b&__rev=1398717"));
                        if (!pgSrc_FriendsPage.Contains("pager_id=") || page == "6" || Count>=5)
                        {
                            break;
                        }
                        Pager_ID = Utils.getBetween(pgSrc_FriendsPage, "pager_id=", "\\\"");
                        page = Utils.getBetween(pgSrc_FriendsPage, "more\\/?page=", "&amp;");

                        if (pgSrc_FriendsPage.Contains("data-profileid="))
                        {
                            string[] arr = Regex.Split(pgSrc_FriendsPage, "data-profileid=");
                            arr = arr.Skip(1).ToArray();
                            foreach (string strhref in arr)
                            {
                                if (!strhref.Contains("for("))
                                {
                                    string profileID = Utils.getBetween(strhref, "\\\"", "\\\"");
                                    lstFriend_Requests.Add(profileID);

                                }
                            }
                        } 
                    }
                }
                List<string> itemId = lstFriend_Requests.Distinct().ToList();
                return itemId;
            }
            catch (Exception)
            {
                return null;
            }
        }
        public List<string> GetRetweetData_Scrape(string keyword, out string returnStatus)
        {
            string status = string.Empty;
            List<string> lst_ReTweetIDs = new List<string>();
            try
            {
                string searchURL = string.Empty;

                if (!NumberHelper.ValidateNumber(keyword))
                {
                    searchURL = "https://api.twitter.com/1/statuses/retweeted_by_user.xml?screen_name=" + keyword + "&count=" + RetweetExtractcount + "&include_entities=true";
                }
                else if (NumberHelper.ValidateNumber(keyword))
                {
                    searchURL = "https://api.twitter.com/1/statuses/retweeted_by_user.xml?id=" + keyword + "&count=" + RetweetExtractcount + "&include_entities=true";
                }

                //string res_Get_searchURL = globushttpHelper.getHtmlfromUrl(new Uri(searchURL), "", "");
                ChilkatHttpHelpr HttpHelper = new ChilkatHttpHelpr();
                string res_Get_searchURL = HttpHelper.GetHtml(searchURL);

                if (!res_Get_searchURL.Contains("Rate limit exceeded") && !res_Get_searchURL.Contains("Sorry, that page does not exist") && res_Get_searchURL.Contains("created_at") && !string.IsNullOrEmpty(res_Get_searchURL))
                {
                    string[] splitRes = Regex.Split(res_Get_searchURL, "<status>");//Regex.Split(res_Get_searchURL, "{\"created_at\"");
                    splitRes = splitRes.Skip(1).ToArray();

                    foreach (string item in splitRes)
                    {
                        string Tweet = string.Empty;
                        string Tweeter = string.Empty;
                        try
                        {
                            int startIndex = item.IndexOf("<text>");
                            string start = item.Substring(startIndex);
                            int endIndex = start.IndexOf("</text>");
                            string end = start.Substring(0, endIndex);
                            Tweet = end.Replace("<text>", "");

                            int startOfInndex = Tweet.IndexOf(":");
                            Tweeter = Tweet.Substring(0, startOfInndex);
                            Tweet = Tweet.Replace(Tweeter, "");
                        }
                        catch (Exception ex)
                        {
                            Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetRetweetData_Scrape() -- " + keyword + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                            Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetRetweetData_Scrape() -- " + keyword + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
                        }

                        string data = keyword + ":" + Tweeter + ":" + Tweet.Replace(":", "^");
                        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(data, Globals.Path_RETweetExtractor);
                        lst_ReTweetIDs.Add(data);
                    }
                }
                else if (res_Get_searchURL.Contains("Rate limit exceeded"))
                {
                    status = "Rate limit exceeded";
                }
                else if (res_Get_searchURL.Contains("Sorry, that page does not exist"))
                {
                    status = "Sorry, that page does not exist";
                }
                else if (res_Get_searchURL.Contains("Not authorized"))
                {
                    status = "Not Authorized";
                }
                else if (string.IsNullOrEmpty(res_Get_searchURL))
                {
                    status = "Not Authorized";
                }
                else
                {
                    status = "Empty";
                }
            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetRetweetData_Scrape() -- " + keyword + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetRetweetData_Scrape() -- " + keyword + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
                status = "Error";
            }
            returnStatus = status;
            return lst_ReTweetIDs;
        }
        private void CrawlingPageDataSource(string Url, ref GlobusHttpHelper HttpHelper)
        {
            //if (SearchCriteria.starter)
            {
                // if (SearchCriteria.starter)
                {
                    try
                    {
                        //  Log("Start Parsing Process");

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

                        string titleCurrenttitle = string.Empty;
                        string titleCurrenttitle2 = string.Empty;
                        string titleCurrenttitle3 = string.Empty;
                        string titleCurrenttitle4 = string.Empty;
                        string Skill = string.Empty;
                        string TypeOfProfile = "Public1";

                        string Finaldata = string.Empty;
                        #endregion

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

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

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

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

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

                        html = htmlUtil.EntityDecode(html);

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

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

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

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

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

                        #endregion

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

                        //new parshing code

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

                        xBeginSearchAfter = null;

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

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

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

                            Grouplist.Add(Finaldata);

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

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

                        }

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

                            }

                        }
                        #endregion

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

                        Skilllst.Clear();
                        xBeginSearchAfter = null;

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

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

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

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

                        }

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

                        Skilllst.Distinct();
                        #endregion

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

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

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

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

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

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

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

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

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

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

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

                        #region Getting Industry
                        try
                        {

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

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

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

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

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

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

                        #endregion

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

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

                            }

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

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

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

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

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

                        #endregion

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

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

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

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

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

                            }

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

                        #endregion

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

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

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

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

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

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

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

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

                        list.Clear();

                        #endregion

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

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

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

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

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

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

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

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

                                    }

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

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

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

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

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

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

                            }
                        }
                        catch { };

                        list.Clear();
                        #endregion

                        string companyCurrenttitle1 = string.Empty;

                        string companyCurrenttitle2 = string.Empty;

                        string companyCurrenttitle3 = string.Empty;

                        string companyCurrenttitle4 = string.Empty;

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

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

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

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

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

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

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

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

                                    }

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

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

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

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

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

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

                            }
                        }
                        catch { };

                        list.Clear();
                        #endregion

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

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

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

                        catch { };

                        list.Clear();
                        #endregion

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

                        if (LDS_FinalData.Contains("<strong class=\"highlight\"") || LDS_FinalData.Contains("<span class=\"full-name\"") || LDS_FinalData.Contains("<strong class=\"highlight\"") || LDS_FinalData.Contains("overview-connections\">"))
                        {
                            LDS_FinalData = LDS_FinalData.Replace("<span class=\"full-name\"", "").Replace("\n", "").Replace("<strong class=\"highlight\"", "").Replace("overview-connections\">", "").Replace("</strong>", "").Replace("<strong>", "");
                        }
                        if (!string.IsNullOrEmpty(LDS_FirstName) || !string.IsNullOrEmpty(LDS_FirstName))
                        {
                            //Log(LDS_FinalData);
                        }
                        // if (SearchCriteria.starter)
                        {
                            if (!string.IsNullOrEmpty(LDS_FirstName) || !string.IsNullOrEmpty(LDS_FirstName))
                            {
                                try
                                {
                                    // if (status.Contains("LinkedinSearch_ProfileData"))
                                    {
                                        try
                                        {
                                            string CSVHeader = "ProfileType" + "," + "UserProfileLink" + "," + "FirstName" + "," + "LastName" + "," + "PostalCode" + "," + "Distance From Postal" + "," + "HeadLineTitle" + "," + "CurrentTitle " + "," + "Company" + "," + "Connection" + "," + "Recommendations " + "," + "SkillAndExpertise " + "," + "Experience " + "," + " Education" + "," + "Groups" + "," + "UserEmail" + "," + "UserContactNumber" + "," + "PastTitles" + "," + "PastCompany" + "," + "Location" + "," + "Country" + "," + "Industry" + "," + "WebSites" + "," + "LinkedInLoginID" + ",";
                                            string CSV_Content = LDS_ProfileType.Replace(",", ";") + "," + LDS_UserProfileLink.Replace(",", ";") + "," + LDS_FirstName.Replace(",", ";") + "," + LDS_LastName.Replace(",", ";") + "," + postalCode + "," + distance + "," + LDS_HeadLineTitle.Replace(",", ";") + "," + LDS_CurrentTitle.Replace(",", ";") + "," + LDS_CurrentCompany.Replace(",", ";") + "," + LDS_Connection.Replace(",", ";") + "," + LDS_Recommendations.Replace(",", ";") + "," + LDS_SkillAndExpertise.Replace(",", ";") + "," + LDS_Experience.Replace(",", ";") + "," + LDS_Education.Replace(",", ";") + "," + LDS_Groups.Replace(",", ";") + "," + LDS_UserEmail.Replace(",", ";") + "," + LDS_UserContactNumber.Replace(",", ";") + "," + LDS_PastTitles.Replace(",", ";") + "," + LDS_PastCompany.Replace(",", ";") + "," + LDS_Loction.Replace(",", ";") + "," + LDS_Country.Replace(",", ";") + "," + LDS_Industry.Replace(",", ";") + "," + LDS_Websites.Replace(",", ";") + "," + accountUser.Replace(",", ";") + ",";
                                            CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_InBoardProGetDataResultUrlData);
                                            Log("[ " + DateTime.Now + " ] => [ Record Saved In CSV File ! ]");
                                        }
                                        catch
                                        {
                                        }

                                    }
                                    // else
                                    //{
                                    //    try
                                    //    {
                                    //       // AppFileHelper.AddingLinkedInDataToCSVFile(LDS_FinalData, Globals.path_LinkedinSearchSearchByPeople);
                                    //        string CSVHeader = "ProfileType" + "," + "UserProfileLink" + "," + "FirstName" + "," + "LastName" + "," + "PostalCode" + "," + "Distance From Postal" + "," + "HeadLineTitle" + "," + "CurrentTitle " + "," + "Company" + "," + "Connection" + "," + "Recommendations " + "," + "SkillAndExpertise " + "," + "Experience " + "," + " Education" + "," + "Groups" + "," + "UserEmail" + "," + "UserContactNumber" + "," + "PastTitles" + "," + "PastCompany" + "," + "Location" + "," + "Country" + "," + "Industry" + "," + "WebSites" + "," + "LinkedinLogInID" + ",";
                                    //        string CSV_Content = LDS_ProfileType.Replace(",", ";") + "," + LDS_UserProfileLink.Replace(",", ";") + "," + LDS_FirstName.Replace(",", ";") + "," + LDS_LastName.Replace(",", ";") + "," + postalCode + "," + distance + "," + LDS_HeadLineTitle.Replace(",", ";") + "," + LDS_CurrentTitle.Replace(",", ";") + "," + LDS_CurrentCompany.Replace(",", ";") + "," + LDS_Connection.Replace(",", ";") + "," + LDS_Recommendations.Replace(",", ";") + "," + LDS_SkillAndExpertise.Replace(",", ";") + "," + LDS_Experience.Replace(",", ";") + "," + LDS_Education.Replace(",", ";") + "," + LDS_Groups.Replace(",", ";") + "," + LDS_UserEmail.Replace(",", ";") + "," + LDS_UserContactNumber.Replace(",", ";") + "," + LDS_PastTitles.Replace(",", ";") + "," + LDS_PastCompany.Replace(",", ";") + "," + LDS_Loction.Replace(",", ";") + "," + LDS_Country.Replace(",", ";") + "," + LDS_Industry.Replace(",", ";") + "," + LDS_Websites.Replace(",", ";") + "," + accountUser.Replace(",", ";") + ",";
                                    //        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_LinkedinSearchSearchByPeople);
                                    //        Log("Record Saved In CSV File !");

                                    //        //string CSVHeader = "ProfileType" + "," + "UserProfileLink" + "," + "FirstName" + "," + "LastName" + "," + "HeadLineTitle" + "," + "CurrentTitle " + "," + "Company" + "," + "Connection" + "," + "Recommendations " + "," + "SkillAndExpertise " + "," + "Experience " + "," + " Education" + "," + "Groups" + "," + "UserEmail" + "," + "UserContactNumber" + "," + "PastTitles" + "," + "PastCompany" + "," + "Location" + "," + "Country" + "," + "Industry" + "," + "WebSites" + "," + "LinkedinLogInID" + ",";

                                    //        //string CSV_Content = TypeOfProfile + "," + LDS_UserProfileLink + "," + firstname + "," + lastname + "," + Company.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + companycurrent.Replace(",", ";") + "," + Connection.Replace(",", ";") + "," + recomandation.Replace(",", string.Empty) + "," + Skill.Replace(",", ";") + "," + LDS_Experience.Replace(",", string.Empty) + "," + EducationCollection.Replace(",", ";") + "," + groupscollectin.Replace(",", ";") + "," + USERemail.Replace(",", ";") + "," + LDS_UserContact.Replace(",", ";") + "," + LDS_PastTitles + "," + AllComapny.Replace(",", ";") + "," + country.Replace(",", ";") + "," + location.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + Website.Replace(",", ";") + "," + LDS_LoginID + ",";// +TypeOfProfile + ",";

                                    //        //string CSVHeader = "ProfileType" + "," + "UserProfileLink" + "," + "FirstName" + "," + "LastName" + "," + "PostalCode" + "," + "Distance From Postal" + "," + "HeadLineTitle" + "," + "CurrentTitle " + "," + "Company" + "," + "Connection" + "," + "Recommendations " + "," + "SkillAndExpertise " + "," + "Experience " + "," + " Education" + "," + "Groups" + "," + "UserEmail" + "," + "UserContactNumber" + "," + "PastTitles" + "," + "PastCompany" + "," + "Location" + "," + "Country" + "," + "Industry" + "," + "WebSites" + "," + "LinkedinLogInID" + ",";
                                    //        //string CSV_Content = TypeOfProfile + "," + LDS_UserProfileLink + "," + firstname + "," + lastname + "," + postalCode + "," + distance + "," + Company.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + companycurrent.Replace(",", ";") + "," + Connection.Replace(",", ";") + "," + recomandation.Replace(",", string.Empty) + "," + Skill.Replace(",", ";") + "," + LDS_Experience.Replace(",", string.Empty) + "," + EducationCollection.Replace(",", ";") + "," + groupscollectin.Replace(",", ";") + "," + USERemail.Replace(",", ";") + "," + LDS_UserContact.Replace(",", ";") + "," + LDS_PastTitles + "," + AllComapny.Replace(",", ";") + "," + country.Replace(",", ";") + "," + location.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + Website.Replace(",", ";") + "," + accountUser + ",";// +TypeOfProfile + ",";
                                    //        //CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_InBoardProGetDataResultUrlData);//path_LinkedinSearchSearchByProfileURL);
                                    //        //Log("Data Saved In CSV File !");
                                    //    }
                                    //    catch
                                    //    {
                                    //    }
                                    //}
                                }
                                catch
                                {
                                }

                            }
                        }

                    }
                    catch (Exception ex) { };

                }

            }
        }
        public string GetUserLastTweetDate(string userid)
        {
            string date = "";

            try
            {
                string user_id = string.Empty;

                string searchURL = string.Empty;

                if (!NumberHelper.ValidateNumber(userid))
                {
                    searchURL = "https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&id=" + user_id + "&count=" + TweetExtractCount;
                }
                else if (NumberHelper.ValidateNumber(userid))
                {
                    searchURL = "https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=" + user_id + "&count=" + TweetExtractCount;
                }

                //string searchURL = "https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&id=" + user_id + "&count=" + TweetExtractCount;
                ChilkatHttpHelpr httpHelper = new ChilkatHttpHelpr();
                //string res_Get_searchURL = globushttpHelper.getHtmlfromUrl(new Uri(searchURL), "", "");
                string res_Get_searchURL = httpHelper.GetHtml(searchURL);

                string[] splitRes = Regex.Split(res_Get_searchURL, "{\"created_at");//Regex.Split(res_Get_searchURL, "{\"created_at\"");
                splitRes = splitRes.Skip(1).ToArray();

                foreach (string item in splitRes)
                {
                    //string text = Globussoft.GlobusHttpHelper.ParseJson(modified_Item, "<text>");
                    string modified_Item = "{\"created_at" + item;

                    date = Globussoft.GlobusHttpHelper.ParseJson(modified_Item, "created_at");//Globussoft.GlobusHttpHelper.parseText(item);
                    if (date.Contains("+"))
                    {
                        date = date.Remove(date.IndexOf("+")).Trim();
                    }
                    if (!string.IsNullOrEmpty(date))
                    {
                        return date;
                    }
                }
            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetUserLastTweetDate() -- " + userid + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetUserLastTweetDate() -- " + userid + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
            }

            return date;
        }
        public string Login()
        {
            Log("[ " + DateTime.Now + " ] => [ Logging in with Account : " + Username + " ]");
            string Status = "Failed";
            try
            {
                string firstUrl = "https://api.instagram.com/oauth/authorize/?client_id=9d836570317f4c18bca0db6d2ac38e29&redirect_uri=http://websta.me/&response_type=code&scope=comments+relationships+likes";

                //https://instagram.com/oauth/authorize/?client_id=9d836570317f4c18bca0db6d2ac38e29&redirect_uri=http://websta.me/&response_type=code&scope=comments+relationships+likes

                string secondURL = "https://instagram.com/oauth/authorize/?client_id=9d836570317f4c18bca0db6d2ac38e29&redirect_uri=http://websta.me/&response_type=code&scope=comments+relationships+likes";
                string res_secondURL = string.Empty;
                ChilkatHttpHelpr objchilkat = new ChilkatHttpHelpr();
                if (!string.IsNullOrEmpty(proxyAddress) && !string.IsNullOrEmpty(proxyPort))
                {
                    try
                    {
                        //res_secondURL = httpHelper.getHtmlfromUrlProxy(new Uri(secondURL), proxyAddress, int.Parse(proxyPort), proxyUsername, proxyPassword);
                        res_secondURL = objchilkat.GetHtmlProxy(secondURL, proxyAddress, proxyPort, proxyUsername, proxyPassword);
                    }
                    catch { };

                }
                else
                {

                    res_secondURL = httpHelper.getHtmlfromUrl(new Uri(secondURL), "");

                }

                //string authlogin = "******";
                //string res_nextUrl1 = httpHelper.getHtmlfromUrl(new Uri(authlogin), "");
                string nextUrl = string.Empty;
                string res_nextUrl = string.Empty;

                if (!string.IsNullOrEmpty(res_secondURL))
                {
                    nextUrl = "https://instagram.com/accounts/login/?force_classic_login=&next=/oauth/authorize/%3Fclient_id%3D9d836570317f4c18bca0db6d2ac38e29%26redirect_uri%3Dhttp%3A//websta.me/%26response_type%3Dcode%26scope%3Dcomments%2Brelationships%2Blikes";

                    res_nextUrl = httpHelper.getHtmlfromUrl(new Uri(nextUrl), "");//postFormDataProxy
                }
                else
                {
                    Log("[ " + DateTime.Now + " ] => [ Logged in Failed with Account :" + Username + " ]");
                    Status = "Failed";
                    this.LoggedIn = false;
                }

                //string nextUrl = "https://instagram.com/accounts/login/?force_classic_login=&next=/oauth/authorize/%3Fclient_id%3D9d836570317f4c18bca0db6d2ac38e29%26redirect_uri%3Dhttp%3A//websta.me/%26response_type%3Dcode%26scope%3Dcomments%2Brelationships%2Blikes";

                //string res_nextUrl = httpHelper.getHtmlfromUrl(new Uri(nextUrl), "");//postFormDataProxy

                //int FirstPointToken_nextUrl1 = res_nextUrl.IndexOf("authorize");
                //string FirstTokenSubString_nextUrl1 = res_nextUrl.Substring(FirstPointToken_nextUrl1);
                //int SecondPointToken_nextUrl1 = FirstTokenSubString_nextUrl1.IndexOf("%");
                //this.Token = FirstTokenSubString_nextUrl1.Substring(0, SecondPointToken_nextUrl1).Replace("Authorize", string.Empty).Replace("value=", string.Empty).Replace("\"", string.Empty).Replace("'", string.Empty).Trim();

                try
                {
                    int FirstPointToken_nextUrl = res_nextUrl.IndexOf("csrfmiddlewaretoken");//csrfmiddlewaretoken
                    string FirstTokenSubString_nextUrl = res_nextUrl.Substring(FirstPointToken_nextUrl);
                    int SecondPointToken_nextUrl = FirstTokenSubString_nextUrl.IndexOf("/>");
                    this.Token = FirstTokenSubString_nextUrl.Substring(0, SecondPointToken_nextUrl).Replace("csrfmiddlewaretoken", string.Empty).Replace("value=", string.Empty).Replace("\"", string.Empty).Replace("'", string.Empty).Trim();
                }
                catch { };

                string login = "******";
               //string authlogin=  "******";

                //string postauthorize = "csrfmiddlewaretoken=" + this.Token + "&allow=Authorize";
                //http://websta.me/?code=90786edc0a4844b79a3d9289d27360d5

                string postdata_Login = "******" + this.Token + "&username="******"&password="******"";

                string res_postdata_Login = httpHelper.postFormData(new Uri(login), postdata_Login, login, "");

                string autho = "https://instagram.com/oauth/authorize/?scope=comments+likes+relationships&redirect_uri=http%3A%2F%2Fwww.gramfeed.com%2Foauth%2Fcallback%3Fpage%3D&response_type=code&client_id=b59fbe4563944b6c88cced13495c0f49";

                if (res_postdata_Login.Contains("Please enter a correct username and password"))
                {
                    Status = "Failed";
                    this.LoggedIn = false;
                }
                else if (res_postdata_Login.Contains("requesting access to your Instagram account") || postdata_Login.Contains("is requesting to do the following"))
                {
                    Status = "AccessIssue";
                }
                else if (res_postdata_Login.Contains("logout") || postdata_Login.Contains("LOG OUT"))
                {
                    Log("[ " + DateTime.Now + " ] => [ Logged in with Account :" + Username + " ]");
                    Status = "Success";
                    this.LoggedIn = true;
                }

                //nameval.Clear();
                return Status;
            }
            catch (Exception ex)
            {
                return ex.Message;

            }
        }
        public List<string> GetFollowings(string userID, out string ReturnStatus)
        {
            try
            {
                string FollowingUrl = string.Empty;
                if (NumberHelper.ValidateNumber(userID))
                {
                    FollowingUrl = "https://api.twitter.com/1/following/ids.json?cursor=-1&id=" + userID + "";//"https://api.twitter.com/1/following/ids.json?cursor=-1&screen_name=SocioPro";
                }
                else
                {
                    FollowingUrl = "https://api.twitter.com/1/following/ids.json?cursor=-1&screen_name=" + userID + "";//"https://api.twitter.com/1/following/ids.json?cursor=-1&screen_name=SocioPro";
                }

                ChilkatHttpHelpr HttpHelper = new ChilkatHttpHelpr();
                string Data = HttpHelper.GetHtml(FollowingUrl);//.getHtmlfromUrl(new Uri(FollowingUrl), "", "");

                if (!Data.Contains("Rate limit exceeded"))
                {
                    int FirstPoint = Data.IndexOf("[");
                    int SecondPoint = Data.IndexOf("]");

                    string FollowingIds = Data.Substring(FirstPoint, SecondPoint - FirstPoint).Replace("[", string.Empty).Replace("]", string.Empty);

                    List<string> lstIds = FollowingIds.Split(',').ToList();

                    ReturnStatus = "No Error";
                    return lstIds;
                }
                else
                {
                    ReturnStatus = "Error";
                    return new List<string>();
                }
            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetFollowings() -- " + userID + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetFollowings() -- " + userID + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
                ReturnStatus = "Error";
                return new List<string>();
            }
        }
        public string UpdateWebSiteData(string Id,string Url)
        {
            WebSiteReviewDataRpository _WebSiteReviewDataRpository = new WebSiteReviewDataRpository();
            websitereviewdata _WebSiteReviewData = new websitereviewdata();
            _WebSiteReviewData = _WebSiteReviewDataRpository.getinfoforupdate(Guid.Parse(Id), Url);
            if (_WebSiteReviewData.entrydate.Date == DateTime.Today)
            {

                string imageurl = "";
                string textname = "";
                string websitedescription = "";
                string GlobalRank = "";
                string CountryRank = "";
                string CategoryRank = "";
                string VisitersOnSite = "";
                string TimeOnSite = "";
                string WebSitePageViewers = "";
                string WebSiteBounceRate = "";
                string DirrectTrafficOnSite = "";
                string ReferralTrafficOnSite = "";
                string SearchTrafficeOnSite = "";
                string SocialTrafficeOnSite = "";
                string MailTrafficeOnSite = "";
                string DisplayTrafficOnSite = "";
                string toprefersitedata = "";
                string topdestiantionsites = "";
                string PaidSearch = "";
                string organickeyword = "";
                string paidkeyword = "";
                string socialsites = "";
                string sitesvalue = "";
                string display = "";
                string interestvalue = "";
                string audienceinterest = "";
                string visitedsites = "";
                string similarwebsite = "";
                string inmagesource = "";
                string appname = "";
                string inmagesourceapp = "";
                string appnameapp = "";
                string pagesource = "";
                string TrafficbyCountry = "";
                string googleappimageurl = "";
                string appleappimageurl = "";

                string url = "http://www.similarweb.com/website/" + Url;
                ChilkatHttpHelpr objChilkatHttpHelpr = new ChilkatHttpHelpr();
                GlobusHttpHelper _GlobusHttpHelper = new GlobusHttpHelper();
                pagesource = _GlobusHttpHelper.getHtmlfromUrl(new Uri(url));

                if (pagesource.Contains("stickyHeader-nameItem"))
                {
                    string requiredpagesource = Utils.getBetween(pagesource, "stickyHeader-nameItem", "class=\"icon-new-window stickyHeader-iconNew\"");
                    imageurl = Utils.getBetween(requiredpagesource, "src=\"", "\" />");
                    textname = Utils.getBetween(requiredpagesource, "\"stickyHeader-nameText\">", "</span>");
                }
                if (pagesource.Contains("analysis-descriptionText"))
                {
                    string descriptionsource = Utils.getBetween(pagesource, "analysis-descriptionText", "stickyHeader-relatedAppsSection");
                    websitedescription = Utils.getBetween(descriptionsource, "\">", "</div>");

                }
                if (pagesource.Contains("stickyHeader-relatedAppsHeader"))
                {
                    string apppagesource = Utils.getBetween(pagesource, "stickyHeader-relatedAppsHeader", "stickyHeader-pdfButtonContainer");
                    string[] imagepath = Regex.Split(apppagesource, "Internal Link");
                    foreach (var item in imagepath)
                    {
                        if (item.Contains("Related Mobile Apps App Store"))
                        {
                            string appitem = Utils.getBetween(item, "stickyHeader-appImage", "</span>");
                            appitem = Utils.getBetween(appitem, "src=\"", "\">");
                            appleappimageurl = appitem + "," + appleappimageurl;

                        }
                        else if (item.Contains("Related Mobile Apps Google Play"))
                        {
                            string googleitem = Utils.getBetween(item, "stickyHeader-appImage", "</span>");
                            googleitem = Utils.getBetween(googleitem, "src=\"", "\">");
                            googleappimageurl = googleitem + "," + googleappimageurl;
                        }
                    }

                }
                if (pagesource.Contains("rankingSection"))
                {
                    string rankepagesource = Utils.getBetween(pagesource, "rankingSection", "rankingItem-embed");
                    string globalrank = Utils.getBetween(rankepagesource, "data-value=\"", "/span>");
                    GlobalRank = Utils.getBetween(globalrank, "\">", "<");

                }
                if (pagesource.Contains("Category Rank"))
                {
                    string countryrankpagesource = Utils.getBetween(pagesource, "Country Rank", "Category Rank");
                    countryrankpagesource = Utils.getBetween(countryrankpagesource, "data-value=\"", "/span>");
                    CountryRank = Utils.getBetween(countryrankpagesource, "\">", "<");

                    string categorypagesource = Utils.getBetween(pagesource, "Category Rank", "Traffic Overview");
                    categorypagesource = Utils.getBetween(categorypagesource, "data-value=\"", "/span>");
                    CategoryRank = Utils.getBetween(categorypagesource, "\">", "<");
                }

                if (pagesource.Contains("Estimated Monthly Visits"))
                {
                    string EstimatedMonthlyVisits = Utils.getBetween(pagesource, "Engagement", "Traffic by countries");
                    string visits = Utils.getBetween(EstimatedMonthlyVisits, "visits", "Time on site");
                    visits = Utils.getBetween(visits, "engagementInfo-value engagementInfo-value--large u-text-ellipsis", "span>");
                    VisitersOnSite = Utils.getBetween(visits, "\">", "<");

                    string timeonsite = Utils.getBetween(EstimatedMonthlyVisits, "Time on site", "Page views");
                    timeonsite = Utils.getBetween(timeonsite, "engagementInfo-value u-text-ellipsis", "/span>");

                    TimeOnSite = Utils.getBetween(timeonsite, "\">", "<");


                    string pageview = Utils.getBetween(EstimatedMonthlyVisits, "Page views", "Bounce rate");
                    pageview = Utils.getBetween(pageview, "engagementInfo-value u-text-ellipsis", "/span>");

                    WebSitePageViewers = Utils.getBetween(pageview, "\">", "<");


                    string bouncerate = Utils.getBetween(EstimatedMonthlyVisits, "Bounce rate", "geo");
                    bouncerate = Utils.getBetween(bouncerate, "engagementInfo-value u-text-ellipsis", "/span>");
                    WebSiteBounceRate = Utils.getBetween(bouncerate, "\">", "<");
                }

                if (pagesource.Contains("WebsitePageModule.Views.MapView"))
                {
                    string trafficbycountry = Utils.getBetween(pagesource, "WebsitePageModule.Views.MapView", "websitePage-contentNarrow websitePage-contentRight geo-accordion");
                    TrafficbyCountry = Utils.getBetween(trafficbycountry, "&quot;Country&quot;, &quot;Share&quot;],", "]}'></div>").Replace("&quot;", "");
                }
                if (pagesource.Contains("trafficSourcesSection"))
                {

                    string trafficsource = Utils.getBetween(pagesource, "trafficSourcesChart-list", "analysisPage-section websitePage-referrals hideInCompared");
                    string trafficsourcedirrect = Utils.getBetween(trafficsource, "trafficSourcesChart-item direct", "icon-direct trafficSourcesChart-icon");
                    DirrectTrafficOnSite = Utils.getBetween(trafficsourcedirrect, "<div class=\"trafficSourcesChart-value\">", "</div>");

                    string refferalsource = Utils.getBetween(trafficsource, "trafficSourcesChart-item referrals", "icon-referrals trafficSourcesChart-icon");
                    ReferralTrafficOnSite = Utils.getBetween(refferalsource, "<div class=\"trafficSourcesChart-value\">", "</div>");

                    string searchtrafficsource = Utils.getBetween(trafficsource, "trafficSourcesChart-item search", "icon-search trafficSourcesChart-icon");
                    SearchTrafficeOnSite = Utils.getBetween(searchtrafficsource, "<div class=\"trafficSourcesChart-value\">", "</div>");

                    string socialtrafficesource = Utils.getBetween(trafficsource, "trafficSourcesChart-item social", "icon-social trafficSourcesChart-icon");
                    SocialTrafficeOnSite = Utils.getBetween(socialtrafficesource, "<div class=\"trafficSourcesChart-value\">", "</div>");

                    string mailtrafficesource = Utils.getBetween(trafficsource, "trafficSourcesChart-item mail", "icon-mail trafficSourcesChart-icon");
                    MailTrafficeOnSite = Utils.getBetween(mailtrafficesource, "<div class=\"trafficSourcesChart-value\">", "</div>");


                    string displaytrafficesource = Utils.getBetween(trafficsource, "trafficSourcesChart-item display", "icon-display trafficSourcesChart-icon");
                    DisplayTrafficOnSite = Utils.getBetween(displaytrafficesource, "<div class=\"trafficSourcesChart-value\">", "</div>");
                }
                if (pagesource.Contains("analysisPage-section websitePage-referrals hideInCompared"))
                {
                    string topsitereferrral = Utils.getBetween(pagesource, "Top Referring Sites", "searchSection analysisPage-section websitePage-search hideInCompared");
                    string toprefersite = Utils.getBetween(topsitereferrral, "Top Referring Sites", "Top Destination Sites:");
                    string[] reqdataarr = Regex.Split(toprefersite, "class=\"websitePage-listItemLink");

                    foreach (var item in reqdataarr)
                    {


                        if (item.Contains("\"Internal Link\""))
                        {

                            string topsitename = Utils.getBetween(item, "\">", "</a>");
                            toprefersitedata = topsitename + "," + toprefersitedata;
                        }
                    }

                    string topdestinationsite = Utils.getBetween(topsitereferrral, "Top Destination Sites", "websitePage-blueButton websitePage-sectionButton referrals-hookButton js-proPopup");

                    string[] topdestiantion = Regex.Split(topdestinationsite, "websitePage-listItemLink js-tooltipTarget");


                    foreach (var item_site in topdestiantion)
                    {

                        if (item_site.Contains("\"Internal Link\""))
                        {
                            string topdetsianton = Utils.getBetween(item_site, "\">", "</a>");
                            topdestiantionsites = topdetsianton + "," + topdestiantionsites;
                        }
                    }

                }
                if (pagesource.Contains("searchPie-text searchPie-text--left"))
                {
                    string serchvalue = Utils.getBetween(pagesource, "searchPie-text searchPie-text--left", "searchKeywords-text searchKeywords-text--left websitePage-mobileFramed");
                    string organicsearch = Utils.getBetween(serchvalue, "<span class=\"searchPie-number\">", "</span>");
                    string paidserach = Utils.getBetween(serchvalue, "<div class=\"searchPie-text searchPie-text--right  \">", "/span>");
                    PaidSearch = Utils.getBetween(paidserach, "\">", "<");
                }

                if (pagesource.Contains("Organic Keywords"))
                {
                    string keyword = Utils.getBetween(pagesource, "Organic Keywords", "socialSection analysisPage-section websitePage-social hideInCompared");
                    string keywordvalue = Utils.getBetween(keyword, "searchKeywords-list", "websitePage-sectionButton u-button--wide js-proPopup");
                    string[] onganickeywordarry = Regex.Split(keywordvalue, "class='searchKeywords-words'");


                    foreach (var item in onganickeywordarry)
                    {
                        if (item.Contains("title=\""))
                        {
                            string valuekeyword = Utils.getBetween(item, "\">", "</span>");
                            organickeyword = valuekeyword + "," + organickeyword;
                        }
                    }

                    string paidvalue = Utils.getBetween(keyword, "websitePage-sectionButton u-button--wide js-proPopup", "social");
                    paidkeyword = Utils.getBetween(paidvalue, "search-noDataMessage\">", "</div>").Replace("\n", "");

                }


                if (pagesource.Contains("socialSection analysisPage-section websitePage-social hideInCompared"))
                {
                    string socialvalue = Utils.getBetween(pagesource, "socialSection analysisPage-section websitePage-social hideInCompared", "Display Advertising");
                    string[] socialsitesvalue = Regex.Split(socialvalue, "class=\"socialItem\"");

                    foreach (var item in socialsitesvalue)
                    {
                        if (item.Contains("Internal Link"))
                        {
                            string data = Utils.getBetween(item, "Internal Link\"", "/a>");
                            data = Utils.getBetween(data, "'>", "<");
                            socialsites = data + "," + socialsites;

                            string value = Utils.getBetween(item, "socialItem-value\">", "</div>");
                            sitesvalue = value + "," + sitesvalue;
                        }
                    }

                }

                if (pagesource.Contains("Display Advertising"))
                {
                    string displayvalue = Utils.getBetween(pagesource, "Display Advertising", "Audience Interests");
                    display = Utils.getBetween(displayvalue, "class=\"noData-title display\">", "</h2>");
                }
                if (pagesource.Contains("Audience Interests"))
                {
                    string audiencesvalue = Utils.getBetween(pagesource, "Audience Interests", "Also visited websites");
                    string[] audiencedata = Regex.Split(audiencesvalue, "audienceCategories-item fadeInLeft");

                    foreach (var item in audiencedata)
                    {
                        if (item.Contains("audienceCategories-chartContainer"))
                        {
                            string values = Utils.getBetween(item, "\"fillValue\":", "\"innerSize\"").Replace(",", "");
                            interestvalue = values + "," + interestvalue;

                            string intreset = Utils.getBetween(item, "audienceCategories-itemLink", "/a>");
                            intreset = Utils.getBetween(intreset, "\">", "<");
                            audienceinterest = intreset + "," + audienceinterest;
                        }
                    }
                }
                if (pagesource.Contains("Also visited websites"))
                {
                    string alsovisitedvalue = Utils.getBetween(pagesource, "Also visited websites", "Similar Sites");
                    string[] data = Regex.Split(alsovisitedvalue, "websitePage-listItemContainer");

                    foreach (var item in data)
                    {
                        if (item.Contains("Internal Link"))
                        {
                            string value = Utils.getBetween(item, "Internal Link", "/a>");
                            value = Utils.getBetween(value, "\">", "<");
                            visitedsites = value + "," + visitedsites;
                        }
                    }
                }
                if (pagesource.Contains("Similar Sites"))
                {
                    string SimilaSitesdata = Utils.getBetween(pagesource, "Similar Sites", "Related Mobile Apps");
                    string[] data = Regex.Split(SimilaSitesdata, "compareModal-row-cell-title");

                    foreach (var item in data)
                    {
                        if (item.Contains("data-url="))
                        {
                            string value = Utils.getBetween(item, "\">", "</span>");
                            similarwebsite = value + "," + similarwebsite;
                        }
                    }
                }
                if (pagesource.Contains("analysisPage-section websitePage-websiteMobileApps hideInCompared"))
                {
                    string RelatedMobilAppsdata = Utils.getBetween(pagesource, "analysisPage-section websitePage-websiteMobileApps hideInCompared", "Get More with SimilarWeb PRO");
                    string data = Utils.getBetween(RelatedMobilAppsdata, "Google Play Store", "App Store");
                    string[] dataarry = Regex.Split(data, "data-analytics-category=\"Internal Link\"");

                    foreach (var item in dataarry)
                    {
                        if (item.Contains("data-analytics-label="))
                        {
                            string valueimgaesrc = Utils.getBetween(item, "data-original=\"", "alt=\"").Replace("\"", "");
                            inmagesource = valueimgaesrc + "," + inmagesource;
                            string valueappname = Utils.getBetween(item, "itemprop=\"name\"", "/span>");
                            valueappname = Utils.getBetween(valueappname, ">", "<").Replace("\n", "").Trim();
                            appname = valueappname + "," + appname;

                        }
                    }

                    string appdatavlue = Utils.getBetween(RelatedMobilAppsdata, "App Store", "u-button--middle websitePage-pinkStrongButton websitePage-sectionButton js-proPopup");
                    string[] datavalue = Regex.Split(appdatavlue, "mobileApps-appList");

                    foreach (var item in datavalue)
                    {
                        if (item.Contains("data-options="))
                        {
                            string valueimgaesrc = Utils.getBetween(item, "data-original=\"", "alt=\"").Replace("\"", "");
                            inmagesourceapp = valueimgaesrc + "," + inmagesourceapp;
                            string valueappname = Utils.getBetween(item, "itemprop=\"name\"", "/span>");
                            valueappname = Utils.getBetween(valueappname, ">", "<").Replace("\n", "").Trim();
                            appnameapp = valueappname + "," + appnameapp;
                        }

                    }
                }
                _WebSiteReviewData.imageurl = imageurl;
                _WebSiteReviewData.googleinmagesource = inmagesource;
                _WebSiteReviewData.inmagesourceapp = inmagesourceapp;
                _WebSiteReviewData.interestvalue = interestvalue;
                _WebSiteReviewData.MailTrafficeOnSite = MailTrafficeOnSite;
                _WebSiteReviewData.organickeyword = organickeyword;
                _WebSiteReviewData.paidkeyword = paidkeyword;
                _WebSiteReviewData.PaidSearch = PaidSearch;
                _WebSiteReviewData.ReferralTrafficOnSite = ReferralTrafficOnSite;
                _WebSiteReviewData.SearchTrafficeOnSite = SearchTrafficeOnSite;
                _WebSiteReviewData.similarwebsite = similarwebsite;
                _WebSiteReviewData.sitesvalue = sitesvalue;
                _WebSiteReviewData.socialsites = socialsites;
                _WebSiteReviewData.SocialTrafficeOnSite = socialsites;
                _WebSiteReviewData.textname = textname;
                _WebSiteReviewData.TimeOnSite = TimeOnSite;
                _WebSiteReviewData.topdestiantionsites = topdestiantionsites;
                _WebSiteReviewData.toprefersitedata = toprefersitedata;
                _WebSiteReviewData.visitedsites = visitedsites;
                _WebSiteReviewData.VisitersOnSite = VisitersOnSite;
                _WebSiteReviewData.WebSiteBounceRate = WebSiteBounceRate;
                _WebSiteReviewData.websitedescription = websitedescription;
                _WebSiteReviewData.websitename = url;
                _WebSiteReviewData.WebSitePageViewers = WebSitePageViewers;
                _WebSiteReviewData.googleappname = appname;
                _WebSiteReviewData.appnameapp = appnameapp;
                _WebSiteReviewData.audienceinterest = audienceinterest;
                _WebSiteReviewData.CategoryRank = CategoryRank;
                _WebSiteReviewData.CountryRank = CountryRank;
                _WebSiteReviewData.DirrectTrafficOnSite = DirrectTrafficOnSite;
                _WebSiteReviewData.display = display;
                _WebSiteReviewData.DisplayTrafficOnSite = DisplayTrafficOnSite;
                _WebSiteReviewData.GlobalRank = GlobalRank;
                _WebSiteReviewData.TrafficbyCountry = TrafficbyCountry;
                _WebSiteReviewData.relatedappimageurl = appleappimageurl;
                _WebSiteReviewData.relatedgoogleimageurl = googleappimageurl;

                try
                {
                    _WebSiteReviewDataRpository.UpdateWebSiteData(_WebSiteReviewData);
                    return "Update Sucessfully";
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                    logger.Error(ex.Message);
                    return "something went wrong";
                }
                
            }
            else {
                string imageurl = "";
                string textname = "";
                string websitedescription = "";
                string GlobalRank = "";
                string CountryRank = "";
                string CategoryRank = "";
                string VisitersOnSite = "";
                string TimeOnSite = "";
                string WebSitePageViewers = "";
                string WebSiteBounceRate = "";
                string DirrectTrafficOnSite = "";
                string ReferralTrafficOnSite = "";
                string SearchTrafficeOnSite = "";
                string SocialTrafficeOnSite = "";
                string MailTrafficeOnSite = "";
                string DisplayTrafficOnSite = "";
                string toprefersitedata = "";
                string topdestiantionsites = "";
                string PaidSearch = "";
                string organickeyword = "";
                string paidkeyword = "";
                string socialsites = "";
                string sitesvalue = "";
                string display = "";
                string interestvalue = "";
                string audienceinterest = "";
                string visitedsites = "";
                string similarwebsite = "";
                string inmagesource = "";
                string appname = "";
                string inmagesourceapp = "";
                string appnameapp = "";
                string pagesource = "";
                string TrafficbyCountry = "";
                string googleappimageurl = "";
                string appleappimageurl = "";

                string url = "http://www.similarweb.com/website/" + Url;
                ChilkatHttpHelpr objChilkatHttpHelpr = new ChilkatHttpHelpr();
                GlobusHttpHelper _GlobusHttpHelper = new GlobusHttpHelper();
                pagesource = _GlobusHttpHelper.getHtmlfromUrl(new Uri(url));
                
                if (pagesource.Contains("stickyHeader-nameItem"))
                {
                    string requiredpagesource = Utils.getBetween(pagesource, "stickyHeader-nameItem", "class=\"icon-new-window stickyHeader-iconNew\"");
                    imageurl = Utils.getBetween(requiredpagesource, "src=\"", "\" />");
                    textname = Utils.getBetween(requiredpagesource, "\"stickyHeader-nameText\">", "</span>");
                }
                if (pagesource.Contains("analysis-descriptionText"))
                {
                    string descriptionsource = Utils.getBetween(pagesource, "analysis-descriptionText", "stickyHeader-relatedAppsSection");
                    websitedescription = Utils.getBetween(descriptionsource, "\">", "</div>");

                }
                if (pagesource.Contains("stickyHeader-relatedAppsHeader"))
                {
                    string apppagesource = Utils.getBetween(pagesource, "stickyHeader-relatedAppsHeader", "stickyHeader-pdfButtonContainer");
                    string[] imagepath = Regex.Split(apppagesource, "Internal Link");
                    foreach (var item in imagepath)
                    {
                        if (item.Contains("Related Mobile Apps App Store"))
                        {
                            string appitem = Utils.getBetween(item, "stickyHeader-appImage", "</span>");
                            appitem = Utils.getBetween(appitem, "src=\"", "\">");
                            appleappimageurl = appitem + "," + appleappimageurl;

                        }
                        else if (item.Contains("Related Mobile Apps Google Play"))
                        {
                            string googleitem = Utils.getBetween(item, "stickyHeader-appImage", "</span>");
                            googleitem = Utils.getBetween(googleitem, "src=\"", "\">");
                            googleappimageurl = googleitem + "," + googleappimageurl;
                        }
                    }

                }
                if (pagesource.Contains("rankingSection"))
                {
                    string rankepagesource = Utils.getBetween(pagesource, "rankingSection", "rankingItem-embed");
                    string globalrank = Utils.getBetween(rankepagesource, "data-value=\"", "/span>");
                    GlobalRank = Utils.getBetween(globalrank, "\">", "<");

                }
                if (pagesource.Contains("Category Rank"))
                {
                    string countryrankpagesource = Utils.getBetween(pagesource, "Country Rank", "Category Rank");
                    countryrankpagesource = Utils.getBetween(countryrankpagesource, "data-value=\"", "/span>");
                    CountryRank = Utils.getBetween(countryrankpagesource, "\">", "<");

                    string categorypagesource = Utils.getBetween(pagesource, "Category Rank", "Traffic Overview");
                    categorypagesource = Utils.getBetween(categorypagesource, "data-value=\"", "/span>");
                    CategoryRank = Utils.getBetween(categorypagesource, "\">", "<");
                }

                if (pagesource.Contains("Estimated Monthly Visits"))
                {
                    string EstimatedMonthlyVisits = Utils.getBetween(pagesource, "Engagement", "Traffic by countries");
                    string visits = Utils.getBetween(EstimatedMonthlyVisits, "visits", "Time on site");
                    visits = Utils.getBetween(visits, "engagementInfo-value engagementInfo-value--large u-text-ellipsis", "span>");
                    VisitersOnSite = Utils.getBetween(visits, "\">", "<");

                    string timeonsite = Utils.getBetween(EstimatedMonthlyVisits, "Time on site", "Page views");
                    timeonsite = Utils.getBetween(timeonsite, "engagementInfo-value u-text-ellipsis", "/span>");

                    TimeOnSite = Utils.getBetween(timeonsite, "\">", "<");


                    string pageview = Utils.getBetween(EstimatedMonthlyVisits, "Page views", "Bounce rate");
                    pageview = Utils.getBetween(pageview, "engagementInfo-value u-text-ellipsis", "/span>");

                    WebSitePageViewers = Utils.getBetween(pageview, "\">", "<");


                    string bouncerate = Utils.getBetween(EstimatedMonthlyVisits, "Bounce rate", "geo");
                    bouncerate = Utils.getBetween(bouncerate, "engagementInfo-value u-text-ellipsis", "/span>");
                    WebSiteBounceRate = Utils.getBetween(bouncerate, "\">", "<");
                }

                if (pagesource.Contains("WebsitePageModule.Views.MapView"))
                {
                    string trafficbycountry = Utils.getBetween(pagesource, "WebsitePageModule.Views.MapView", "websitePage-contentNarrow websitePage-contentRight geo-accordion");
                    TrafficbyCountry = Utils.getBetween(trafficbycountry, "&quot;Country&quot;, &quot;Share&quot;],", "]}'></div>").Replace("&quot;", "");
                }
                if (pagesource.Contains("trafficSourcesSection"))
                {

                    string trafficsource = Utils.getBetween(pagesource, "trafficSourcesChart-list", "analysisPage-section websitePage-referrals hideInCompared");
                    string trafficsourcedirrect = Utils.getBetween(trafficsource, "trafficSourcesChart-item direct", "icon-direct trafficSourcesChart-icon");
                    DirrectTrafficOnSite = Utils.getBetween(trafficsourcedirrect, "<div class=\"trafficSourcesChart-value\">", "</div>");

                    string refferalsource = Utils.getBetween(trafficsource, "trafficSourcesChart-item referrals", "icon-referrals trafficSourcesChart-icon");
                    ReferralTrafficOnSite = Utils.getBetween(refferalsource, "<div class=\"trafficSourcesChart-value\">", "</div>");

                    string searchtrafficsource = Utils.getBetween(trafficsource, "trafficSourcesChart-item search", "icon-search trafficSourcesChart-icon");
                    SearchTrafficeOnSite = Utils.getBetween(searchtrafficsource, "<div class=\"trafficSourcesChart-value\">", "</div>");

                    string socialtrafficesource = Utils.getBetween(trafficsource, "trafficSourcesChart-item social", "icon-social trafficSourcesChart-icon");
                    SocialTrafficeOnSite = Utils.getBetween(socialtrafficesource, "<div class=\"trafficSourcesChart-value\">", "</div>");

                    string mailtrafficesource = Utils.getBetween(trafficsource, "trafficSourcesChart-item mail", "icon-mail trafficSourcesChart-icon");
                    MailTrafficeOnSite = Utils.getBetween(mailtrafficesource, "<div class=\"trafficSourcesChart-value\">", "</div>");


                    string displaytrafficesource = Utils.getBetween(trafficsource, "trafficSourcesChart-item display", "icon-display trafficSourcesChart-icon");
                    DisplayTrafficOnSite = Utils.getBetween(displaytrafficesource, "<div class=\"trafficSourcesChart-value\">", "</div>");
                }
                if (pagesource.Contains("analysisPage-section websitePage-referrals hideInCompared"))
                {
                    string topsitereferrral = Utils.getBetween(pagesource, "Top Referring Sites", "searchSection analysisPage-section websitePage-search hideInCompared");
                    string toprefersite = Utils.getBetween(topsitereferrral, "Top Referring Sites", "Top Destination Sites:");
                    string[] reqdataarr = Regex.Split(toprefersite, "class=\"websitePage-listItemLink");

                    foreach (var item in reqdataarr)
                    {


                        if (item.Contains("\"Internal Link\""))
                        {

                            string topsitename = Utils.getBetween(item, "\">", "</a>");
                            toprefersitedata = topsitename + "," + toprefersitedata;
                        }
                    }

                    string topdestinationsite = Utils.getBetween(topsitereferrral, "Top Destination Sites", "websitePage-blueButton websitePage-sectionButton referrals-hookButton js-proPopup");

                    string[] topdestiantion = Regex.Split(topdestinationsite, "websitePage-listItemLink js-tooltipTarget");


                    foreach (var item_site in topdestiantion)
                    {

                        if (item_site.Contains("\"Internal Link\""))
                        {
                            string topdetsianton = Utils.getBetween(item_site, "\">", "</a>");
                            topdestiantionsites = topdetsianton + "," + topdestiantionsites;
                        }
                    }

                }
                if (pagesource.Contains("searchPie-text searchPie-text--left"))
                {
                    string serchvalue = Utils.getBetween(pagesource, "searchPie-text searchPie-text--left", "searchKeywords-text searchKeywords-text--left websitePage-mobileFramed");
                    string organicsearch = Utils.getBetween(serchvalue, "<span class=\"searchPie-number\">", "</span>");
                    string paidserach = Utils.getBetween(serchvalue, "<div class=\"searchPie-text searchPie-text--right  \">", "/span>");
                    PaidSearch = Utils.getBetween(paidserach, "\">", "<");
                }

                if (pagesource.Contains("Organic Keywords"))
                {
                    string keyword = Utils.getBetween(pagesource, "Organic Keywords", "socialSection analysisPage-section websitePage-social hideInCompared");
                    string keywordvalue = Utils.getBetween(keyword, "searchKeywords-list", "websitePage-sectionButton u-button--wide js-proPopup");
                    string[] onganickeywordarry = Regex.Split(keywordvalue, "class='searchKeywords-words'");


                    foreach (var item in onganickeywordarry)
                    {
                        if (item.Contains("title=\""))
                        {
                            string valuekeyword = Utils.getBetween(item, "\">", "</span>");
                            organickeyword = valuekeyword + "," + organickeyword;
                        }
                    }

                    string paidvalue = Utils.getBetween(keyword, "websitePage-sectionButton u-button--wide js-proPopup", "social");
                    paidkeyword = Utils.getBetween(paidvalue, "search-noDataMessage\">", "</div>").Replace("\n", "");

                }


                if (pagesource.Contains("socialSection analysisPage-section websitePage-social hideInCompared"))
                {
                    string socialvalue = Utils.getBetween(pagesource, "socialSection analysisPage-section websitePage-social hideInCompared", "Display Advertising");
                    string[] socialsitesvalue = Regex.Split(socialvalue, "class=\"socialItem\"");

                    foreach (var item in socialsitesvalue)
                    {
                        if (item.Contains("Internal Link"))
                        {
                            string data = Utils.getBetween(item, "Internal Link\"", "/a>");
                            data = Utils.getBetween(data, "'>", "<");
                            socialsites = data + "," + socialsites;

                            string value = Utils.getBetween(item, "socialItem-value\">", "</div>");
                            sitesvalue = value + "," + sitesvalue;
                        }
                    }

                }

                if (pagesource.Contains("Display Advertising"))
                {
                    string displayvalue = Utils.getBetween(pagesource, "Display Advertising", "Audience Interests");
                    display = Utils.getBetween(displayvalue, "class=\"noData-title display\">", "</h2>");
                }
                if (pagesource.Contains("Audience Interests"))
                {
                    string audiencesvalue = Utils.getBetween(pagesource, "Audience Interests", "Also visited websites");
                    string[] audiencedata = Regex.Split(audiencesvalue, "audienceCategories-item fadeInLeft");

                    foreach (var item in audiencedata)
                    {
                        if (item.Contains("audienceCategories-chartContainer"))
                        {
                            string values = Utils.getBetween(item, "\"fillValue\":", "\"innerSize\"").Replace(",", "");
                            interestvalue = values + "," + interestvalue;

                            string intreset = Utils.getBetween(item, "audienceCategories-itemLink", "/a>");
                            intreset = Utils.getBetween(intreset, "\">", "<");
                            audienceinterest = intreset + "," + audienceinterest;
                        }
                    }
                }
                if (pagesource.Contains("Also visited websites"))
                {
                    string alsovisitedvalue = Utils.getBetween(pagesource, "Also visited websites", "Similar Sites");
                    string[] data = Regex.Split(alsovisitedvalue, "websitePage-listItemContainer");

                    foreach (var item in data)
                    {
                        if (item.Contains("Internal Link"))
                        {
                            string value = Utils.getBetween(item, "Internal Link", "/a>");
                            value = Utils.getBetween(value, "\">", "<");
                            visitedsites = value + "," + visitedsites;
                        }
                    }
                }
                if (pagesource.Contains("Similar Sites"))
                {
                    string SimilaSitesdata = Utils.getBetween(pagesource, "Similar Sites", "Related Mobile Apps");
                    string[] data = Regex.Split(SimilaSitesdata, "compareModal-row-cell-title");

                    foreach (var item in data)
                    {
                        if (item.Contains("data-url="))
                        {
                            string value = Utils.getBetween(item, "\">", "</span>");
                            similarwebsite = value + "," + similarwebsite;
                        }
                    }
                }
                if (pagesource.Contains("analysisPage-section websitePage-websiteMobileApps hideInCompared"))
                {
                    string RelatedMobilAppsdata = Utils.getBetween(pagesource, "analysisPage-section websitePage-websiteMobileApps hideInCompared", "Get More with SimilarWeb PRO");
                    string data = Utils.getBetween(RelatedMobilAppsdata, "Google Play Store", "App Store");
                    string[] dataarry = Regex.Split(data, "data-analytics-category=\"Internal Link\"");

                    foreach (var item in dataarry)
                    {
                        if (item.Contains("data-analytics-label="))
                        {
                            string valueimgaesrc = Utils.getBetween(item, "data-original=\"", "alt=\"").Replace("\"", "");
                            inmagesource = valueimgaesrc + "," + inmagesource;
                            string valueappname = Utils.getBetween(item, "itemprop=\"name\"", "/span>");
                            valueappname = Utils.getBetween(valueappname, ">", "<").Replace("\n", "").Trim();
                            appname = valueappname + "," + appname;

                        }
                    }

                    string appdatavlue = Utils.getBetween(RelatedMobilAppsdata, "App Store", "u-button--middle websitePage-pinkStrongButton websitePage-sectionButton js-proPopup");
                    string[] datavalue = Regex.Split(appdatavlue, "mobileApps-appList");

                    foreach (var item in datavalue)
                    {
                        if (item.Contains("data-options="))
                        {
                            string valueimgaesrc = Utils.getBetween(item, "data-original=\"", "alt=\"").Replace("\"", "");
                            inmagesourceapp = valueimgaesrc + "," + inmagesourceapp;
                            string valueappname = Utils.getBetween(item, "itemprop=\"name\"", "/span>");
                            valueappname = Utils.getBetween(valueappname, ">", "<").Replace("\n", "").Trim();
                            appnameapp = valueappname + "," + appnameapp;
                        }

                    }
                }
                _WebSiteReviewData.Id = Guid.NewGuid();
                _WebSiteReviewData.imageurl = imageurl;
                _WebSiteReviewData.googleinmagesource = inmagesource;
                _WebSiteReviewData.inmagesourceapp = inmagesourceapp;
                _WebSiteReviewData.interestvalue = interestvalue;
                _WebSiteReviewData.MailTrafficeOnSite = MailTrafficeOnSite;
                _WebSiteReviewData.organickeyword = organickeyword;
                _WebSiteReviewData.paidkeyword = paidkeyword;
                _WebSiteReviewData.PaidSearch = PaidSearch;
                _WebSiteReviewData.ReferralTrafficOnSite = ReferralTrafficOnSite;
                _WebSiteReviewData.SearchTrafficeOnSite = SearchTrafficeOnSite;
                _WebSiteReviewData.similarwebsite = similarwebsite;
                _WebSiteReviewData.sitesvalue = sitesvalue;
                _WebSiteReviewData.socialsites = socialsites;
                _WebSiteReviewData.SocialTrafficeOnSite = socialsites;
                _WebSiteReviewData.textname = textname;
                _WebSiteReviewData.TimeOnSite = TimeOnSite;
                _WebSiteReviewData.topdestiantionsites = topdestiantionsites;
                _WebSiteReviewData.toprefersitedata = toprefersitedata;
                _WebSiteReviewData.visitedsites = visitedsites;
                _WebSiteReviewData.VisitersOnSite = VisitersOnSite;
                _WebSiteReviewData.WebSiteBounceRate = WebSiteBounceRate;
                _WebSiteReviewData.websitedescription = websitedescription;
                _WebSiteReviewData.websitename = url;
                _WebSiteReviewData.WebSitePageViewers = WebSitePageViewers;
                _WebSiteReviewData.googleappname = appname;
                _WebSiteReviewData.appnameapp = appnameapp;
                _WebSiteReviewData.audienceinterest = audienceinterest;
                _WebSiteReviewData.CategoryRank = CategoryRank;
                _WebSiteReviewData.CountryRank = CountryRank;
                _WebSiteReviewData.DirrectTrafficOnSite = DirrectTrafficOnSite;
                _WebSiteReviewData.display = display;
                _WebSiteReviewData.DisplayTrafficOnSite = DisplayTrafficOnSite;
                _WebSiteReviewData.GlobalRank = GlobalRank;
                _WebSiteReviewData.TrafficbyCountry = TrafficbyCountry;
                _WebSiteReviewData.relatedappimageurl = appleappimageurl;
                _WebSiteReviewData.relatedgoogleimageurl = googleappimageurl;
                _WebSiteReviewData.entrydate = DateTime.Now;
                try
                {
                    WebSiteReviewDataRpository.Add(_WebSiteReviewData);
                    return "Updated Sucessfully";
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                    logger.Error(ex.Message);
                    return "something went wrong";
                }
            
            
            }
        
        }
        public List<string> GetHashTags(out string returnStatus)
        {
            List<string> HashTags = new List<string>();
            try
            {
                //string pagesource = globushttpHelper.getHtmlfromUrl(new Uri("https://api.twitter.com/1/trends/daily.json"), "", "");
                ChilkatHttpHelpr HttpHelper = new ChilkatHttpHelpr();
                string pagesource = HttpHelper.GetHtml("https://api.twitter.com/1/trends/daily.json");

                if (!pagesource.Contains("Rate limit exceeded"))
                {
                    string[] array = Regex.Split(pagesource, "\"name\":");
                    array = array.Skip(1).ToArray();
                    foreach (string item in array)
                    {
                        try
                        {
                            int startindex = item.IndexOf("\"");
                            string Start = item.Substring(startindex);
                            int endIndex = Start.IndexOf("\",");
                            string End = Start.Substring(0, endIndex).Replace("\"", "");

                            string HashTag = End;

                            if (HashTag.Contains("#"))
                            {
                                HashTags.Add(HashTag);
                            }
                        }
                        catch (Exception ex)
                        {
                            returnStatus = "Error";
                            return new List<string>();
                        }
                    }
                    returnStatus = "No Error";
                    return HashTags;
                }
                else
                {
                    returnStatus = "Error";
                    return new List<string>();
                }
            }
            catch (Exception ex)
            {
                returnStatus = "Error";
                return new List<string>();
            }
        }
Example #22
0
        public void PostAddcompanyUrl(object parameter)
        {
            try
            {
                try
                {
                    if (IsStop)
                    {
                        return;
                    }

                    if (!IsStop)
                    {
                        lstLinkedinFollowCompanyUrlThraed.Add(Thread.CurrentThread);
                        lstLinkedinFollowCompanyUrlThraed.Distinct().ToList();
                        Thread.CurrentThread.IsBackground = true;
                    }
                }
                catch
                {
                }

                if (!string.IsNullOrEmpty(txtNumberOfFollowPerAccount.Text) && NumberHelper.ValidateNumber(txtNumberOfFollowPerAccount.Text))
                {
                    LinkedinCompanyFollow.CountPerAccount = Convert.ToInt32(txtNumberOfFollowPerAccount.Text);
                }

                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();
                ChilkatHttpHelpr ChilkatHttpHelper = new ChilkatHttpHelpr();
                LinkedinCompanyFollow obj_FollowCompany = new LinkedinCompanyFollow(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword);

                Login.logger.addToLogger += new EventHandler(logger_SearchFollowCompanyaddToLogger);

                int minDelay = 20;
                int maxDelay = 25;

                if (!string.IsNullOrEmpty(txtFollowCompanyMinDelay.Text) && NumberHelper.ValidateNumber(txtFollowCompanyMinDelay.Text))
                {
                    minDelay = Convert.ToInt32(txtFollowCompanyMinDelay.Text);
                }
                if (!string.IsNullOrEmpty(txtFollowCompanyMaxDelay.Text) && NumberHelper.ValidateNumber(txtFollowCompanyMaxDelay.Text))
                {
                    maxDelay = Convert.ToInt32(txtFollowCompanyMaxDelay.Text);
                }

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

                if (Login.IsLoggedIn)
                {
                    LinkedinCompanyFollow LinkdinFollowComp = new LinkedinCompanyFollow();
                    //LinkdinFollowComp.logger.addToLogger += new EventHandler(logger_SearchFollowCompanyaddToLogger);

                    try
                    {
                        Dictionary<string, string> Result = new Dictionary<string, string>();
                        string MessagePosted = obj_FollowCompany.PostAddCompanyUsingUrl(ref HttpHelper, Login.accountUser,minDelay, maxDelay);
                    }
                    catch { }
                }

            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Manage Follow Company URL --> PostAddcompanyUrl() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Manage Follow Company URL --> PostAddcompanyUrl() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddSearchGroupErrorLogs);
            }
            finally
            {
                counter_AddFollowUrl--;

                if (counter_AddFollowUrl == 0)
                {
                    btnFollowCompany.Invoke(new MethodInvoker(delegate
                    {
                        AddLoggerFollowCompanyUrl("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                        AddLoggerFollowCompanyUrl("----------------------------------------------------------------------------------------------------------");
                        btnFollowCompany.Cursor = Cursors.Default;
                    }));
                }
            }
        }
        /// <summary> Get User details for While/blacklist User 
        /// Get User details for While/blacklist User 
        /// </summary>
        /// <param name="username">User Screan Name OR User ID</param>
        /// <returns>Details of Users</returns>

        #region Get User details for While/blacklist User
        public static Dictionary<string, string> GetUserDetails(string username)
        {
            ChilkatHttpHelpr httpHelper = new ChilkatHttpHelpr();

            Dictionary<string, string> dataLst = new Dictionary<string, string>();

            try
            {
                string PageSource = null;

                if (!string.IsNullOrEmpty(username) && NumberHelper.ValidateNumber(username))
                {
                    PageSource = httpHelper.GetHtml("https://api.twitter.com/1/users/show.json?user_id=" + username + "&include_entities=true");
                }
                else
                {
                    PageSource = httpHelper.GetHtml("https://api.twitter.com/1/users/show.json?screen_name=" + username + "&include_entities=true");
                }

                JObject jobj = JObject.Parse(PageSource);


                string id = jobj["id"].ToString().Replace("\"", string.Empty);
                dataLst.Add("id", id);
                string name = jobj["name"].ToString().Replace("\"", string.Empty);
                dataLst.Add("name", name);
                string screen_name = jobj["screen_name"].ToString().Replace("\"", string.Empty);
                dataLst.Add("screen_name", screen_name);
                string location = jobj["location"].ToString().Replace("\"", string.Empty);
                dataLst.Add("location", location);
                string description = jobj["description"].ToString().Replace("\"", string.Empty);
                dataLst.Add("description", description);
                string followers_count = jobj["followers_count"].ToString().Replace("\"", string.Empty);
                dataLst.Add("followers_count", followers_count);
                string friends_count = jobj["friends_count"].ToString().Replace("\"", string.Empty);
                dataLst.Add("friends_count", friends_count);
                string statuses_count = jobj["statuses_count"].ToString().Replace("\"", string.Empty);
                dataLst.Add("statuses_count", statuses_count);
                string created_at = jobj["created_at"].ToString().Replace("\"", string.Empty);
                dataLst.Add("created_at", created_at);
                string time_zone = jobj["time_zone"].ToString().Replace("\"", string.Empty);
                dataLst.Add("time_zone", time_zone);
                string profile_image_url = jobj["profile_image_url"].ToString().Replace("\"", string.Empty);
                dataLst.Add("profile_image_url", profile_image_url);
            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetPhotoFromUsername() -- " + username + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetPhotoFromUsername() -- " + username + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
            }

            return dataLst;
        }
Example #24
0
        public static string GetFieldFilterIdsForPostData(string Responce, string FilterFiled)
        {
            string Data = string.Empty;
            try
            {

                ChilkatHttpHelpr objChilkatHttpHelpr = new ChilkatHttpHelpr();


                string[] data = System.Text.RegularExpressions.Regex.Split(Responce, FilterFiled);
                foreach (var item in data)
                {
                    if (item.StartsWith(":"))
                    {
                        string data2 = item.Substring(item.IndexOf(":{"), item.IndexOf("},") - item.IndexOf(":{")).Replace(":{", "").Trim();
                        Data = data2;

                        List<string> hrefLink = objChilkatHttpHelpr.GetHrefFromString(Data);
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
            return Data;
        }
Example #25
0
        /// <summary>
        /// This Method is used for check given proxy has working or not ?
        /// </summary>
        /// <param name="IPaddress">Given IpAddress </param>
        /// <param name="Port">Given Port</param>
        /// <param name="Username">Given Username</param>
        /// <param name="Password">Given Password</param>
        /// <param name="CheckingUrl">Given Url where we check the Proxy</param>
        /// <returns></returns>
        public bool CheckProxy(string IPaddress,string Port ,string Username,string Password,string CheckingUrl)
        {
            ChilkatHttpHelpr objChilkatHelper = new ChilkatHttpHelpr();
            bool status = false;
            try
            {
               
                    System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();
                    string ResponseTime = string.Empty;
                    timer.Start();
                    string Response = objChilkatHelper.GetHtmlProxy(CheckingUrl, IPaddress, Port, Username, Password);
                    timer.Stop();
                    TimeSpan timeTaken = timer.Elapsed;
                    ResponseTime = timeTaken.ToString();
               
                

                if (!string.IsNullOrEmpty(Response) && objChilkatHelper.http.LastStatus != 404 && objChilkatHelper.http.LastStatus != 500 && !Response.Contains("Internet Explorer cannot display the webpage"))
                {
                    status = true;
                }
                else
                {
                    status = false;
                }

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

            return status;
 
        }
Example #26
0
        public static List<string> GetAllFriends(ref ChilkatHttpHelpr chilkatHttpHelper, string userId)
        {
            List<string> finalList_Friends = new List<string>();

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

            try
            {
                string pgSource_Friends = chilkatHttpHelper.GetHtml("http://www.facebook.com/profile.php?id=" + userId + "&sk=friends");

                string[] Friends = Regex.Split(pgSource_Friends, "user.php");

                ParseFriendIDs(Friends, finalList_Friends);

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

                // {"collection_token":"1220529617:2356318349:2","cursor":"MDpub3Rfc3RydWN0dXJlZDoxMDAwMDA5MjM1MTg5MjY=","tab_key":"friends","profile_id":1220529617,"overview":false,"ftid":null,"order":null,"sk":"friends"}


                string collection_token = "";
                string cursor = "";

                //check if all friends loaded
                string patternAllFriendsLoaded = "\"TimelineAppCollection\",\"setFullyLoaded\",[],[\"pagelet_timeline_app_collection_";

                int tempCount_AjaxRequests = 0;

                do //
                {
                    try
                    {
                        collection_token = "";
                        cursor = "";

                        string[] arry = Regex.Split(pgSource_Friends, "enableContentLoader");
                        if (arry.Length > 1)
                        {
                            try
                            {
                                string rawData = arry[1];

                                int startIndx_collection_token = rawData.IndexOf("pagelet_timeline_app_collection_") + "pagelet_timeline_app_collection_".Length;
                                int endIndx_collection_token = rawData.IndexOf("\"", startIndx_collection_token);
                                collection_token = rawData.Substring(startIndx_collection_token, endIndx_collection_token - startIndx_collection_token);

                                int startIndx_cursor = rawData.IndexOf(",\"", endIndx_collection_token) + ",\"".Length;
                                int endIndx_cursor = rawData.IndexOf("\"", startIndx_cursor);
                                cursor = rawData.Substring(startIndx_cursor, endIndx_cursor - startIndx_cursor);
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                            }

                        }

                        string raw_data = "{\"collection_token\":\"" + collection_token + "\",\"cursor\":\"" + cursor + "\",\"tab_key\":\"friends\",\"profile_id\":" + userId + ",\"overview\":false,\"ftid\":null,\"order\":null,\"sk\":\"friends\"}";
                        string encoded_raw_data = Uri.EscapeDataString(raw_data);

                        string getURL_MoreFriendsAjax = "https://www.facebook.com/ajax/pagelet/generic.php/AllFriendsAppCollectionPagelet?data=" + encoded_raw_data + "&__user="******"&__a=1&__dyn=7n8ahyj2qmudwNAEU&__req=2";
                        string res_getURL_MoreFriendsAjax = chilkatHttpHelper.GetHtml(getURL_MoreFriendsAjax);

                        pgSource_Friends = res_getURL_MoreFriendsAjax;

                        string[] arry_UserData = Regex.Split(pgSource_Friends, "user.php");

                        ParseFriendIDs(arry_UserData, finalList_Friends);

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

                } while ((collection_token != "" && cursor != "") || tempCount_AjaxRequests < 15 || pgSource_Friends.Contains(patternAllFriendsLoaded));



                finalList_Friends.ForEach(delegate(String friendID)
                {
                    if (friendID.Contains("&"))
                    {
                        friendID = friendID.Remove(friendID.IndexOf("&"));
                    }
                    list_finalFriendsID.Add(friendID);
                });

                list_finalFriendsID = list_finalFriendsID.Distinct().ToList();
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }

            return list_finalFriendsID;
        }
Example #27
0
        /// <summary>
        /// This Method is used for check given proxy has working or not And Return those Proxy set for use in their method
        /// </summary>
        /// <param name="IPaddress">Given IpAddress </param>
        /// <param name="Port">Given Port</param>
        /// <param name="Username">Given Username</param>
        /// <param name="Password">Given Password</param>
        /// <param name="CheckingUrl">Given Url where we check the Proxy</param>
        /// <returns></returns>
        public Proxies.Proxy GetSingleUserProxy(string IPaddress, string Port, string Username, string Password, string CheckingUrl)
        {
            ChilkatHttpHelpr objChilkatHelper = new ChilkatHttpHelpr();
           Proxy objProxy=new Proxy();
            try
            {
                System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();
                string respnceTime = string.Empty;
                timer.Start();
                string Responce = objChilkatHelper.GetHtmlProxy(CheckingUrl, IPaddress, Port, Username, Password);
                timer.Stop();
                TimeSpan timeTaken = timer.Elapsed;
                respnceTime = timeTaken.ToString();

                if (!string.IsNullOrEmpty(Responce) && objChilkatHelper.http.LastStatus != 404 && objChilkatHelper.http.LastStatus != 500 && !Responce.Contains("Internet Explorer cannot display the webpage"))
                {
                    objProxy.IpAddress = IPaddress;
                    objProxy.Port = Port;
                    objProxy.UserName = Username;
                    objProxy.Password = Password;
                }
                else
                {
                   
                }

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

            return objProxy;

        }
        public static string GetUserNameFromUserId(string userid)
        {
            string username = string.Empty;

            ChilkatHttpHelpr httpHelper = new ChilkatHttpHelpr();
            clsDBQueryManager DB = new clsDBQueryManager();
            DataSet ds = DB.GetUserName(userid);
            string user_id = string.Empty;

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dataRow in ds.Tables["tb_UsernameDetails"].Rows)
                {
                    user_id = dataRow.ItemArray[0].ToString();
                    return user_id;
                }
            }
            try
            {
                string PageSource = string.Empty;
                if (!string.IsNullOrEmpty(userid) && NumberHelper.ValidateNumber(userid))
                {
                    PageSource = httpHelper.GetHtml("https://api.twitter.com/1/users/show.xml?user_id=" + userid + "&include_entities=true");
                    if (!PageSource.Contains("Rate limit exceeded. Clients may not make more than 150 requests per hour."))
                    {
                        try
                        {
                            int startIndex = PageSource.IndexOf("<screen_name>");
                            if (startIndex > 0)
                            {
                                string Start = PageSource.Substring(startIndex);
                                int endIndex = Start.IndexOf("</screen_name>");
                                string End = Start.Substring(0, endIndex);
                                username = End.Replace("<screen_name>", "");
                            }

                        }
                        catch (Exception ex)
                        {
                            Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetUserNameFromUserId() -- " + userid + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                            Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetUserNameFromUserId() -- " + userid + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
                        }
                    }

                    else
                    {
                        username = "******";
                    }
                }
            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetUserNameFromUserId() -- " + userid + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetUserNameFromUserId() -- " + userid + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
            }

            return username;
        }
Example #29
0
        public void StartGroupComapaignProcess(ref FacebookUser fbUser)
        {
            try
            {

                if (isStopGroupCamapinScheduler)
                {
                    return;
                }

                List<string> lstallgroup_EachAccount = new List<string>();
                Queue<string> Queue_GroupUrls = new Queue<string>();
                int spanhour = 0;
                int spanminut = 0;
                int NumberofHour = 1;

                try
                {
                    int timeforperMessages = (NumberofHour * 60 * 60) / faceboardpro.FbGroupCampaignManagerGlobals.NoOfMessageserHour;

                    int delayMessageSending = timeforperMessages * 1000 + Utils.GenerateRandom(1 * 1000, 5 * 1000);
                }
                catch (Exception ex)
                {
                    //GlobusLogHelper.log.Error(ex.StackTrace);
                }



                GlobusHttpHelper globusHttpHelpr = fbUser.globusHttpHelper;
                ChilkatHttpHelpr chilkatHttpHelpr = new ChilkatHttpHelpr();



                string homePageSource = globusHttpHelpr.getHtmlfromUrl(new Uri(faceboardpro.FBGlobals.Instance.GroupsGroupCampaignManagerGetFaceBookUrl));
                try
                {
                    lstallgroup_EachAccount = FindOwnGroupUrl(ref fbUser);
                    GlobusLogHelper.log.Info("Username : "******" Get GroupUrl : " + lstallgroup_EachAccount.Count);

                    {

                        {
                            try
                            {
                                //Code for Insert data in Databse.
                                // string InsertValue = "insert into tb_GroupCampaignMgmt(Account,GroupUrl,GrpCmpName) values('" + facebooker.Username + "','" + lstallgroup_EachAccount[i] + "','" + GroupCampaigName + "')";
                                //  BaseLib.DataBaseHandler.InsertQuery(InsertValue, "tb_GroupCampaignMgmt");
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error(ex.StackTrace);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    GlobusLogHelper.log.Error(ex.StackTrace);
                }
                bool IsMessagePostingError = false;
                Boolean IssendMessage = false;
                string MessagePostingIssue = string.Empty;
                string username = fbUser.username;
                string message = string.Empty;
                int Grpcounter = 0;
                List<string> lstallgroup_EachAccount1 = new List<string>();
                int Conuter = 0;
                while (true)
                {
                    try
                    {
                        if (fbUser.isloggedin)
                        {
                            string grpurl = string.Empty;
                            lock (locker_Queue_UserIDs)
                            {
                                if (Queue_GroupUrls.Count == 0)
                                {
                                    try
                                    {
                                        foreach (var item in lstallgroup_EachAccount)
                                        {
                                            try
                                            {
                                                lstallgroup_EachAccount1.Add(item);
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusLogHelper.log.Error(ex.StackTrace);
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(ex.StackTrace);
                                    }

                                    Conuter = lstallgroup_EachAccount.Count;

                                    foreach (string item in lstallgroup_EachAccount)
                                    {
                                        try
                                        {
                                            Queue_GroupUrls.Enqueue(item);
                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusLogHelper.log.Error(ex.StackTrace);
                                        }
                                    }
                                }
                                try
                                {
                                    grpurl = Queue_GroupUrls.Dequeue();
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error(ex.StackTrace);
                                }
                            }

                            if (Conuter == Grpcounter && !chkCountinueProcessGroupCamapinScheduler)
                            {
                                GlobusLogHelper.log.Info("Process completed with  :  " + username);
                                GlobusLogHelper.log.Debug("Process completed with  :  " + username);

                                break;
                            }
                            Grpcounter++;
                            {

                                if (faceboardpro.FbGroupCampaignManagerGlobals.MessageMode == "One Message")
                                {
                                    message = faceboardpro.FbGroupCampaignManagerGlobals.TextMessage;
                                }
                                else
                                {
                                    lock (locker_Queue_Messages)
                                    {
                                        if (Queue_Messages.Count == 0)
                                        {
                                            try
                                            {
                                                if (LstMessageUrlsGroupCampaignManager.Count > 0)
                                                {
                                                    foreach (string item in LstMessageUrlsGroupCampaignManager)
                                                    {
                                                        try
                                                        {
                                                            Queue_Messages.Enqueue(item);
                                                        }
                                                        catch (Exception ex)
                                                        {
                                                            GlobusLogHelper.log.Error(ex.StackTrace);
                                                        }
                                                    }
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusLogHelper.log.Error(ex.StackTrace);
                                            }
                                        }
                                        try
                                        {
                                            message = Queue_Messages.Dequeue();

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

                                string Picpath = string.Empty;
                                string VideoUrl = string.Empty;

                                try
                                {
                                    // Picpath = LstPicUrlsGroupCampaignManager[new Random().Next(0, LstPicUrlsGroupCampaignManager.Count - 1)];
                                    Picpath = LstPicUrlsGroupCampaignManager[new Random().Next(LstPicUrlsGroupCampaignManager.Count)];

                                    //Picpath = "C:\\Users\\Public\\Pictures\\Sample Pictures";
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                }
                                try
                                {
                                    VideoUrl = LstVideoUrlsGroupCampaignManager[new Random().Next(0, LstVideoUrlsGroupCampaignManager.Count - 1)];
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                }


                                if (faceboardpro.FbGroupCampaignManagerGlobals.MessageMode == "One Message")
                                {

                                    
                                    if (faceboardpro.FbGroupCampaignManagerGlobals.MessageType == "Only Picture with message")
                                    {
                                        try
                                        {
                                            IssendMessage = false;
                                            message = faceboardpro.FbGroupCampaignManagerGlobals.TextMessage;

                                            if (ChkViewSchedulerTaskUniquePostPerGroup == true)
                                            {
                                                DataSet ds = new DataSet();
                                                RaiseEventGrpCampaignMgr(ds, "Model : GroupCompaignRepository", "Function :  CheckGroupCompaignReport", grpurl, message);

                                                if (CheckDataBaseGroupCampaimanager == false)
                                                {
                                                    GlobusLogHelper.log.Debug(" Message All ready send  >>  " + message + " GroupUrl  >>>" + grpurl);
                                                }
                                                else
                                                {
                                                    IssendMessage = SendingPicMsgToOwnGroup(grpurl, message, Picpath, ref fbUser);
                                                    // IssendMessage = SendingPicMsgToOwnGroup(grpurl, message, List<string> Picpath, ref fbUser);
                                                }
                                            }
                                            else if (ChkViewSchedulerTaskUniquePostPerGroup == false)
                                            {
                                                if (ChkbGroupGrpRequestManagerMultiplePicPerGroup == true)
                                                {
                                                    IssendMessage = SendingPicMsgToOwnGroup(grpurl, message, LstPicUrlsGroupCampaignManager, ref fbUser);
                                                }
                                                else
                                                {
                                                    IssendMessage = SendingPicMsgToOwnGroup(grpurl, message, Picpath, ref fbUser);
                                                }
                                            }

                                            if (IssendMessage)
                                            {

                                                Message_Counter++;
                                                TimeCounter++;
                                                GlobusLogHelper.log.Info(Message_Counter + " Message : " + message + " and Picture Path " + Picpath + " Sent to : " + grpurl + " Using UserName : "******"       Date_Time : " + DateTime.Now);
                                                if (!chkCountinueProcessGroupCamapinScheduler)
                                                {
                                                    ///Insert query
                                                }
                                                string GetPostUrl = string.Empty;
                                                string Pagesource = globusHttpHelpr.getHtmlfromUrl(new Uri(grpurl));
                                                int i = 0;
                                                if (IssendMessage)
                                                {
                                                    if (string.IsNullOrEmpty(GetPostUrl))
                                                    {
                                                        try
                                                        {
                                                            string[] arr = System.Text.RegularExpressions.Regex.Split(Pagesource, "<span class=\"fsm fwn fcg\">");

                                                            foreach (var arr_item in arr)
                                                            {
                                                                try
                                                                {
                                                                    i = i + 1;
                                                                   
                                                                    if (arr_item.Contains("Just now") && !arr_item.Contains("<!DOCTYPE html>"))
                                                                    {
                                                                        GetPostUrl = Utils.getBetween(arr_item, "href=\"", "&amp;");
                                                                        if (GetPostUrl.Contains("<abbr"))
                                                                        {
                                                                            string[] arr11 = System.Text.RegularExpressions.Regex.Split(GetPostUrl,"<abbr");
                                                                            if (arr11[0].Contains("facebook.com"))
                                                                            {
                                                                                GetPostUrl = arr11[0];
                                                                            }
                                                                            else
                                                                            {
                                                                                GetPostUrl="https://www.facebook.com/"+arr11[0];
                                                                            }
                                                                        }
                                                                        break;
                                                                    }
                                                                    if (i == 4)
                                                                    {
                                                                        break;
                                                                    }
                                                                }
                                                                catch (Exception ex)
                                                                {
                                                                    GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                                }
                                                            }

                                                          if(Pagesource.Contains("posts pending approval"))
                                                            {
                                                                GetPostUrl = "Post pending approval.";
                                                            }
                                                            else if(string.IsNullOrEmpty(GetPostUrl) && !Pagesource.Contains("post pending approval."))
                                                            {
                                                                string[] arr11 = System.Text.RegularExpressions.Regex.Split(Pagesource, "<span class=\"fsm fwn fcg\">");
                                                                GetPostUrl =  Utils.getBetween(arr11[1], "href=\"", "&amp;").Replace("amp;", "").Replace("\"", "").Trim();
                                                                if (!GetPostUrl.Contains("www.facebook.com"))
                                                                {
                                                                    GetPostUrl = "https://www.facebook.com" + GetPostUrl;
                                                                }
                                                            }

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



                                                try
                                                {
                                                    string CSVHeader = "UserAccount" + "," + "GroupUrl" + "," + "message" + "," + "FilePath" + "," +"PostUrl" +"," + "DateTime";
                                                    string CSV_Content = username + "," + grpurl + "," + message.Replace(",", string.Empty) + "," + Picpath + "," + GetPostUrl + "," + DateTime.Now;
                                                    Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, GroupReportExprotFilePath);
                                                }
                                                catch (Exception ex)
                                                {
                                                    GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                }


                                                if (TimeCounter >= CheckGroupCompaignNoOfGroupsInBatch)
                                                {
                                                    if (ScheduleGroupPosting)
                                                    {
                                                        TimeCounter = 0;
                                                        GlobusLogHelper.log.Debug("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);

                                                        // TimeCounter = 0;

                                                        Thread.Sleep(1 * 1000 * 60 * CheckGroupCompaign_InterbalInMinuts);
                                                        GlobusLogHelper.log.Debug("Process Continue ..  With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Process Continue . With :" + fbUser.username);
                                                    }
                                                    else
                                                    {
                                                        try
                                                        {
                                                            int delayInSeconds = Utils.GenerateRandom(minDelayGroupManager * 1000, maxDelayGroupManager * 1000);
                                                            GlobusLogHelper.log.Info("Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Error  >>>" + ex.StackTrace);
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    //int delayInSeconds = Utils.GenerateRandom(2 * 1000, 5 * 1000);
                                                    ///Added by gargi on 17th August 2013
                                                    try
                                                    {
                                                        int delayInSeconds = Utils.GenerateRandom(minDelayGroupManager * 1000, maxDelayGroupManager * 1000);
                                                        GlobusLogHelper.log.Info("Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Error  >>>" + ex.StackTrace);
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                //GlobusLogHelper.log.Info("You have been temporarily blocked from performing this action." + grpurl);
                                                //GlobusLogHelper.log.Debug("You have been temporarily blocked from performing this action." + grpurl);
                                                GlobusLogHelper.log.Info("Unable to post on : " + grpurl + " With Username " + fbUser.username);
                                                GlobusLogHelper.log.Debug("Unable to post on : " + grpurl + " With Username " + fbUser.username);

                                                try
                                                {
                                                    string CSVHeader = "UserAccount" + "," + "GroupUrl" + "," + "message" + "," + "FilePath" + "," + "DateTime";
                                                    string CSV_Content = username + "," + grpurl + "," + message.Replace(",", string.Empty) + "," + Picpath + "," + DateTime.Now;
                                                    Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, GroupReportExprotFilePath);
                                                }
                                                catch (Exception ex)
                                                {
                                                    GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                }
                                                try
                                                {
                                                    //int delayInSeconds = Utils.GenerateRandom(minDelayGroupManager * 1000, maxDelayGroupManager * 1000);
                                                    //GlobusLogHelper.log.Info("Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Error  >>>" + ex.StackTrace);
                                                }
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                        }
                                    }
                                    else if (faceboardpro.FbGroupCampaignManagerGlobals.MessageType == "Only Message")
                                    {
                                        try
                                        {
                                            IssendMessage = false;
                                            message = faceboardpro.FbGroupCampaignManagerGlobals.TextMessage;

                                            if (ChkViewSchedulerTaskUniquePostPerGroup == true)
                                            {
                                                DataSet ds = new DataSet();
                                                RaiseEventGrpCampaignMgr(ds, "Model : GroupCompaignRepository", "Function :  CheckGroupCompaignReport", grpurl, message);

                                                if (CheckDataBaseGroupCampaimanager == false)
                                                {
                                                    GlobusLogHelper.log.Debug(" Message All ready send  >>  " + message + " GroupUrl  >>>" + grpurl);
                                                }
                                                else
                                                {
                                                    IssendMessage = SendingMsgToGroups(grpurl, message, ref fbUser);

                                                    try
                                                    {
                                                        string CSVHeader = "UserAccount" + "," + "GroupUrl" + "," + "message" + "," + "FilePath" + "," + "DateTime";
                                                        string CSV_Content = username + "," + grpurl + "," + message.Replace(",", string.Empty) + "," + Picpath + "," + DateTime.Now;
                                                        Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, GroupReportExprotFilePath);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                    }
                                                }
                                            }
                                            else if (ChkViewSchedulerTaskUniquePostPerGroup == false)
                                            {
                                                IssendMessage = SendingMsgToGroups(grpurl, message, ref fbUser);
                                                //IssendMessage = SendingPicMsgToOwnGroup(grpurl, message, Picpath, ref fbUser);

                                                try
                                                {
                                                    string CSVHeader = "UserAccount" + "," + "GroupUrl" + "," + "message" + "," + "FilePath" + "," + "DateTime";
                                                    string CSV_Content = username + "," + grpurl + "," + message.Replace(",", string.Empty) + "," + Picpath + "," + DateTime.Now;
                                                    Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, GroupReportExprotFilePath);
                                                }
                                                catch (Exception ex)
                                                {
                                                    GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                }
                                            }
                                            if (IssendMessage)
                                            {
                                                Message_Counter++;
                                                TimeCounter++;
                                                GlobusLogHelper.log.Info(Message_Counter + " Message : " + message + " Sent to : " + grpurl + " Using UserName : "******"       Date_Time : " + DateTime.Now);
                                                if (!chkCountinueProcessGroupCamapinScheduler)
                                                {
                                                    ///Insert query 

                                                }
                                                if (TimeCounter >= CheckGroupCompaignNoOfGroupsInBatch)
                                                {
                                                    if (ScheduleGroupPosting)
                                                    {
                                                        TimeCounter = 0;
                                                        GlobusLogHelper.log.Debug("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);

                                                        // TimeCounter = 0;

                                                        Thread.Sleep(1 * 1000 * 60 * CheckGroupCompaign_InterbalInMinuts);
                                                        GlobusLogHelper.log.Debug("Process Continue ..  With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Process Continue . With :" + fbUser.username);
                                                    }
                                                    else
                                                    {
                                                        try
                                                        {
                                                            int delayInSeconds = Utils.GenerateRandom(minDelayGroupManager * 1000, maxDelayGroupManager * 1000);
                                                            GlobusLogHelper.log.Info("Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Only Video")
                                    {
                                        try
                                        {
                                            message = faceboardpro.FbGroupCampaignManagerGlobals.TextMessage;
                                            IssendMessage = false;

                                            //check database 
                                            if (ChkViewSchedulerTaskUniquePostPerGroup == true)
                                            {
                                                DataSet ds = new DataSet();
                                                RaiseEventGrpCampaignMgr(ds, "Model : GroupCompaignRepository", "Function :  CheckGroupCompaignReport", grpurl, VideoUrl);

                                                if (CheckDataBaseGroupCampaimanager == false)
                                                {
                                                    GlobusLogHelper.log.Debug(" Message All ready send  >>  " + VideoUrl + " GroupUrl  >>>" + grpurl);

                                                }
                                                else
                                                {
                                                    if (VideoUrl.Contains("/photos/a"))
                                                    {
                                                        IssendMessage = PostVideoUrlUpdated(grpurl, message, VideoUrl, ref  fbUser);
                                                    }
                                                    else
                                                    {
                                                        IssendMessage = PostVideoUrl(grpurl, message, VideoUrl, ref  fbUser);//, ref facebooker.Password, ref globusHttpHelpr);
                                                    }
                                                    string GetPostUrl = string.Empty;
                                                    string Pagesource = globusHttpHelpr.getHtmlfromUrl(new Uri(grpurl));
                                                    if (IssendMessage)
                                                    {
                                                        if (!Pagesource.Contains("<span class=\"_50f8 _50f7\">PINNED POST</span>"))
                                                        {
                                                            string[] arr = System.Text.RegularExpressions.Regex.Split(Pagesource, "<span class=\"fsm fwn fcg\">");
                                                            GetPostUrl = "https://www.facebook.com" + Utils.getBetween(arr[1], "href=\"", "/\"><abbr title=\"").Replace("amp;", "").Replace("\"", "").Trim();
                                                        }
                                                    }

                                                    try
                                                    {
                                                        string CSVHeader = "UserAccount" + "," + "GroupUrl" + "," + "message" + "," + "FilePath" + "," + "PostUrl" + "," + "DateTime";
                                                        string CSV_Content = username + "," + grpurl + "," + message.Replace(",", string.Empty) + "," + Picpath + "," + GetPostUrl + "," + DateTime.Now;
                                                        Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, GroupReportExprotFilePath);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                    }
                                                }
                                            }
                                            else if (ChkViewSchedulerTaskUniquePostPerGroup == false)
                                            {
                                                if (VideoUrl.Contains("/photos/a"))
                                                {
                                                    IssendMessage = PostVideoUrlUpdated(grpurl, message, VideoUrl, ref  fbUser);
                                                }
                                                else
                                                {
                                                    IssendMessage = PostVideoUrl(grpurl, message, VideoUrl, ref  fbUser);
                                                }
                                               
                                               
                                                string GetPostUrl = string.Empty;
                                                string Pagesource = globusHttpHelpr.getHtmlfromUrl(new Uri(grpurl));
                                                if (IssendMessage)
                                                {
                                                    if (Pagesource.Contains("post pending approval."))
                                                    {
                                                        GetPostUrl = "pending approval.";
                                                    }
                                                    else if (!Pagesource.Contains("<span class=\"_50f8 _50f7\">PINNED POST</span>")&&!Pagesource.Contains("post pending approval."))
                                                    {
                                                        string[] arr = System.Text.RegularExpressions.Regex.Split(Pagesource, "<span class=\"fsm fwn fcg\">");
                                                        GetPostUrl = "https://www.facebook.com" + Utils.getBetween(arr[1], "href=\"", "/\"><abbr title=\"").Replace("amp;", "").Replace("\"", "").Trim();
                                                    }

                                                    if (string.IsNullOrEmpty(GetPostUrl))
                                                    {
                                                        try
                                                        {
                                                            string[] arr = System.Text.RegularExpressions.Regex.Split(Pagesource, "<span class=\"fsm fwn fcg\">");
                                                            int i = 0;
                                                            foreach (var arr_item in arr)
                                                            {
                                                                try
                                                                {
                                                                    i = i + 1;
                                                                    if (arr_item.Contains("Just now") && !arr_item.Contains("<!DOCTYPE html>"))
                                                                    {
                                                                        GetPostUrl = "https://www.facebook.com" + Utils.getBetween(arr_item, "href=\"", "\"><abbr");
                                                                        break;
                                                                    }
                                                                    if (i==4)
                                                                    {
                                                                        break;
                                                                    }
                                                                }
                                                                catch (Exception ex)
                                                                {
                                                                    GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                                }
                                                            }
                                                            
                                                        }
                                                        catch (Exception ex)
                                                        {
                                                            GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                        }
                                                    }
                                                }


                                                try
                                                {
                                                    string CSVHeader = "UserAccount" + "," + "GroupUrl" + "," + "message" + "," + "FilePath" + "," + "PostUrl" + "," + "DateTime";
                                                    string CSV_Content = username + "," + grpurl + "," + message.Replace(",", string.Empty) + "," + Picpath + "," + GetPostUrl + "," + DateTime.Now;
                                                    Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, GroupReportExprotFilePath);
                                                }
                                                catch (Exception ex)
                                                {
                                                    GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                }
                                            }

                                            if (IssendMessage)
                                            {
                                                Message_Counter++;
                                                TimeCounter++;
                                                GlobusLogHelper.log.Info(Message_Counter + "Video Url : " + VideoUrl + " Sent to : " + grpurl + " Using UserName : "******"       Date_Time : " + DateTime.Now);
                                                if (!chkCountinueProcessGroupCamapinScheduler)
                                                {
                                                    ///Insert query 

                                                }

                                                if (TimeCounter >= CheckGroupCompaignNoOfGroupsInBatch)
                                                {
                                                    if (ScheduleGroupPosting)
                                                    {
                                                        TimeCounter = 0;
                                                        GlobusLogHelper.log.Debug("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);

                                                        // TimeCounter = 0;

                                                        Thread.Sleep(1 * 1000 * 60 * CheckGroupCompaign_InterbalInMinuts);
                                                        GlobusLogHelper.log.Debug("Process Continue ..  With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Process Continue . With :" + fbUser.username);
                                                    }
                                                    else
                                                    {
                                                        try
                                                        {
                                                            int delayInSeconds = Utils.GenerateRandom(minDelayGroupManager * 1000, maxDelayGroupManager * 1000);
                                                            GlobusLogHelper.log.Info("Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Unable to post on : " + grpurl + " With Username " + fbUser.username);
                                                GlobusLogHelper.log.Debug("Unable to post on : " + grpurl + " With Username " + fbUser.username);
                                                //GlobusLogHelper.log.Info("You have been temporarily blocked from performing this action." + grpurl);
                                                //GlobusLogHelper.log.Debug("You have been temporarily blocked from performing this action." + grpurl);
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusLogHelper.log.Error(ex.StackTrace);
                                        }
                                    }
                                    else if (faceboardpro.FbGroupCampaignManagerGlobals.MessageType == "")
                                    {
                                        try
                                        {
                                            IssendMessage = false;
                                            message = faceboardpro.FbGroupCampaignManagerGlobals.TextMessage;
                                            IssendMessage = SendingMsgToGroups(grpurl, message, ref fbUser);
                                            try
                                            {
                                                string CSVHeader = "UserAccount" + "," + "GroupUrl" + "," + "message" + "," + "FilePath" + "," + "DateTime";
                                                string CSV_Content = username + "," + grpurl + "," + message.Replace(",", string.Empty) + "," + Picpath + "," + DateTime.Now;
                                                Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, GroupReportExprotFilePath);
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                            }

                                            if (IssendMessage)
                                            {
                                                Message_Counter = Message_Counter + 1;
                                                TimeCounter = TimeCounter + 1;
                                                GlobusLogHelper.log.Info("Sent Message to GroupUrl : " + grpurl);
                                                GlobusLogHelper.log.Debug("Sent Message to GroupUrl : " + grpurl);


                                                if (TimeCounter >= CheckGroupCompaignNoOfGroupsInBatch)
                                                {
                                                    if (ScheduleGroupPosting)
                                                    {
                                                        TimeCounter = 0;
                                                        GlobusLogHelper.log.Debug("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);

                                                        // TimeCounter = 0;

                                                        Thread.Sleep(1 * 1000 * 60 * CheckGroupCompaign_InterbalInMinuts);
                                                        GlobusLogHelper.log.Debug("Process Continue ..  With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Process Continue . With :" + fbUser.username);
                                                    }
                                                    else
                                                    {
                                                        try
                                                        {
                                                            int delayInSeconds = Utils.GenerateRandom(minDelayGroupManager * 1000, maxDelayGroupManager * 1000);
                                                            GlobusLogHelper.log.Info("Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Unable to post on : " + grpurl + " With Username " + fbUser.username);
                                                GlobusLogHelper.log.Debug("Unable to post on : " + grpurl + " With Username " + fbUser.username);
                                                //GlobusLogHelper.log.Info("You have been temporarily blocked from performing this action." + grpurl);
                                                //GlobusLogHelper.log.Debug("You have been temporarily blocked from performing this action." + grpurl);

                                            }
                                            if (ChkViewSchedulerTaskUniquePostPerGroup == true)
                                            {
                                                DataSet ds = new DataSet();
                                                RaiseEventGrpCampaignMgr(ds, "Model : GroupCompaignRepository", "Function :  CheckGroupCompaignReport", grpurl, message);

                                                if (CheckDataBaseGroupCampaimanager == false)
                                                {
                                                    GlobusLogHelper.log.Debug(" Message All ready send  >>  " + message + " GroupUrl  >>>" + grpurl);
                                                }
                                                else
                                                {
                                                    IssendMessage = SendingPicMsgToOwnGroup(grpurl, message, Picpath, ref fbUser);
                                                    try
                                                    {
                                                        string CSVHeader = "UserAccount" + "," + "GroupUrl" + "," + "message" + "," + "FilePath" + "," + "DateTime";
                                                        string CSV_Content = username + "," + grpurl + "," + message.Replace(",", string.Empty) + "," + Picpath + "," + DateTime.Now;
                                                        Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, GroupReportExprotFilePath);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                    }
                                                }
                                            }
                                            else if (ChkViewSchedulerTaskUniquePostPerGroup == false)
                                            {
                                                IssendMessage = SendingPicMsgToOwnGroup(grpurl, message, Picpath, ref fbUser);
                                                try
                                                {
                                                    string CSVHeader = "UserAccount" + "," + "GroupUrl" + "," + "message" + "," + "FilePath" + "," + "DateTime";
                                                    string CSV_Content = username + "," + grpurl + "," + message.Replace(",", string.Empty) + "," + Picpath + "," + DateTime.Now;
                                                    Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, GroupReportExprotFilePath);
                                                }
                                                catch (Exception ex)
                                                {
                                                    GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                }
                                            }

                                            if (IssendMessage)
                                            {
                                                Message_Counter = Message_Counter + 1;
                                                TimeCounter++;
                                                GlobusLogHelper.log.Info("Sent Picture Message to GroupUrl : " + grpurl);
                                                GlobusLogHelper.log.Debug("Sent Picture Message to GroupUrl : " + grpurl);


                                                if (TimeCounter >= CheckGroupCompaignNoOfGroupsInBatch)
                                                {
                                                    if (ScheduleGroupPosting)
                                                    {
                                                        TimeCounter = 0;
                                                        GlobusLogHelper.log.Debug("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);

                                                        // TimeCounter = 0;

                                                        Thread.Sleep(1 * 1000 * 60 * CheckGroupCompaign_InterbalInMinuts);
                                                        GlobusLogHelper.log.Debug("Process Continue ..  With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Process Continue . With :" + fbUser.username);
                                                    }
                                                    else
                                                    {
                                                        try
                                                        {
                                                            int delayInSeconds = Utils.GenerateRandom(minDelayGroupManager * 1000, maxDelayGroupManager * 1000);
                                                            GlobusLogHelper.log.Info("Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Unable to post on : " + grpurl + " With Username " + fbUser.username);
                                                GlobusLogHelper.log.Debug("Unable to post on : " + grpurl + " With Username " + fbUser.username);
                                                //GlobusLogHelper.log.Info("You have been temporarily blocked from performing this action." + grpurl);
                                                //GlobusLogHelper.log.Debug("You have been temporarily blocked from performing this action." + grpurl);

                                            }
                                            if (ChkViewSchedulerTaskUniquePostPerGroup == true)
                                            {
                                                DataSet ds = new DataSet();
                                                RaiseEventGrpCampaignMgr(ds, "Model : GroupCompaignRepository", "Function :  CheckGroupCompaignReport", grpurl, VideoUrl);

                                                if (CheckDataBaseGroupCampaimanager)
                                                {
                                                    GlobusLogHelper.log.Debug(" Message All ready send  >>  " + VideoUrl + " GroupUrl  >>>" + grpurl);
                                                }
                                                else
                                                {
                                                    if (VideoUrl.Contains("/photos/a"))
                                                    {
                                                        IssendMessage = PostVideoUrlUpdated(grpurl, message, VideoUrl, ref  fbUser);
                                                    }
                                                    else
                                                    {
                                                        IssendMessage = PostVideoUrl(grpurl, message, VideoUrl, ref fbUser);
                                                    }
                                                    string GetPostUrl = string.Empty;
                                                    string Pagesource = globusHttpHelpr.getHtmlfromUrl(new Uri(grpurl));
                                                    if (IssendMessage)
                                                    {
                                                        if (!Pagesource.Contains("<span class=\"_50f8 _50f7\">PINNED POST</span>"))
                                                        {
                                                            string[] arr = System.Text.RegularExpressions.Regex.Split(Pagesource, "<span class=\"fsm fwn fcg\">");
                                                            GetPostUrl = "https://www.facebook.com" + Utils.getBetween(arr[1], "href=\"", "/\"><abbr title=\"").Replace("amp;", "").Replace("\"", "").Trim();
                                                        }
                                                        else if (Pagesource.Contains("You have 1 post pending approval."))
                                                        {
                                                            GetPostUrl = "You have 1 post pending approval.";
                                                        }
                                                    }

                                                    try
                                                    {
                                                        string CSVHeader = "UserAccount" + "," + "GroupUrl" + "," + "message" + "," + "FilePath" + "," + "PostUrl" + "," + "DateTime";
                                                        string CSV_Content = username + "," + grpurl + "," + message.Replace(",", string.Empty) + "," + Picpath + "," + GetPostUrl + "," + DateTime.Now;
                                                        Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, GroupReportExprotFilePath);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                    }
                                                }
                                            }
                                            else if (ChkViewSchedulerTaskUniquePostPerGroup == false)
                                            {
                                                IssendMessage = PostVideoUrl(grpurl, message, VideoUrl, ref fbUser);

                                                string GetPostUrl = string.Empty;
                                                string Pagesource = globusHttpHelpr.getHtmlfromUrl(new Uri(grpurl));
                                                if (IssendMessage)
                                                {
                                                    if (!Pagesource.Contains("<span class=\"_50f8 _50f7\">PINNED POST</span>"))
                                                    {
                                                        string[] arr = System.Text.RegularExpressions.Regex.Split(Pagesource, "<span class=\"fsm fwn fcg\">");
                                                        GetPostUrl = "https://www.facebook.com" + Utils.getBetween(arr[1], "href=\"", "/\"><abbr title=\"").Replace("amp;", "").Replace("\"", "").Trim();
                                                    }
                                                    else if (Pagesource.Contains("You have 1 post pending approval."))
                                                    {
                                                        GetPostUrl = "You have 1 post pending approval.";
                                                    }
                                                }

                                                try
                                                {
                                                    string CSVHeader = "UserAccount" + "," + "GroupUrl" + "," + "message" + "," + "FilePath" + "," + "PostUrl" + "," + "DateTime";
                                                    string CSV_Content = username + "," + grpurl + "," + message.Replace(",", string.Empty) + "," + Picpath + "," + GetPostUrl + "," + DateTime.Now;
                                                    Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, GroupReportExprotFilePath);
                                                }
                                                catch (Exception ex)
                                                {
                                                    GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                }
                                            }
                                            if (IssendMessage)
                                            {
                                                Message_Counter = Message_Counter + 1;
                                                TimeCounter++;
                                                GlobusLogHelper.log.Info("Sent Video Url to GroupUrl : " + grpurl);
                                                GlobusLogHelper.log.Debug("Sent Video Url to GroupUrl : " + grpurl);

                                            }

                                            if (TimeCounter >= CheckGroupCompaignNoOfGroupsInBatch)
                                            {
                                                if (ScheduleGroupPosting)
                                                {
                                                    TimeCounter = 0;
                                                    GlobusLogHelper.log.Debug("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);
                                                    GlobusLogHelper.log.Info("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);

                                                    // TimeCounter = 0;

                                                    Thread.Sleep(1 * 1000 * 60 * CheckGroupCompaign_InterbalInMinuts);
                                                    GlobusLogHelper.log.Debug("Process Continue ..  With :" + fbUser.username);
                                                    GlobusLogHelper.log.Info("Process Continue . With :" + fbUser.username);
                                                }
                                                else
                                                {
                                                    try
                                                    {
                                                        int delayInSeconds = Utils.GenerateRandom(minDelayGroupManager * 1000, maxDelayGroupManager * 1000);
                                                        GlobusLogHelper.log.Info("Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Only Picture with message")
                                    {
                                        try
                                        {
                                            try
                                            {
                                                Picpath = LstPicUrlsGroupCampaignManager[new Random().Next(0, LstPicUrlsGroupCampaignManager.Count - 1)];
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusLogHelper.log.Error(ex.StackTrace);
                                            }

                                            //try
                                            //{
                                            //    IssendMessage = SendingPicMsgToOwnGroup(grpurl, message, LstPicUrlsGroupCampaignManager, ref fbUser);
                                            //}
                                            //catch (Exception ex)
                                            //{
                                            //    GlobusLogHelper.log.Error(ex.StackTrace);
                                            //}


                                            if (chkCountinueProcessGroupCamapinScheduler == true)
                                            {

                                                IssendMessage = SendingPicMsgToOwnGroup(grpurl, message, LstPicUrlsGroupCampaignManager, ref fbUser);

                                                string GetPostUrl = string.Empty;
                                                string Pagesource = globusHttpHelpr.getHtmlfromUrl(new Uri(grpurl));
                                                int i = 0;
                                                if (IssendMessage)
                                                {
                                                    if (string.IsNullOrEmpty(GetPostUrl))
                                                    {
                                                        try
                                                        {
                                                            string[] arr = System.Text.RegularExpressions.Regex.Split(Pagesource, "<span class=\"fsm fwn fcg\">");

                                                            foreach (var arr_item in arr)
                                                            {
                                                                try
                                                                {
                                                                    i = i + 1;

                                                                    if (arr_item.Contains("Just now") && !arr_item.Contains("<!DOCTYPE html>"))
                                                                    {
                                                                        GetPostUrl = Utils.getBetween(arr_item, "href=\"", "&amp;");
                                                                        if (GetPostUrl.Contains("<abbr"))
                                                                        {
                                                                            string[] arr11 = System.Text.RegularExpressions.Regex.Split(GetPostUrl, "<abbr");
                                                                            if (arr11[0].Contains("facebook.com"))
                                                                            {
                                                                                GetPostUrl = arr11[0];
                                                                            }
                                                                            else
                                                                            {
                                                                                GetPostUrl = "https://www.facebook.com/" + arr11[0];
                                                                            }
                                                                        }
                                                                        break;
                                                                    }
                                                                    if (i == 4)
                                                                    {
                                                                        break;
                                                                    }
                                                                }
                                                                catch (Exception ex)
                                                                {
                                                                    GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                                }
                                                            }

                                                            if (Pagesource.Contains("posts pending approval"))
                                                            {
                                                                GetPostUrl = "Post pending approval.";
                                                            }
                                                            else if (string.IsNullOrEmpty(GetPostUrl) && !Pagesource.Contains("post pending approval."))
                                                            {
                                                                string[] arr11 = System.Text.RegularExpressions.Regex.Split(Pagesource, "<span class=\"fsm fwn fcg\">");
                                                                GetPostUrl = Utils.getBetween(arr11[1], "href=\"", "&amp;").Replace("amp;", "").Replace("\"", "").Trim();
                                                                if (!GetPostUrl.Contains("www.facebook.com"))
                                                                {
                                                                    GetPostUrl = "https://www.facebook.com" + GetPostUrl;
                                                                }
                                                            }

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


                                                try
                                                {
                                                    string CSVHeader = "UserAccount" + "," + "GroupUrl" + "," + "message" + "," + "FilePath" + "," + "PicturePostUrl" + "," + "DateTime";
                                                    string CSV_Content = username + "," + grpurl + "," + message.Replace(",", string.Empty) + "," + Picpath + "," + GetPostUrl + "," + DateTime.Now;
                                                    Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, GroupReportExprotFilePath);
                                                }
                                                catch (Exception ex)
                                                {
                                                    GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                }
                                            }

                                            else
                                            {
                                                if (ChkbGroupGrpRequestManagerMultiplePicPerGroup == true)
                                                {

                                                    IssendMessage = SendingPicMsgToOwnGroup(grpurl, message, LstPicUrlsGroupCampaignManager, ref fbUser);



                                                    //IssendMessage = SendingPicMsgToOwnGroup(grpurl, message, Picpath, ref fbUser);

                                                    string GetPostUrl = string.Empty;
                                                    string Pagesource = globusHttpHelpr.getHtmlfromUrl(new Uri(grpurl));
                                                    int i = 0;
                                                    if (IssendMessage)
                                                    {
                                                        if (string.IsNullOrEmpty(GetPostUrl))
                                                        {
                                                            try
                                                            {
                                                                string[] arr = System.Text.RegularExpressions.Regex.Split(Pagesource, "<span class=\"fsm fwn fcg\">");

                                                                foreach (var arr_item in arr)
                                                                {
                                                                    try
                                                                    {
                                                                        i = i + 1;

                                                                        if (arr_item.Contains("Just now") && !arr_item.Contains("<!DOCTYPE html>"))
                                                                        {
                                                                            GetPostUrl = Utils.getBetween(arr_item, "href=\"", "&amp;");
                                                                            if (GetPostUrl.Contains("<abbr"))
                                                                            {
                                                                                string[] arr11 = System.Text.RegularExpressions.Regex.Split(GetPostUrl, "<abbr");
                                                                                if (arr11[0].Contains("facebook.com"))
                                                                                {
                                                                                    GetPostUrl = arr11[0].Replace("/\">",string.Empty);
                                                                                }
                                                                                else
                                                                                {
                                                                                    GetPostUrl = "https://www.facebook.com" + arr11[0].Replace("/\">", string.Empty); 
                                                                                }
                                                                            }
                                                                            break;
                                                                        }
                                                                        if (i == 4)
                                                                        {
                                                                            break;
                                                                        }
                                                                    }
                                                                    catch (Exception ex)
                                                                    {
                                                                        GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                                    }
                                                                }

                                                                if (Pagesource.Contains("posts pending approval"))
                                                                {
                                                                    GetPostUrl = "Post pending approval.";
                                                                }
                                                                else if (string.IsNullOrEmpty(GetPostUrl) && !Pagesource.Contains("post pending approval."))
                                                                {
                                                                    string[] arr11 = System.Text.RegularExpressions.Regex.Split(Pagesource, "<span class=\"fsm fwn fcg\">");
                                                                    GetPostUrl = Utils.getBetween(arr11[1], "href=\"", "&amp;").Replace("amp;", "").Replace("\"", "").Replace("/\">", string.Empty).Trim();
                                                                    if (!GetPostUrl.Contains("www.facebook.com"))
                                                                    {
                                                                        GetPostUrl = "https://www.facebook.com" + GetPostUrl.Replace("/\">", string.Empty); ;
                                                                    }
                                                                }

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


                                                    try
                                                    {
                                                        string CSVHeader = "UserAccount" + "," + "GroupUrl" + "," + "message" + "," + "FilePath" + "," + "PicturePostUrl" + "," + "DateTime";
                                                        string CSV_Content = username + "," + grpurl + "," + message.Replace(",", string.Empty) + "," + Picpath + "," + GetPostUrl + "," + DateTime.Now;
                                                        Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, GroupReportExprotFilePath);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                    }
                                                }
                                                else
                                                {
                                                    if (isPostMessageWithImageAsEdited)
                                                    {
                                                        IssendMessage = SendingPicMsgToOwnGroupAsEdited(grpurl, message, Picpath, ref fbUser);
                                                    }
                                                    else
                                                    {
                                                        IssendMessage = SendingPicMsgToOwnGroup(grpurl, message, Picpath, ref fbUser);
                                                    }
                                                      string GetPostUrl = string.Empty;




                                                    //string GetPostUrl = string.Empty;
                                                    string Pagesource = globusHttpHelpr.getHtmlfromUrl(new Uri(grpurl));
                                                    int i = 0;
                                                    if (IssendMessage)
                                                    {
                                                        if (string.IsNullOrEmpty(GetPostUrl))
                                                        {
                                                            try
                                                            {
                                                                string[] arr = System.Text.RegularExpressions.Regex.Split(Pagesource, "<span class=\"fsm fwn fcg\">");

                                                                foreach (var arr_item in arr)
                                                                {
                                                                    try
                                                                    {
                                                                        i = i + 1;

                                                                        if (arr_item.Contains("Just now") && !arr_item.Contains("<!DOCTYPE html>"))
                                                                        {
                                                                            GetPostUrl = Utils.getBetween(arr_item, "href=\"", "&amp;");
                                                                            if (GetPostUrl.Contains("<abbr"))
                                                                            {
                                                                                string[] arr11 = System.Text.RegularExpressions.Regex.Split(GetPostUrl, "<abbr");
                                                                                if (arr11[0].Contains("facebook.com"))
                                                                                {
                                                                                    GetPostUrl = arr11[0].Replace("/\">", string.Empty);
                                                                                }
                                                                                else
                                                                                {
                                                                                    GetPostUrl = "https://www.facebook.com" + arr11[0].Replace("/\">", string.Empty);
                                                                                }
                                                                            }
                                                                            break;
                                                                        }
                                                                        if (i == 4)
                                                                        {
                                                                            break;
                                                                        }
                                                                    }
                                                                    catch (Exception ex)
                                                                    {
                                                                        GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                                    }
                                                                }

                                                                if (Pagesource.Contains("posts pending approval"))
                                                                {
                                                                    GetPostUrl = "Post pending approval.";
                                                                }
                                                                else if (string.IsNullOrEmpty(GetPostUrl) && !Pagesource.Contains("post pending approval."))
                                                                {
                                                                    string[] arr11 = System.Text.RegularExpressions.Regex.Split(Pagesource, "<span class=\"fsm fwn fcg\">");
                                                                    GetPostUrl = Utils.getBetween(arr11[1], "href=\"", "&amp;").Replace("amp;", "").Replace("\"", "").Replace("/\">", string.Empty).Trim();
                                                                    if (!GetPostUrl.Contains("www.facebook.com"))
                                                                    {
                                                                        GetPostUrl = "https://www.facebook.com" + GetPostUrl.Replace("/\">", string.Empty); ;
                                                                    }
                                                                }

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


                                                    try
                                                    {
                                                        string CSVHeader = "UserAccount" + "," + "GroupUrl" + "," + "message" + "," + "FilePath" + "," + "PicturePostUrl" + "," + "DateTime";
                                                        string CSV_Content = username + "," + grpurl + "," + message.Replace(",", string.Empty) + "," + Picpath + "," + GetPostUrl + "," + DateTime.Now;
                                                        Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, GroupReportExprotFilePath);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                    }
                                                }
                                            }

                                            if (IssendMessage)
                                            {
                                                Message_Counter++;
                                                TimeCounter++;
                                                GlobusLogHelper.log.Info(Message_Counter + " Message : " + message + " and Picture Path " + Picpath + " Sent to : " + grpurl + " Using UserName : "******"       Date_Time : " + DateTime.Now);
                                                GlobusLogHelper.log.Debug(Message_Counter + " Message : " + message + " and Picture Path " + Picpath + " Sent to : " + grpurl + " Using UserName : "******"       Date_Time : " + DateTime.Now);
                                                if (!chkCountinueProcessGroupCamapinScheduler)
                                                {
                                                    ///Insert query 

                                                }


                                                if (TimeCounter >= CheckGroupCompaignNoOfGroupsInBatch)
                                                {
                                                    if (ScheduleGroupPosting)
                                                    {
                                                        TimeCounter = 0;
                                                        GlobusLogHelper.log.Debug("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);

                                                        // TimeCounter = 0;

                                                        Thread.Sleep(1 * 1000 * 60 * CheckGroupCompaign_InterbalInMinuts);
                                                        GlobusLogHelper.log.Debug("Process Continue ..  With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Process Continue . With :" + fbUser.username);
                                                    }
                                                    else
                                                    {
                                                        try
                                                        {
                                                            int delayInSeconds = Utils.GenerateRandom(minDelayGroupManager * 1000, maxDelayGroupManager * 1000);
                                                            GlobusLogHelper.log.Info("Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Unable to post on : " + grpurl + " With User "+fbUser.username);
                                                GlobusLogHelper.log.Debug("Unable to post on : " + grpurl + " With User " + fbUser.username);
                                                // GlobusLogHelper.log.Info("You have been temporarily blocked from performing this action." + grpurl);
                                                // GlobusLogHelper.log.Debug("You have been temporarily blocked from performing this action." + grpurl);

                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusLogHelper.log.Error(ex.StackTrace);
                                        }
                                    }
                                    else if (faceboardpro.FbGroupCampaignManagerGlobals.MessageType == "Only Message")
                                    {
                                        try
                                        {
                                            try
                                            {
                                                IssendMessage = SendingMsgToGroups(grpurl, message, ref fbUser);
                                               

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


                                            if (IssendMessage)
                                            {
                                                Message_Counter++;
                                                TimeCounter++;
                                                GlobusLogHelper.log.Info(Message_Counter + " Message : " + message + " Sent to : " + grpurl + " Using UserName : "******"       Date_Time : " + DateTime.Now);
                                                GlobusLogHelper.log.Debug(Message_Counter + " Message : " + message + " Sent to : " + grpurl + " Using UserName : "******"       Date_Time : " + DateTime.Now);

                                                if (!chkCountinueProcessGroupCamapinScheduler)
                                                {
                                                    ///Insert query 

                                                }


                                                if (TimeCounter >= CheckGroupCompaignNoOfGroupsInBatch)
                                                {
                                                    if (ScheduleGroupPosting)
                                                    {
                                                        TimeCounter = 0;
                                                        GlobusLogHelper.log.Debug("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);

                                                        // TimeCounter = 0;

                                                        Thread.Sleep(1 * 1000 * 60 * CheckGroupCompaign_InterbalInMinuts);
                                                        GlobusLogHelper.log.Debug("Process Continue ..  With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Process Continue . With :" + fbUser.username);
                                                    }
                                                    else
                                                    {
                                                        try
                                                        {
                                                            int delayInSeconds = Utils.GenerateRandom(minDelayGroupManager * 1000, maxDelayGroupManager * 1000);
                                                            GlobusLogHelper.log.Info("Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Unable to post on : " + grpurl+" With Username "+fbUser.username);
                                                GlobusLogHelper.log.Debug("Unable to post on : " + grpurl + " With Username " + fbUser.username);
                                                //GlobusLogHelper.log.Info("You have been temporarily blocked from performing this action." + grpurl);
                                                //GlobusLogHelper.log.Debug("You have been temporarily blocked from performing this action." + grpurl);

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

                                    else if (faceboardpro.FbGroupCampaignManagerGlobals.MessageType == "Only Video")
                                    {
                                        try
                                        {

                                            string VideoUrlMsg = LstVideoUrlsGroupCampaignManager[new Random().Next(0, LstVideoUrlsGroupCampaignManager.Count)];
                                            IssendMessage = false;
                                            try
                                            {
                                                if (ChkViewSchedulerTaskUniquePostPerGroup == true)
                                                {
                                                    DataSet ds = new DataSet();
                                                    RaiseEventGrpCampaignMgr(ds, "Model : GroupCompaignRepository", "Function :  CheckGroupCompaignReport", grpurl, VideoUrlMsg);

                                                    if (CheckDataBaseGroupCampaimanager == false)
                                                    {
                                                        GlobusLogHelper.log.Debug(" Message All ready send  >>  " + VideoUrlMsg + " GroupUrl  >>>" + grpurl);

                                                    }
                                                    else
                                                    {
                                                        if (VideoUrl.Contains("/photos/a"))
                                                        {
                                                            IssendMessage = PostVideoUrlUpdated(grpurl, message, VideoUrl, ref  fbUser);
                                                        }
                                                        else
                                                        {
                                                            IssendMessage = PostVideoUrl(grpurl, message, VideoUrlMsg, ref fbUser);
                                                        }
                                                        string GetPostUrl = string.Empty;
                                                        string Pagesource = globusHttpHelpr.getHtmlfromUrl(new Uri(grpurl));
                                                        if (IssendMessage)
                                                        {
                                                            if (!Pagesource.Contains("<span class=\"_50f8 _50f7\">PINNED POST</span>"))
                                                            {
                                                                try
                                                                {
                                                                    string[] arr = System.Text.RegularExpressions.Regex.Split(Pagesource, "<span class=\"fsm fwn fcg\">");
                                                                    GetPostUrl = "https://www.facebook.com" + Utils.getBetween(arr[1], "href=\"", "/\"><abbr title=\"").Replace("amp;", "").Replace("\"", "").Trim();
                                                                }
                                                                catch (Exception ex)
                                                                {
                                                                    GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                                }

                                                            }
                                                            else if (Pagesource.Contains("You have 1 post pending approval."))
                                                            {
                                                                GetPostUrl = "You have 1 post pending approval.";
                                                            }
                                                        }

                                                        try
                                                        {
                                                            string CSVHeader = "UserAccount" + "," + "GroupUrl" + "," + "message" + "," + "FilePath" + "," + "PostUrl" + "," + "DateTime";
                                                            string CSV_Content = username + "," + grpurl + "," + message.Replace(",",string.Empty) + "," + Picpath + "," + GetPostUrl + "," + DateTime.Now;
                                                            Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, GroupReportExprotFilePath);
                                                        }
                                                        catch (Exception ex)
                                                        {
                                                            GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                        }
                                                    }
                                                }
                                                else if (ChkViewSchedulerTaskUniquePostPerGroup == false)
                                                {
                                                    string GetPostUrl = string.Empty;
                                                    if (isPostVideoUrlAsImage)
                                                    {
                                                        PostVideoUrlasImage(grpurl, message, VideoUrlMsg, ref fbUser);
                                                    }
                                                    else
                                                    {
                                                        if (VideoUrl.Contains("/photos/a"))
                                                        {
                                                            IssendMessage = PostVideoUrlUpdated(grpurl, message, VideoUrl, ref  fbUser);
                                                        }
                                                        else
                                                        {
                                                            IssendMessage = PostVideoUrl(grpurl, message, VideoUrlMsg, ref fbUser);
                                                        }
                                                        if (IssendMessage)
                                                        {
                                                            //IssendMessage = PostVideoUrlNew(grpurl, message, VideoUrlMsg, ref fbUser);
                                                        }
                                                      
                                                       
                                                        string Pagesource = globusHttpHelpr.getHtmlfromUrl(new Uri(grpurl));
                                                        if (IssendMessage)
                                                        {
                                                            if (!Pagesource.Contains("<span class=\"_50f8 _50f7\">PINNED POST</span>"))
                                                            {
                                                                try
                                                                {
                                                                    string[] arr = System.Text.RegularExpressions.Regex.Split(Pagesource, "<span class=\"fsm fwn fcg\">");
                                                                    GetPostUrl = "https://www.facebook.com" + Utils.getBetween(arr[1], "href=\"", "/\"><abbr title=\"").Replace("amp;", "").Replace("\"", "").Trim();
                                                                }
                                                                catch (Exception ex)
                                                                {
                                                                    GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                                }

                                                            }
                                                            else if (Pagesource.Contains("You have 1 post pending approval."))
                                                            {
                                                                GetPostUrl = "You have 1 post pending approval.";
                                                            }
                                                        }
                                                    }
                                                    try
                                                    {
                                                        string CSVHeader = "UserAccount" + "," + "GroupUrl" + "," + "message" + "," + "FilePath" + "," + "PostUrl" + "," + "DateTime";
                                                        string CSV_Content = username + "," + grpurl + "," + message.Replace(",", string.Empty) + "," + Picpath + "," + GetPostUrl + "," + DateTime.Now;
                                                        Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, GroupReportExprotFilePath);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                    }
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusLogHelper.log.Error(ex.StackTrace);
                                            }

                                            if (IssendMessage)
                                            {
                                                Message_Counter++;
                                                TimeCounter++;
                                                GlobusLogHelper.log.Info(Message_Counter + "Video Url : " + VideoUrl + " Sent to : " + grpurl + " Using UserName : "******"       Date_Time : " + DateTime.Now);
                                                GlobusLogHelper.log.Debug(Message_Counter + "Video Url : " + VideoUrl + " Sent to : " + grpurl + " Using UserName : "******"       Date_Time : " + DateTime.Now);



                                                if (!chkCountinueProcessGroupCamapinScheduler)
                                                {
                                                    ///Insert query 
                                                }

                                                if (TimeCounter >= CheckGroupCompaignNoOfGroupsInBatch)
                                                {
                                                    if (ScheduleGroupPosting)
                                                    {
                                                        TimeCounter = 0;
                                                        GlobusLogHelper.log.Debug("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);

                                                        // TimeCounter = 0;

                                                        Thread.Sleep(1 * 1000 * 60 * CheckGroupCompaign_InterbalInMinuts);
                                                        GlobusLogHelper.log.Debug("Process Continue ..  With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Process Continue . With :" + fbUser.username);
                                                    }
                                                    else
                                                    {
                                                        try
                                                        {
                                                            int delayInSeconds = Utils.GenerateRandom(minDelayGroupManager * 1000, maxDelayGroupManager * 1000);
                                                            GlobusLogHelper.log.Info("Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Unable to post on : " + grpurl + " With Username " + fbUser.username);
                                                GlobusLogHelper.log.Debug("Unable to post on : " + grpurl + " With Username " + fbUser.username);
                                                //GlobusLogHelper.log.Info("You have been temporarily blocked from performing this action." + grpurl);
                                                //GlobusLogHelper.log.Debug("You have been temporarily blocked from performing this action." + grpurl);

                                                int delayInSeconds = Utils.GenerateRandom(minDelayGroupManager * 1000, maxDelayGroupManager * 1000);
                                                GlobusLogHelper.log.Info("Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Error : " + ex.StackTrace);

                                            return;
                                        }
                                    }

                                    else if (faceboardpro.FbGroupCampaignManagerGlobals.MessageType == "")
                                    {
                                        try
                                        {
                                            IssendMessage = false;
                                            try
                                            {
                                                GlobusLogHelper.log.Info("UserName :"******"Targeturl :" + grpurl + "Message : " + message);
                                                GlobusLogHelper.log.Debug("UserName :"******"Targeturl :" + grpurl + "Message : " + message);


                                                IssendMessage = SendingMsgToGroups(grpurl, message, ref fbUser);
                                                try
                                                {
                                                    string CSVHeader = "UserAccount" + "," + "GroupUrl" + "," + "message" + "," + "FilePath" + "," + "DateTime";
                                                    string CSV_Content = username + "," + grpurl + "," + message + "," + Picpath + "," + DateTime.Now;
                                                    Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, GroupReportExprotFilePath);
                                                }
                                                catch (Exception ex)
                                                {
                                                    GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                            }
                                            if (IssendMessage)
                                            {
                                                Message_Counter++;
                                                TimeCounter++;
                                                GlobusLogHelper.log.Info("Sent Message to GroupUrl : " + grpurl);
                                                GlobusLogHelper.log.Debug("Sent Message to GroupUrl : " + grpurl);
                                                GlobusLogHelper.log.Info(Message_Counter + " Message : " + message + " Sent to : " + grpurl + " Using UserName : "******"       Date_Time : " + DateTime.Now);
                                                GlobusLogHelper.log.Debug(Message_Counter + " Message : " + message + " Sent to : " + grpurl + " Using UserName : "******"       Date_Time : " + DateTime.Now);

                                                if (TimeCounter >= CheckGroupCompaignNoOfGroupsInBatch)
                                                {
                                                    if (ScheduleGroupPosting)
                                                    {
                                                        TimeCounter = 0;
                                                        GlobusLogHelper.log.Debug("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);

                                                        // TimeCounter = 0;

                                                        Thread.Sleep(1 * 1000 * 60 * CheckGroupCompaign_InterbalInMinuts);
                                                        GlobusLogHelper.log.Debug("Process Continue ..  With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Process Continue . With :" + fbUser.username);
                                                    }
                                                    else
                                                    {
                                                        try
                                                        {
                                                            int delayInSeconds = Utils.GenerateRandom(minDelayGroupManager * 1000, maxDelayGroupManager * 1000);
                                                            GlobusLogHelper.log.Info("Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Unable to post on : " + grpurl + " With Username " + fbUser.username);
                                                GlobusLogHelper.log.Debug("Unable to post on : " + grpurl + " With Username " + fbUser.username);
                                                //GlobusLogHelper.log.Info("You have been temporarily blocked from performing this action." + grpurl);
                                                //GlobusLogHelper.log.Debug("You have been temporarily blocked from performing this action." + grpurl);

                                                try
                                                {
                                                    int delayInSeconds = Utils.GenerateRandom(minDelayGroupManager * 1000, maxDelayGroupManager * 1000);
                                                    GlobusLogHelper.log.Info("Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"<span class=\"_50f8 _50f7\">PINNED POST</span>"))
                                                    {
                                                        try
                                                        {
                                                            string[] arr = System.Text.RegularExpressions.Regex.Split(Pagesource, "<span class=\"fsm fwn fcg\">");
                                                            GetPostUrl = Utils.getBetween(arr[1], "href=\"", "rel=\"theater\"").Replace("amp;", "").Replace("\"", "").Trim();
                                                        }
                                                        catch (Exception ex)
                                                        {
                                                            GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                        }
                                                    }
                                                }


                                                try
                                                {
                                                    string CSVHeader = "UserAccount" + "," + "GroupUrl" + "," + "message" + "," + "FilePath" + "," + "PicturePostUrl" + "," + "DateTime";
                                                    string CSV_Content = username + "," + grpurl + "," + message + "," + Picpath + "," + GetPostUrl + "," + DateTime.Now;
                                                    Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, GroupReportExprotFilePath);
                                                }
                                                catch (Exception ex)
                                                {
                                                    GlobusLogHelper.log.Error("Error  >>>" + ex.StackTrace);
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                            }

                                            if (IssendMessage)
                                            {

                                                Message_Counter++;
                                                TimeCounter++;
                                                GlobusLogHelper.log.Info("Sent Picture Message to GroupUrl : " + grpurl);
                                                GlobusLogHelper.log.Debug("Sent Picture Message to GroupUrl : " + grpurl);

                                                GlobusLogHelper.log.Info(Message_Counter + " Message : " + message + " and Picture Path " + Picpath + " Sent to : " + grpurl + " Using UserName : "******"       Date_Time : " + DateTime.Now);
                                                GlobusLogHelper.log.Debug(Message_Counter + " Message : " + message + " and Picture Path " + Picpath + " Sent to : " + grpurl + " Using UserName : "******"       Date_Time : " + DateTime.Now);

                                                if (TimeCounter >= CheckGroupCompaignNoOfGroupsInBatch)
                                                {
                                                    if (ScheduleGroupPosting)
                                                    {
                                                        TimeCounter = 0;
                                                        GlobusLogHelper.log.Debug("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);

                                                        // TimeCounter = 0;

                                                        Thread.Sleep(1 * 1000 * 60 * CheckGroupCompaign_InterbalInMinuts);
                                                        GlobusLogHelper.log.Debug("Process Continue ..  With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Process Continue . With :" + fbUser.username);
                                                    }
                                                    else
                                                    {
                                                        try
                                                        {
                                                            int delayInSeconds = Utils.GenerateRandom(minDelayGroupManager * 1000, maxDelayGroupManager * 1000);
                                                            GlobusLogHelper.log.Info("Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Unable to post on : " + grpurl + " With Username " + fbUser.username);
                                                GlobusLogHelper.log.Debug("Unable to post on : " + grpurl + " With Username " + fbUser.username);
                                                //  GlobusLogHelper.log.Info("You have been temporarily blocked from performing this action." + grpurl);
                                            }
                                            string VideoUrlMsg = string.Empty;
                                            try
                                            {
                                                VideoUrlMsg = LstVideoUrlsGroupCampaignManager[new Random().Next(0, LstVideoUrlsGroupCampaignManager.Count - 1)];
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                            }
                                            try
                                            {
                                                IssendMessage = PostVideoUrl(grpurl, message, VideoUrlMsg, ref fbUser);
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                            }
                                            if (IssendMessage)
                                            {
                                                Message_Counter++;
                                                TimeCounter++;
                                                GlobusLogHelper.log.Info("Sent Video Url to GroupUrl : " + grpurl);
                                                GlobusLogHelper.log.Debug("Sent Video Url to GroupUrl : " + grpurl);

                                                GlobusLogHelper.log.Info(Message_Counter + "Video Url : " + VideoUrl + " Sent to : " + grpurl + " Using UserName : "******"       Date_Time : " + DateTime.Now);
                                                GlobusLogHelper.log.Debug(Message_Counter + "Video Url : " + VideoUrl + " Sent to : " + grpurl + " Using UserName : "******"       Date_Time : " + DateTime.Now);

                                                if (TimeCounter >= CheckGroupCompaignNoOfGroupsInBatch)
                                                {
                                                    if (ScheduleGroupPosting)
                                                    {
                                                        TimeCounter = 0;
                                                        GlobusLogHelper.log.Debug("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Pausing the process for : " + CheckGroupCompaign_InterbalInMinuts + "  : Minutes With :" + fbUser.username);

                                                        // TimeCounter = 0;

                                                        Thread.Sleep(1 * 1000 * 60 * CheckGroupCompaign_InterbalInMinuts);
                                                        GlobusLogHelper.log.Debug("Process Continue ..  With :" + fbUser.username);
                                                        GlobusLogHelper.log.Info("Process Continue . With :" + fbUser.username);
                                                    }
                                                    else
                                                    {
                                                        try
                                                        {
                                                            int delayInSeconds = Utils.GenerateRandom(minDelayGroupManager * 1000, maxDelayGroupManager * 1000);
                                                            GlobusLogHelper.log.Info("Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Error : " + ex.StackTrace);
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            break;
                        }
                        if (!chkCountinueProcessGroupCamapinScheduler)
                        {
                            if (Grpcounter == lstallgroup_EachAccount.Count)
                            {
                                if (Grpcounter <= 1)
                                {
                                    GlobusLogHelper.log.Info("Message already send please update compaign name!");
                                    GlobusLogHelper.log.Debug("Message already send please update compaign name!");
                                }
                                GlobusLogHelper.log.Info("process Completed !!!");
                                GlobusLogHelper.log.Debug("process Completed !!!");
                                break;
                            }
                        }
                        message = "";
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                    }
                }

            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }
        public void StartAcceptInvitations(ref GlobusHttpHelper httpHelper)
        {
            try
            {
                string csrfToken = string.Empty;
                string userFirstName = string.Empty;
                string UserLastName = string.Empty;
                string SenderName = string.Empty;
                string newPagesource = string.Empty;
                bool isTrue = false;
                int startRow = 1;

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

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

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

                                    break;
                                }
                            }
                            catch (Exception ex)
                            {
                            }

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

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

                // For Show More

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

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

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

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

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

                }

                #endregion

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

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

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

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

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

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

                                            }
                                            catch { }
                                        }

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

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

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

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

                //if (isTrue)
                //{
                //    StartAcceptInvitations(ref httpHelper);
                //}
            }
            catch (Exception ex)
            {
            }
        }
        public static string GetUserNameFromUserId(string userid)
        {
            string username = string.Empty;

            ChilkatHttpHelpr httpHelper = new ChilkatHttpHelpr();

            try
            {
                string PageSource = string.Empty;
                if (!string.IsNullOrEmpty(userid) && NumberHelper.ValidateNumber(userid))
                {
                    //PageSource = httpHelper.GetHtml("https://api.twitter.com/1/users/show.xml?user_id=" + userid + "&include_entities=true");
                    PageSource = httpHelper.GetHtml(("https://twitter.com/account/redirect_by_id?id=" + userid));
                    if (!PageSource.Contains("Rate limit exceeded. Clients may not make more than 150 requests per hour."))
                    {
                        try
                        {
                            //int startIndex = PageSource.IndexOf("<screen_name>");
                            //if (startIndex > 0)
                            {
                                //string Start = PageSource.Substring(startIndex);
                                //int endIndex = Start.IndexOf("</screen_name>");
                                //string End = Start.Substring(0, endIndex);
                                //username = End.Replace("<screen_name>", "");

                                int startindex = PageSource.IndexOf("user-style-");
                                string start = PageSource.Substring(startindex).Replace("user-style-", "");
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                username = end;
                            }

                        }
                        catch (Exception ex)
                        {
                            Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetUserNameFromUserId() -- " + userid + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                            Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetUserNameFromUserId() -- " + userid + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
                        }
                    }
                    else
                    {
                        username = "******";
                    }
                }
            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetUserNameFromUserId() -- " + userid + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetUserNameFromUserId() -- " + userid + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
            }

            return username;
        }