public void StartActionMultithreadInvite(ref PinInterestUser objPinUser)
        {
            try
            {
                try
                {
                    lstThreadsInvite.Add(Thread.CurrentThread);
                    lstThreadsInvite.Distinct().ToList();
                    Thread.CurrentThread.IsBackground = true;
                }
                catch (Exception ex)
                { };
                foreach (var item_lstEmailInvites in ClGlobul.lstEmailInvites)
                {
                    try
                    {
                        Invite(item_lstEmailInvites, ref objPinUser);
                        GlobusFileHelper.AppendStringToTextfileNewLine(item_lstEmailInvites, PDGlobals.InviteSentPath);
                        Thread.Sleep(1000);
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Info(" => [ Invite Failed For This Email " + item_lstEmailInvites + " ]");
                    }

                    int DelayTime = RandomNumberGenerator.GenerateRandom(minDelayInvite, maxDelayInvite);
                    GlobusLogHelper.log.Info(" => [ Delay For " + DelayTime + " Seconds ]");
                    Thread.Sleep(DelayTime);
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
            }
        }
        public string Getscreen_NameRepin(ref PinInterestUser objPinUser)
        {
            string djfsdf         = string.Empty;
            string FindScreenName = string.Empty;

            try
            {
                string ScreenName1 = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com"), "", "", "");
                string ScreenName  = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com/settings/"), "", "", "");
                int    StartIndex  = ScreenName.IndexOf("username\":");
                int    EndIndex    = ScreenName.IndexOf(",");          //username": "******", "email_commen
                FindScreenName = ScreenName.Substring(StartIndex, EndIndex).Replace(":", string.Empty).Replace("email_commen", string.Empty).Replace("\"", "").Replace("username", string.Empty).Replace(",", string.Empty).Replace("email_com", string.Empty).Replace(" ", "@").Trim();
                string[] arr = System.Text.RegularExpressions.Regex.Split(FindScreenName, "@");
                if (arr.Count() == 3)
                {
                    FindScreenName = arr[1];
                }
                else
                {
                    FindScreenName = arr[0];
                }
                return(FindScreenName);
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error :" + ex.StackTrace);
            }
            return(FindScreenName);
        }
예제 #3
0
        public void StartActionMultithreadEditPinDisc(ref PinInterestUser objPinUser)
        {
            try
            {
                foreach (string comment in ClGlobul.CommentNicheMessageList)
                {
                    string[] array = Regex.Split(comment, "::");
                    if (array.Length == 2)
                    {
                        if (array[0] == objPinUser.Niches)
                        {
                            CommentList.Add(array[1]);
                            GlobusLogHelper.log.Info(" => [ Editing Pin Description For " + objPinUser.Username + " ]");
                            EditPins(ref objPinUser);
                        }
                    }
                }

                //EditPin.PinEditLogEvent.addToLogger += new EventHandler(PinEditLogEvent_addToLogger);
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
            }
        }
        public List <string> GetAllBoardNames_new(ref PinInterestUser objPinInUser)
        {
            List <string> BoardNames = new List <string>();

            BaseLib.GlobusRegex         rgx        = new GlobusRegex();
            Globussoft.GlobusHttpHelper httpHelper = new Globussoft.GlobusHttpHelper();

            string UserUrl   = "http://pinterest.com/" + objPinInUser.Username;
            string BoardPage = httpHelper.getHtmlfromUrl(new Uri(UserUrl), "", "", objPinInUser.UserAgent);

            string[] Items = Regex.Split(BoardPage, "item");

            int counter = 0;

            foreach (string item in Items)
            {
                try
                {
                    if (item.Contains("id=\\\"Board") && item.Contains("boardLinkWrapper"))
                    {
                        //if (counter == 1)
                        {
                            string[] Data = System.Text.RegularExpressions.Regex.Split(item, "boardLinkWrapper");

                            foreach (string Dataitem in Data)
                            {
                                if (Dataitem.Contains("-end-"))
                                {
                                    continue;
                                }
                                if (Dataitem.Contains("boardName"))
                                {
                                    int    startIndex = Dataitem.IndexOf("title");
                                    int    LastPoint  = Dataitem.IndexOf("<h4");
                                    string Board      = Dataitem.Substring(startIndex, LastPoint).Replace("\\n", string.Empty).Replace("\"", "").Replace("<div class=\\b", string.Empty).Replace("  ", string.Empty).Replace("\"title\"", "").Replace("</div", "");
                                    Board = rgx.StripTagsRegex(Board);
                                    try
                                    {
                                        Board = Board.Split('>')[1];
                                    }
                                    catch { }
                                    if (!BoardNames.Contains(Board))
                                    {
                                        BoardNames.Add(Board);
                                    }
                                }
                            }
                        }
                        counter++;
                    }
                }
                catch (Exception ex)
                {
                    GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                }
            }

            return(BoardNames);
        }
        public void StartBoards()
        {
            try
            {
                countThreadControllerBoards = 0;
                int numberOfAccountPatchBoards = 25;

                if (numberOfAccountPatchBoards > 0)
                {
                    numberOfAccountPatchBoards = NoOfThreadsBoards;
                }

                Boardsdata_count = PDGlobals.loadedAccountsDictionary.Count();

                List <List <string> > list_listAccounts = new List <List <string> >();
                if (PDGlobals.listAccounts.Count >= 1)
                {
                    list_listAccounts = Utils.Utils.Split(PDGlobals.listAccounts, numberOfAccountPatchBoards);
                    foreach (List <string> listAccounts in list_listAccounts)
                    {
                        foreach (string account in listAccounts)
                        {
                            if (countThreadControllerBoards > Nothread_Boards)
                            {
                                try
                                {
                                    lock (BoardsObjThread)
                                    {
                                        Monitor.Wait(BoardsObjThread);
                                    }
                                }
                                catch (Exception Ex)
                                {
                                    Console.Write(Ex.Message);
                                }
                            }
                            string          acc = account.Split(':')[0];
                            PinInterestUser objPinInterestUser = null;
                            PDGlobals.loadedAccountsDictionary.TryGetValue(acc, out objPinInterestUser);
                            if (objPinInterestUser != null)
                            {
                                Thread profilerThread = new Thread(StartBoardsMultiThreaded);
                                profilerThread.Name         = "workerThread_Profiler_" + acc;
                                profilerThread.IsBackground = true;

                                profilerThread.Start(new object[] { objPinInterestUser });

                                countThreadControllerBoards++;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
            }
        }
예제 #6
0
        public void StartLikeKeyword()
        {
            try
            {
                countThreadControllerLikeByKeyword = 0;
                int numberOfAccountPatchCommentByKeyword = 25;

                if (NoOfThreadsLikeByKeyword > 0)
                {
                    numberOfAccountPatchCommentByKeyword = NoOfThreadsLikeByKeyword;
                }
                LikeByKeyworddata_count = PDGlobals.loadedAccountsDictionary.Count();
                List <List <string> > list_listAccounts = new List <List <string> >();

                if (PDGlobals.listAccounts.Count >= 1)
                {
                    list_listAccounts = Utils.Utils.Split(PDGlobals.listAccounts, numberOfAccountPatchCommentByKeyword);
                    foreach (List <string> listAccounts in list_listAccounts)
                    {
                        foreach (string account in listAccounts)
                        {
                            if (countThreadControllerLikeByKeyword > Nothread_LikeByKeyword)
                            {
                                try
                                {
                                    lock (LikeByKeywordObjThread)
                                    {
                                        Monitor.Wait(LikeByKeywordObjThread);
                                    }
                                }
                                catch (Exception Ex)
                                {
                                    GlobusLogHelper.log.Error(" Error : 3.2" + Ex.StackTrace);
                                }
                            }

                            string          acc = account.Split(':')[0];
                            PinInterestUser objPinInterestUser = null;
                            PDGlobals.loadedAccountsDictionary.TryGetValue(acc, out objPinInterestUser);
                            if (objPinInterestUser != null)
                            {
                                Thread profilerThread = new Thread(StartLikeByKeywordMultiThreaded);
                                profilerThread.Name         = "workerThread_Profiler_" + acc;
                                profilerThread.IsBackground = true;

                                profilerThread.Start(new object[] { objPinInterestUser });

                                countThreadControllerLikeByKeyword++;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error : 2" + ex.StackTrace);
            }
        }
        public bool Like_New(ref PinInterestUser objPinUser, string PinId)
        {
            try
            {
                string LikeUrl = string.Empty;
                string Pin     = PinId;

                if (PinId.Contains("pinterest.com"))
                {
                    Pin   = ObjAccountManager.getBetween(Pin, "pinterest.com/pin/", "/");
                    PinId = Pin;
                }

                string Checking = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com"));
                if (Checking.Contains("profileName"))
                {
                }
                else
                {
                    ObjAccountManager.LoginPinterestAccount(ref objPinUser);
                }
                string RedirectUrlDomain = GlobusHttpHelper.valueURl.Split('.')[0];
                string newHomePage       = RedirectUrlDomain + ".pinterest.com/";

                LikeUrl = RedirectUrlDomain + ".pinterest.com/resource/PinLikeResource2/create/";

                string PostData = "source_url=%2F&data=%7B%22options%22%3A%7B%22pin_id%22%3A%22" + PinId + "%22%7D%2C%22context%22%3A%7B%22app_version%22%3A%22" + objPinUser.App_version + "%22%7D%7D&module_path=App()%3EHomePage()%3EAuthHomePage(resource%3DUserResource(username%3D" + objPinUser.Username + "))%3EGrid(resource%3DUserHomefeedResource())%3EGridItems(resource%3DUserHomefeedResource())%3EPin(resource%3DPinResource(id%3D" + PinId + "))%3EPinLikeButton(liked%3Dfalse%2C+class_name%3DlikeSmall%2C+pin_id%3D" + PinId + "%2C+has_icon%3Dtrue%2C+tagName%3Dbutton%2C+text%3DLike%2C+show_text%3Dfalse%2C+ga_category%3Dlike)";

                string AfterLikePageSourceData = objPinUser.globusHttpHelper.postFormDataProxyPin(new Uri(LikeUrl), PostData, newHomePage);


                if (!AfterLikePageSourceData.Contains("<div>Uh oh! Something went wrong"))
                {
                    //Log("[ " + DateTime.Now + " ] => [ Successfully Liked For this User " + pinterestAccountManager.Username + " ]");
                    return(true);
                }
                else
                {
                    if (AfterLikePageSourceData.Contains("You are liking really fast"))
                    {
                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ You are liking really fast. Slow down a little. Try after some time " + objPinUser.Username + " ]");
                        return(false);
                    }
                    else
                    {
                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Like Process Failed For this User " + objPinUser.Username + " ]");
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" => Error : " + ex.StackTrace);
                return(false);
            }
            return(false);
        }
예제 #8
0
        public void StartActionMultithreadAddPinWithNewBoard(ref PinInterestUser objPinUser12)
        {
            Pins obj = new Pins();

            try
            {
                PinInterestUser objPinUser = (PinInterestUser)objPinUser12;
                try
                {
                    lstThreadsAddPinWithNewBoard.Add(Thread.CurrentThread);
                    lstThreadsAddPinWithNewBoard.Distinct().ToList();
                    Thread.CurrentThread.IsBackground = true;
                }
                catch (Exception ex)
                { };
                //string strPin=string.Empty;
                //string[] arrPin = null;
                //foreach (string strPinList in ClGlobul.addNewPinWithBoard)
                //{
                //    strPin = strPinList.Replace("\0", "").Trim();
                //    arrPin = Regex.Split(strPin, ",");

                //    if (arrPin.Count() != 4)
                //    {
                //        GlobusLogHelper.log.Info(" => [ Please upload correct file format ]");
                //        return;
                //    }
                //}

                PinInterestUser objPinUseaddpin = objPinUser;
                UserPins = ClGlobul.lst_AddnewPinWithNewBoard.FindAll(P => P.Email == objPinUseaddpin.Username).ToList();

                //GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Total Pins Count is " + UserPins.Count + " ]");

                if (UserPins.Count == 0)
                {
                    UserPins = ClGlobul.lst_AddnewPinWithNewBoard;
                }

                foreach (Pins pin in UserPins)
                {
                    if (pin.Niche == objPinUser12.Niches)
                    {
                        Thread thread = new Thread(() => ThreadRepinMethod(pin, objPinUser));
                        thread.Start();
                        Thread.Sleep(ThreadDelay * 1000);
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
            }
        }
예제 #9
0
        public List <string> CategoryPins(string CategoryName, int PageCount, ref PinInterestUser objPinUser)
        {
            List <string> lstPopularPins = new List <string>();

            try
            {
                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Start Getting Popular Pins For this User " + objPinUser.Username + " ]");

                string BaseCategoryUrl = "http://pinterest.com/all/?category=" + CategoryName;

                for (int i = 1; i < PageCount; i++)
                {
                    string CategoryUrl          = "http://pinterest.com/all/?category=" + CategoryName + "&page=" + i;
                    string PopularPinPageSource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri(CategoryUrl), BaseCategoryUrl, string.Empty, objPinUser.UserAgent);

                    List <string> lst = globusRegex.GetHrefUrlTags(PopularPinPageSource);

                    foreach (string item in lst)
                    {
                        if (item.Contains("/pin/") && !item.Contains("edit"))
                        {
                            try
                            {
                                int FirstPinPoint  = item.IndexOf("/pin/");
                                int SecondPinPoint = item.IndexOf("class=");

                                string PinUrl = item.Substring(FirstPinPoint, SecondPinPoint - FirstPinPoint).Replace("\"", string.Empty).Replace("pin", string.Empty).Replace("/", string.Empty).Trim();

                                lstPopularPins.Add(PinUrl);
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error(" Error : " + ex.StackTrace);
                            }
                        }
                    }
                }
                lstPopularPins = lstPopularPins.Distinct().ToList();
                lstPopularPins.Reverse();

                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Total Pin Urls Collected " + lstPopularPins.Count + " ]");
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error : " + ex.StackTrace);
            }
            return(lstPopularPins);
        }
        public void Invite(string Email, ref PinInterestUser objPinUser)
        {
            try
            {
                string email = Email.Replace("@", "%").Replace("hotmail", "40163");

                //InvitePostData = "source_url=%2F&data=%7B%22options%22%3A%7B%22email%22%3A%22" + email + "%22%2C%22type%22%3A%22email%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EHomePage%3EAuthHomePage%3EGrid%3EGridItems%3EUserNews(anchored%3Dtrue)%23App%3EModalManager%3EModal(can_dismiss%3Dtrue%2C+only_modal%3Dtrue)";

                InvitePostData = "source_url=%2Ffind_friends%2F&data=%7B%22options%22%3A%7B%22email%22%3A%22" + email + "%22%2C%22type%22%3A%22email%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EFriendCenter%3EDiscoverFriends%3EInviteTiles%3EDiscoveryTile%3EInvitePanelEmail%3ESocialTypeaheadField(bypass_maxheight%3Dtrue%2C+tags%3Dinvitability%2C+class_name%3DsearchBox%2C+prefetch_on_focus%3Dtrue%2C+prevent_default_on_enter%3Dtrue%2C+bypass_lru_cache%3Dtrue%2C+placeholder%3DEnter+name+or+email%2C+preserve_typeahead%3Dfalse%2C+allow_email%3Dtrue%2C+allowed_social_networks%3Dfacebook%2Cgplus%2Cyahoo%2C+name%3Dname%2C+view_type%3DuserCircleSelect%2C+autocomplete%3Doff%2C+template%3Duser_circle_avatar%2C+search_delay%3D0%2C+close_on_selection%3Dtrue%2C+autofocus%3Dfalse)";
                try
                {
                    InvitedPageSource = objPinUser.globusHttpHelper.postFormData(new Uri("https://www.pinterest.com/resource/EmailInviteSentResource/create/"), InvitePostData, "https://www.pinterest.com/", objPinUser.Token, objPinUser.UserAgent);

                    if (InvitedPageSource.Contains("error\": null"))
                    {
                        #region AccountReport

                        string module = "Invite";
                        string status = "Invitation Sent";
                        qm.insertAccRePort(objPinUser.Username, module, "", "", "", Email, "", "", status, "", "", DateTime.Now);
                        objInviteDelegate();

                        #endregion

                        GlobusLogHelper.log.Info(" => [ " + objPinUser.Username + " Successfully invited to  " + Email + " ]");
                    }
                    else
                    {
                        if (InvitedPageSource.Contains("Failed to send invite"))
                        {
                            GlobusLogHelper.log.Info(" =>(" + objPinUser.Username + "Failed to send invite. Try again after some time " + Email);
                        }
                        else
                        {
                            GlobusLogHelper.log.Info(" =>(" + objPinUser.Username + "Invitation Process Failed " + Email);
                        }
                    }
                }
                catch { };
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
        }
예제 #11
0
        public static string getUserNameFromPinId(string Pinid, ref PinInterestUser objPinUser)
        {
            string Username = string.Empty;

            try
            {
                string pagesource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://pinterest.com/pin/" + Pinid), "http://pinterest.com/", "", objPinUser.UserAgent);

                string[] DataArr = System.Text.RegularExpressions.Regex.Split(pagesource, "commentDescriptionCreator");

                if (DataArr.Count() < 1)
                {
                    return(Username);
                }

                try
                {
                    foreach (string item in DataArr)//DataArr
                    {
                        if (item.Contains("!DOCTYPE html"))
                        {
                            continue;
                        }

                        string ValueStaring = item;

                        if (item.Contains("{\"username\":"))
                        {
                            Username = Utils.Utils.getBetween(item, "{\"username\": \"", "\",");
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error : " + ex.StackTrace);
            }
            return(Username);
        }
예제 #12
0
        public string Follow(ref PinInterestUser objPinUser, string UserUrl)
        {
            try
            {
                if (!UserUrl.Contains("pinterest.com"))
                {
                    UserUrl = "http://pinterest.com/" + UserUrl + "/";
                }
                UserUrl = UserUrl + "follow/";
                string UserName         = UserUrl.Replace("http://pinterest.com/", string.Empty).Replace("follow", string.Empty).Replace("/", string.Empty);
                string Referer          = "http://pinterest.com/search/people/?q=" + UserName;
                string FollowPageSource = string.Empty;
                try
                {
                    FollowPageSource = objPinUser.globusHttpHelper.postFormData(new Uri(UserUrl), "", Referer, objPinUser.Token, objPinUser.UserAgent);

                    if (FollowPageSource.Contains(">Unfollow</span>"))
                    {
                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Successfully Follow this User " + UserName + " ]");
                        return("Followed");
                    }
                    else if (FollowPageSource.Contains("exceeded the maximum"))
                    {
                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ You have exceeded the maximum rate of users followed " + UserName + " ]");
                        return("NotFollowed");
                    }
                    else
                    {
                        //GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Follow Process Failed this User " + UserName + " ]");
                        return("NotFollowed");
                    }
                }
                catch (Exception ex)
                { };
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ UnFollow Process Failed For this User " + objPinUser.Username + " ]");
                return("NotFollowed");
            }
            return("Followed");
        }
        public string GetFollowingCount(string screen_Name, ref PinInterestUser objPinUser)
        {
            string following = string.Empty;

            try
            {
                string followingsource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://pinterest.com/" + screen_Name), "", "", "");
                int    StartFollowing  = followingsource.IndexOf("/following/");
                string _following      = followingsource.Substring(StartFollowing).Replace("/following/", "").Trim();
                int    endFollowing    = _following.IndexOf("</a>");
                _following = _following.Substring(0, endFollowing).Replace("\\n", string.Empty).Replace("\" >", string.Empty).Replace("Following", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
                following  = _following;
                return(following);
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error :" + ex.StackTrace);
            }
            return(following);
        }
        public List <string> GetAllPinsNewCode(ref PinInterestUser objPinUser)
        {
            try
            {
                foreach (var itemBoardUrls in lstBoardUrlsPin)
                {
                    try
                    {
                        UserPageSource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri(itemBoardUrls), "http://pinterest.com/", string.Empty, objPinUser.UserAgent);
                    }
                    catch (Exception ex)
                    {
                    }
                    if (!string.IsNullOrEmpty(UserPageSource))
                    {
                        if (UserPageSource.Contains("<a href="))
                        {
                            string[] arrPin = Regex.Split(UserPageSource, "/pin/");

                            foreach (var itemPin in arrPin)
                            {
                                if (itemPin.Contains("pinImageWrapper"))
                                {
                                    string a = Utils.Utils.getBetween(itemPin, "", "class=").Replace("\\", "").Replace("\"", "").Replace("/", "").Trim();
                                    if (!lstEditPins.Contains(a) && !string.IsNullOrEmpty(a))
                                    {
                                        lstEditPins.Add(a);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
            }

            return(lstEditPins);
        }
        public string GetFollowercount(string screen_Name, ref PinInterestUser objPinUser)
        {
            string followers = string.Empty;

            try
            {
                string pagesource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://pinterest.com/" + screen_Name), "", "", "");
                int    Startindex = pagesource.IndexOf("pinterestapp:followers");
                //string _sorce = pagesource.Substring(Startindex).Replace("pinterestapp:followers", "");
                string _sorce   = Utils.Utils.getBetween(pagesource, "2\": \"", " followers\",");
                int    Endindex = _sorce.IndexOf(",");
                //_sorce = _sorce.Substring(0, Endindex).Replace("\"", "").Replace(":", "").Replace("FollowingLinks\">\n<", string.Empty).Trim();
                followers = _sorce;
                return(followers);
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error :" + ex.StackTrace);
            }
            return(followers);
        }
        public void StartActionMultithreadAddPinWithNewBoard(ref PinInterestUser objPinUser12)
        {
            Pins obj = new Pins();

            try
            {
                PinInterestUser objPinUser = (PinInterestUser)objPinUser12;
                try
                {
                    lstThreadsAddPinWithNewBoard.Add(Thread.CurrentThread);
                    lstThreadsAddPinWithNewBoard.Distinct().ToList();
                    Thread.CurrentThread.IsBackground = true;
                }
                catch (Exception ex)
                { };

                PinInterestUser objPinUseaddpin = objPinUser;
                UserPins = ClGlobul.lst_AddnewPinWithNewBoard.FindAll(P => P.Email == objPinUseaddpin.Username).ToList();

                if (UserPins.Count == 0)
                {
                    UserPins = ClGlobul.lst_AddnewPinWithNewBoard;
                }

                foreach (Pins pin in UserPins)
                {
                    if (pin.Niche == objPinUser12.Niches)
                    {
                        Thread thread = new Thread(() => ThreadRepinMethod(pin, objPinUser));
                        thread.Start();
                        Thread.Sleep(ThreadDelay * 1000);
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
            }
        }
예제 #17
0
        public void StartActionMultithreadAddUserToBoard(ref PinInterestUser objPinUser)
        {
            try
            {
                try
                {
                    lstThreadsAddUserToBoard.Add(Thread.CurrentThread);
                    lstThreadsAddUserToBoard.Distinct().ToList();
                    Thread.CurrentThread.IsBackground = true;
                }
                catch (Exception ex)
                { };
                string UserName = string.Empty;
                foreach (string item_lstAddToBoardUserNames in ClGlobul.lstAddToBoardUserNames)
                {
                    string[] array1 = Regex.Split(item_lstAddToBoardUserNames, ":");
                    try
                    {
                        if (array1.Length == 3)
                        {
                            if (array1[0] == objPinUser.Niches)
                            {
                                try
                                {
                                    UserName = array1[2];
                                    if (!UserName.Contains("@"))
                                    {
                                        string IsFollowed = Follow(ref objPinUser, array1[2]);
                                    }

                                    bool IsAdded = AddUserToBoard(array1[1], array1[2], ref objPinUser);
                                }
                                catch (Exception ex)
                                {
                                    Console.Write(ex.Message);
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.Write(ex.Message);
                    }

                    int DelayTime = RandomNumberGenerator.GenerateRandom(minDelayAddUserToBoard, maxDelayAddUserToBoard);
                    GlobusLogHelper.log.Info("[ " + DateTime.Now + "=> [ Delay For " + DelayTime + " Seconds ]");
                    Thread.Sleep(DelayTime);
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
            }
            finally
            {
                try
                {
                    if (countThreadControllerAddUserToBoard > Nothread_AddUserToBoard)
                    {
                        lock (AddUserToBoardObjThread)
                        {
                            Monitor.Pulse(AddUserToBoardObjThread);
                        }
                        AddUserToBoarddata_count--;
                    }
                }
                catch (Exception ex)
                {
                    GlobusLogHelper.log.Error(" Error : " + ex.StackTrace);
                }
                countThreadControllerAddUserToBoard--;
                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ ADDING USER TO BOARD PROCESS COMPLETED  ]");
                GlobusLogHelper.log.Info("---------------------------------------------------------------------------------------------------------------------------");
            }
        }
예제 #18
0
        public void StartAddUserToBoardMultiThreaded(object objParameters)
        {
            PinInterestUser objPinUser = new PinInterestUser();

            try
            {
                if (!isStopAddUserToBoard)
                {
                    try
                    {
                        lstThreadsAddUserToBoard.Add(Thread.CurrentThread);
                        lstThreadsAddUserToBoard.Distinct().ToList();
                        Thread.CurrentThread.IsBackground = true;
                    }
                    catch (Exception ex)
                    {
                        Console.Write(ex.Message);
                    }

                    try
                    {
                        Array paramsArray = new object[1];
                        paramsArray = (Array)objParameters;

                        objPinUser = (PinInterestUser)paramsArray.GetValue(0);

                        #region Login

                        if (!objPinUser.isloggedin)
                        {
                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Logging In With : " + objPinUser.Username + " ]");
                            bool checkLogin;

                            if (string.IsNullOrEmpty(objPinUser.ProxyPort))
                            {
                                objPinUser.ProxyPort = "80";
                            }

                            try
                            {
                                checkLogin = ObjAccountManager.LoginPinterestAccount1forlee(ref objPinUser, objPinUser.Username, objPinUser.Password, objPinUser.ProxyAddress, objPinUser.ProxyPort, objPinUser.ProxyUsername, objPinUser.ProxyPassword, objPinUser.ScreenName);

                                if (!checkLogin)
                                {
                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Logging UnSuccessfull : " + objPinUser.Username + " ]");
                                    DeadAccCount++;
                                    objDelegateNoOfDeadAcc(DeadAccCount);
                                    return;
                                }
                                string checklogin = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com"));
                            }
                            catch (Exception ex)
                            { };
                        }
                        if (objPinUser.isloggedin == true)
                        {
                            try
                            {
                                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Logged In With : " + objPinUser.Username + " ]");
                                ActiveAccCount++;
                                objDelegateNoOfActiveAcc(ActiveAccCount);
                                StartActionMultithreadAddUserToBoard(ref objPinUser);
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                            }
                        }
                        #endregion
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
            }
        }
예제 #19
0
        public List <string> NormalPins(ref PinInterestUser objPinUser)
        {
            List <string> lstPopularPins = new List <string>();

            try
            {
                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Start Getting Pins For this User " + objPinUser.Username + " ]");

                string NormalPinPageSource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("http://pinterest.com/"), "http://pinterest.com/", string.Empty, objPinUser.UserAgent);

                //List<string> lst = globusRegex.GetHrefUrlTags(NormalPinPageSource);
                List <string> lst     = System.Text.RegularExpressions.Regex.Split(NormalPinPageSource, "pin_id").ToList();
                List <string> templst = new List <string>();
                foreach (string item in lst)
                {
                    try
                    {
                        if (!item.StartsWith("\": \"") || item.Contains("$") || item.Contains("?{pin}"))
                        {
                            continue;
                        }

                        if (item.Contains("id\": \"pinItButton"))// && item.Contains("/repins/"))
                        {
                            try
                            {
                                int FirstPinPoint  = item.IndexOf("\": \"");
                                int SecondPinPoint = item.IndexOf("}, ");
                                if (SecondPinPoint > 30)
                                {
                                    SecondPinPoint = item.IndexOf("\", ") + 1;
                                }
                                string Pinid = item.Substring(FirstPinPoint + 4, SecondPinPoint - FirstPinPoint - 5).Trim();

                                if (!lstPopularPins.Any(pid => pid == Pinid))
                                {
                                    lstPopularPins.Add(Pinid);
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error(" Error : " + ex.StackTrace);
                            }
                        }
                    }
                    catch (Exception ex)
                    { }
                }

                lstPopularPins = lstPopularPins.Distinct().ToList();
                lstPopularPins.Reverse();

                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Total Pin Urls Collected " + lstPopularPins.Count + " ]");
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error : " + ex.StackTrace);
            }

            return(lstPopularPins);
        }
예제 #20
0
        public void StartCommentByKeywordMultiThreaded(object objparameters)
        {
            PinInterestUser objPinUser = new PinInterestUser();

            try
            {
                if (!isStopCommentByKeyword)
                {
                    try
                    {
                        lstThreadsCommentByKeyword.Add(Thread.CurrentThread);
                        lstThreadsCommentByKeyword.Distinct().ToList();
                        Thread.CurrentThread.IsBackground = true;
                    }
                    catch (Exception ex)
                    { };

                    try
                    {
                        Array paramsArray = new object[1];
                        paramsArray = (Array)objparameters;
                        objPinUser  = (PinInterestUser)paramsArray.GetValue(0);

                        try
                        {
                            if (chkDivideDataCommentByKeyword == true)
                            {
                                list_lstTargetCommentByKeyword_item = list_lstTargetCommentByKeyword[LstCounterCommentByKeyword];
                            }
                            else
                            {
                                list_lstTargetCommentByKeyword_item = ClGlobul.lstMessageKeyword;
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error(" Error : 3.3" + ex.StackTrace);
                        }

                        #region Login

                        if (!objPinUser.isloggedin)
                        {
                            //Obj_AccountManager.httpHelper = httpHelper;
                            GlobusLogHelper.log.Info(" => [ Logging In With : " + objPinUser.Username + " ]");
                            bool checkLogin;
                            if (string.IsNullOrEmpty(objPinUser.ProxyPort))
                            {
                                objPinUser.ProxyPort = "80";
                            }
                            try
                            {
                                //checkLogin = ObjAccountManager.LoginPinterestAccount1(ref objPinUser, objPinUser.Username, objPinUser.Password, objPinUser.ProxyAddress, objPinUser.ProxyPort, objPinUser.ProxyUsername, objPinUser.ProxyPassword, objPinUser.ScreenName);
                                checkLogin = ObjAccountManager.LoginPinterestAccount1forlee(ref objPinUser, objPinUser.Username, objPinUser.Password, objPinUser.ProxyAddress, objPinUser.ProxyPort, objPinUser.ProxyUsername, objPinUser.ProxyPassword, objPinUser.ScreenName);
                                if (!checkLogin)
                                {
                                    GlobusLogHelper.log.Info(" => [ Logging UnSuccessfull : " + objPinUser.Username + " ]");
                                    return;
                                }
                                string checklogin = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com"));
                                //GlobusLogHelper.log.Info(" => [ Logged In With : " + objPinUser.Username + " ]");
                                //StartActionMultithreadCommentByKeyword(ref objPinUser, list_lstTargetCommentByKeyword_item);
                            }
                            catch { };
                        }
                        if (objPinUser.isloggedin == true)
                        {
                            try
                            {
                                GlobusLogHelper.log.Info(" => [ Logged In With : " + objPinUser.Username + " ]");
                                StartActionMultithreadCommentByKeyword(ref objPinUser, list_lstTargetCommentByKeyword_item);
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error :" + ex.StackTrace);
                            }
                        }
                        #endregion
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error :" + ex.StackTrace);
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
            }
        }
예제 #21
0
        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);
        }
예제 #22
0
        public List <string> KeywordPins_New(string keyword, int Count, ref PinInterestUser objPinUser)
        {
            try
            {
                // Test
                string[] Keyword = Regex.Split(keyword, ":");
                foreach (string item in Keyword)
                {
                    keyword = item;
                    break;
                }
                //
                try
                {
                    GlobusLogHelper.log.Info(" => [ Start Getting Pins For this User " + keyword + " ]");

                    for (int i = 0; i <= Count; i++)
                    {
                        try
                        {
                            if (i == 0)
                            {
                                UserUrl = "http://pinterest.com/search/?q=" + keyword;
                            }
                            else
                            {
                                //http://pinterest.com/resource/SearchResource/get/?source_url=%2Fsearch%2Fpins%2F%3Fq%3Dhairstyle&data=%7B%22options%22%3A%7B%22query%22%3A%22hairstyle%22%2C%22bookmarks%22%3A%5B%22b28xMDB8MDQ0NWZiOTBjNzNiODlkOTQ1ZTk3ZjY0ZTBhYjU0YjM0ZDYyNDg3NjU3ZWQ3OGJmZjI4ZTliZGRmODBlMzJlNQ%3D%3D%22%5D%2C%22show_scope_selector%22%3Atrue%2C%22scope%22%3A%22pins%22%7D%2C%22context%22%3A%7B%22app_version%22%3A%22fc93456%22%7D%2C%22module%22%3A%7B%22name%22%3A%22GridItems%22%2C%22options%22%3A%7B%22scrollable%22%3Atrue%2C%22show_grid_footer%22%3Atrue%2C%22centered%22%3Atrue%2C%22reflow_all%22%3Atrue%2C%22virtualize%22%3Atrue%2C%22item_options%22%3A%7B%22show_pinner%22%3Atrue%2C%22show_pinned_from%22%3Afalse%2C%22show_board%22%3Atrue%7D%2C%22layout%22%3A%22variable_height%22%7D%7D%2C%22append%22%3Atrue%2C%22error_strategy%22%3A2%7D&_=1375699543906
                                UserUrl = "http://pinterest.com/resource/SearchResource/get/?source_url=%2Fsearch%2Fpins%2F%3Fq%3D" + keyword + "&data=%7B%22options%22%3A%7B%22query%22%3A%22" + keyword + "%22%2C%22bookmarks%22%3A%5B%22" + Uri.EscapeDataString(bookmark) + "%22%5D%2C%22show_scope_selector%22%3Atrue%2C%22scope%22%3A%22pins%22%7D%2C%22context%22%3A%7B%22app_version%22%3A%22" + objPinUser.App_version + "%22%7D%2C%22module%22%3A%7B%22name%22%3A%22GridItems%22%2C%22options%22%3A%7B%22scrollable%22%3Atrue%2C%22show_grid_footer%22%3Atrue%2C%22centered%22%3Atrue%2C%22reflow_all%22%3Atrue%2C%22virtualize%22%3Atrue%2C%22item_options%22%3A%7B%22show_pinner%22%3Atrue%2C%22show_pinned_from%22%3Afalse%2C%22show_board%22%3Atrue%7D%2C%22layout%22%3A%22variable_height%22%7D%7D%2C%22append%22%3Atrue%2C%22error_strategy%22%3A" + i + "%7D&_=" + DateTime.Now.Ticks;
                            }

                            try
                            {
                                UserPageSource = objPinUser.globusHttpHelper.getHtmlfromUrlProxy(new Uri(UserUrl), "http://pinterest.com/", string.Empty, 80, "", "", objPinUser.UserAgent);
                            }
                            catch
                            {
                                UserPageSource = objPinUser.globusHttpHelper.getHtmlfromUrlProxy(new Uri(UserUrl), objPinUser.ProxyAddress, Convert.ToInt32(objPinUser.ProxyPort), objPinUser.ProxyUsername, objPinUser.ProxyPassword);
                            }
                            ///get bookmarks value from page
                            ///
                            if (UserPageSource.Contains("bookmarks"))
                            {
                                string[] bookmarksDataArr = System.Text.RegularExpressions.Regex.Split(UserPageSource, "bookmarks");

                                string Datavalue = bookmarksDataArr[bookmarksDataArr.Count() - 1];

                                bookmark = Datavalue.Substring(Datavalue.IndexOf(": [\"") + 4, Datavalue.IndexOf("]") - Datavalue.IndexOf(": [\"") - 5);
                            }

                            List <string> lst     = System.Text.RegularExpressions.Regex.Split(UserPageSource, "pin_id").ToList();
                            List <string> templst = new List <string>();
                            foreach (string item in lst)
                            {
                                if (!item.StartsWith("\": \"") || item.Contains("$") || item.Contains("?{pin}"))
                                {
                                    continue;
                                }

                                if (item.Contains("id\": \"pinItButton"))// && item.Contains("/repins/"))
                                {
                                    try
                                    {
                                        int FirstPinPoint  = item.IndexOf("\": \"");
                                        int SecondPinPoint = item.IndexOf("}, ");
                                        if (SecondPinPoint > 30)
                                        {
                                            SecondPinPoint = item.IndexOf("\", ") + 1;
                                        }
                                        string Pinid = item.Substring(FirstPinPoint + 4, SecondPinPoint - FirstPinPoint - 5).Trim();

                                        if (!lstUserPins.Any(pid => pid == Pinid))
                                        {
                                            lstUserPins.Add(Pinid);
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Info(" => [ Sorry No More Pages ]");
                        }


                        lstUserPins = lstUserPins.Distinct().ToList();
                        lstUserPins.Reverse();
                    }

                    GlobusLogHelper.log.Info(" => [ Total Pin Urls Collected " + lstUserPins.Count + " ]");
                }
                catch (Exception ex)
                {
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
            }

            return(lstUserPins);
        }
예제 #23
0
        public bool UnFollow_New(string UserUrl, ref PinInterestUser objPinUserManager)
        {
            try
            {
                string checklogin = objPinUserManager.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com"));
                if (objPinUserManager.isloggedin == true)
                {
                    string UnFollowPageSource = objPinUserManager.globusHttpHelper.getHtmlfromUrlProxy(new Uri(UserUrl), "", "", 80, "", "", objPinUserManager.UserAgent);

                    try
                    {
                        int    startindex = UnFollowPageSource.IndexOf("\"user_id\":");
                        string start      = UnFollowPageSource.Substring(startindex).Replace("\"user_id\":", "");
                        int    endindex   = start.IndexOf("\", \"");
                        string end        = start.Substring(0, endindex);
                        Unfollowuserid = end.Replace("\"", "");
                    }
                    catch (Exception ex)
                    {
                    }
                    string UnfollowuserName = UserUrl.Split('/')[UserUrl.Split('/').Count() - 2];

                    string redirectDomain       = GlobusHttpHelper.valueURl.Split('.')[0];
                    string newHomePageUrl       = redirectDomain + "." + "pinterest.com";
                    string checkalreadyFollowed = objPinUserManager.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com/" + UnfollowuserName.Replace(" ", "") + "/"));
                    if (checkalreadyFollowed.Contains("buttonText\">Unfollow"))
                    {
                        string PostData = "source_url=%2F" + UnfollowuserName + "%2Ffollowing%2F&data=%7B%22options%22%3A%7B%22user_id%22%3A%22" + Unfollowuserid.Trim() + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EUserProfilePage%3EUserProfileContent%3EUserProfileFollowingGrid%3EGrid%3EGridItems%3EUser%3EUserFollowButton(user_id%3D" + Unfollowuserid.Trim() + "%2C+follow_class%3Ddefault%2C+followed%3Dtrue%2C+class_name%3DgridItem%2C+log_element_type%3D62%2C+text%3DUnfollow%2C+color%3Ddim%2C+disabled%3Dfalse%2C+follow_text%3DFollow%2C+unfollow_text%3DUnfollow%2C+is_me%3Dfalse%2C+follow_ga_category%3Duser_follow%2C+unfollow_ga_category%3Duser_unfollow)";
                        string PageUrl  = redirectDomain + ".pinterest.com/resource/UserFollowResource/delete/";
                        try
                        {
                            UnFollowPageSource = objPinUserManager.globusHttpHelper.postFormDataProxyPin(new Uri(PageUrl), PostData, newHomePageUrl);// newHomePageUrl + objPinUserManager.Username
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                        }


                        if (!UnFollowPageSource.Contains("<div>Uh oh! Something went wrong"))
                        {
                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Successfully UnFollow For this User " + objPinUserManager.Username + " ]");
                            return(true);
                        }
                        else if (UnFollowPageSource.Contains("We're unable to complete this request. Your account is currently in read-only mode to protect your pins. You must reset your password to continue pinning."))
                        {
                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ UnFollow Process Failed For this User " + objPinUserManager.Username + "--> ]");
                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ We're unable to complete this request. Your account is currently in read-only mode to protect your pins. ]");
                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ You must reset your password to continue pinning. ]");
                            return(false);
                        }
                        else
                        {
                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ UnFollow Process Failed For this User " + objPinUserManager.Username + " ]");
                            return(false);
                        }
                    }
                    else
                    {
                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " => [ " + UnfollowuserName + " Is Not Follow Before With " + objPinUserManager.Username + " ]");
                        return(false);
                    }
                }
                else
                {
                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Login Issue with " + objPinUserManager.Username + " ]");
                    return(false);
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ UnFollow Process Failed For this User " + objPinUserManager.Username + " ]");
                return(false);
            }
        }
예제 #24
0
        public void  StartActionMultithreadUnFollow(ref PinInterestUser objPinUser)
        {
            try
            {
                try
                {
                    lstThreadsUnFollow.Add(Thread.CurrentThread);
                    lstThreadsUnFollow.Distinct().ToList();
                    Thread.CurrentThread.IsBackground = true;
                }
                catch (Exception ex)
                { };
                string        ScreenName      = objPinUser.ScreenName;
                List <string> lstNonFollowing = new List <string>();
                if (!chkUploadUnFollowList)
                {
                    if (!chkNoOFDays_UnFollow)
                    {
                        List <string> lstUsers = new List <string>();
                        try
                        {
                            lstUsers = objScrape.GetUserFollowing_new(ScreenName, NoOfPage, Globals.followingCountLogin);
                            lstUsers.Reverse();
                            lstUsers = lstUsers.Distinct().ToList();
                            if (lstUsers.Count > 0)
                            {
                                ClGlobul.lstFollowing_UnFollow.AddRange(lstUsers);
                            }

                            ClGlobul.lstFollowing_UnFollow = ClGlobul.lstFollowing_UnFollow.Distinct().ToList();
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Not Fetched User List ]");
                        }

                        lstNonFollowing.AddRange(lstUsers);
                    }
                    else if (chkNoOFDays_UnFollow == true)
                    {
                        clsSettingDB DataBase = new clsSettingDB();
                        DataTable    dt       = DataBase.SelectUnfollowsToday(objPinUser.Username);
                        foreach (DataRow rd in dt.Rows)
                        {
                            DateTime dt1          = DateTime.Parse(rd[3].ToString());
                            DateTime dt2          = DateTime.Today;
                            TimeSpan span         = dt2 - dt1;
                            int      DayDiffrence = (int)span.Days;
                            if (DayDiffrence >= NOofDays)
                            {
                                NonFollowing.Add("http://pinterest.com/" + rd[2].ToString() + "/");
                            }
                        }
                        lstNonFollowing = NonFollowing.Distinct().ToList();
                    }
                }
                if (chkUploadUnFollowList == true)
                {
                    try
                    {
                        lstNonFollowing.AddRange(ClGlobul.lstUploadUnFollowList);
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error(" Error ;" + ex.StackTrace);
                    }
                }

                if (lstNonFollowing.Count() > 0)
                {
                    int UnFollowCount = 0;
                    foreach (string UnFollowUrl in lstNonFollowing)
                    {
                        string url = string.Empty;
                        try
                        {
                            if (!UnFollowUrl.Contains("http://pinterest.com"))
                            {
                                url = "https://pinterest.com/" + UnFollowUrl + "/";
                            }
                            else
                            {
                                url = UnFollowUrl;
                            }

                            bool IsUnFollowed = UnFollow_New(url, ref objPinUser);

                            if (IsUnFollowed)
                            {
                                #region AccountReport
                                string Username = Utils.Utils.getBetween(url, ".com/", "/");
                                string module   = "UnFollow";
                                string status   = "UnFollowed";
                                Qm.insertAccRePort(objPinUser.Username, module, "", "", Username, "", "", "", status, "", "", DateTime.Now);
                                objUnFollowDelegate();

                                #endregion

                                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Unfollowed : " + url + " From " + objPinUser.Username + " ]");
                                UnFollowCount++;
                                // MaxUnFollowCount--;
                            }
                            else
                            {
                                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Not Unfollowed : " + url + " From " + objPinUser.Username + " ]");
                            }

                            int Delay = RandomNumberGenerator.GenerateRandom(minDelayUnFollow, maxDelayUnFollow);
                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + Delay + " Seconds ]");
                            Thread.Sleep(Delay * 1000);
                        }
                        catch (Exception ex)
                        {
                            // GlobusFileHelper.AppendStringToTextfileNewLine("Error --> UnFollowUserMultiThreaded() 1--> " + ex.Message, ApplicationData.ErrorLogFile);
                        }
                        if (MaxUnFollowCount == UnFollowCount)
                        {
                            break;
                        }
                    }
                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED " + " For " + objPinUser.Username + " ]");
                    GlobusLogHelper.log.Info("-----------------------------------------------------------------------------------");
                }
                else
                {
                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ No Users to UnFollow ]");
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
            }
            finally
            {
                try
                {
                    if (countThreadControllerUnFollow > Nothread_UnFollow)
                    {
                        lock (UnFollowObjThread)
                        {
                            Monitor.Pulse(UnFollowObjThread);
                        }
                        UnFollowdata_count--;
                    }
                }
                catch (Exception ex)
                {
                    GlobusLogHelper.log.Error(" Error : " + ex.StackTrace);
                }
                countThreadControllerUnFollow--;
            }
        }
예제 #25
0
        public bool AddUserToBoard(string BoardName, string UserName, ref PinInterestUser pinterestAccountManager)
        {
            try
            {
                GlobusLogHelper.log.Info(" => [ Start Adding " + UserName + " to " + BoardName + " ]");
                string checklogin     = pinterestAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com"));
                string redirectDomain = GlobusHttpHelper.valueURl.Split('.')[0];
                string newHomePageUrl = redirectDomain + "." + "pinterest.com";

                string screen_Name = pinterestAccountManager.ScreenName;

                pinterestAccountManager.globusHttpHelper = new GlobusHttpHelper();
                BoardName = BoardName.Replace(" ", "-");
                string AfterInvitePageSourceData = string.Empty;
                string userid = string.Empty;

                if (BoardName.Contains("pinterest.com"))
                {
                    BoardName = BoardName.Replace("https://pinterest.com/", string.Empty).Replace(pinterestAccountManager.Name, string.Empty).Trim('/');
                }

                string BoardUrl          = "https://pinterest.com/" + pinterestAccountManager.ScreenName + "/" + BoardName + "/";
                string SettingsUrl       = BoardUrl + "settings/";
                string Collabrator       = BoardUrl;
                string InvitePostData1   = "collaborator_name=&collaborator_username="******"-", "+");


                string invited_userid    = string.Empty;
                string invited           = "https://pinterest.com/" + UserName.Replace(" ", "").Replace("%20", "");
                string pagesourceinvited = pinterestAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri(invited));

                try
                {
                    invited_userid = Utils.Utils.getBetween(pagesourceinvited, "options\": {\"user_id\"", "}");
                    invited_userid = Utils.Utils.getBetween(invited_userid, "\"", "\"");
                }
                catch { };



                string MainPageSource = pinterestAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri(BoardUrl), "https://pinterest.com/", string.Empty, pinterestAccountManager.UserAgent);

                try
                {
                    int    startindex = MainPageSource.IndexOf("\"user_id\":");
                    string start      = MainPageSource.Substring(startindex).Replace("\"user_id\":", "");
                    int    endindex   = start.IndexOf(",");
                    string end        = start.Substring(0, endindex);
                    userid = end.Replace("\"", "").Replace("}}", string.Empty).Trim();
                }
                catch (Exception ex)
                {
                    GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                }

                string BoardId = Utils.Utils.getBetween(MainPageSource, "board\", \"id", ",").Replace("\"", "").Replace(":", "").Trim();

                string InviteToBoardPostData = string.Empty;

                if (ObjAccountManager.LoginPinterestAccount(ref pinterestAccountManager))
                {
                    string Url = "https://www.pinterest.com/resource/BoardInviteResource/get/?source_url=%2F" + screen_Name + "%2Fhealth%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + BoardId + "%22%2C%22invited_user_id%22%3A%22" + invited_userid + "%22%2C%22field_set_key%22%3A%22boardEdit%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=Modal()%3EBoardCollaboratorInviter(resource%3DBoardResource(board_id%3D" + BoardId + "))%3EBoardInviteForm()%3ESocialTypeaheadField()%3ETypeahead(bypass_maxheight%3Dtrue%2C+tags%3Dpinners_and_contacts%2C+template%3Duser_circle_avatar%2C+view_type%3DuserCircleSelect)&_=1431320928412";

                    string getResponce = pinterestAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri(Url));

                    if (UserName.Contains("@"))
                    {
                        UserName = UserName.Replace("@", "%40");
                        InviteToBoardPostData = "source_url=%2F" + screen_Name + "%2Fas%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + BoardId + "%22%2C%22emails%22%3A%5B%22" + UserName + "%22%5D%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EModalManager%3EModal%3EBoardCollaboratorInviter%3EBoardInviteForm%3EButton(class_name%3DinviteButton%2C+text%3DInvite%2C+color%3Ddefault%2C+state_badgeValue%3D%22%22%2C+state_accessibilityText%3D%22%22%2C+state_disabled%3Dundefined)";
                        try
                        {
                            string postInviteEmail = redirectDomain + ".pinterest.com/resource/BoardEmailInviteResource/create/";
                            AfterInvitePageSourceData = pinterestAccountManager.globusHttpHelper.postFormDataProxyPin(new Uri(postInviteEmail), InviteToBoardPostData, newHomePageUrl);
                        }
                        catch (Exception ex)
                        { };
                    }
                    else
                    {
                        InviteToBoardPostData = "source_url=%2F" + screen_Name + "%2F" + BoardName + "%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + BoardId + "%22%2C%22invited_user_id%22%3A%22" + invited_userid + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EBoardPage%3EBoardHeader%3EBoardInfoBar%3EShowModalButton(module%3DBoardCollaboratorInviter)%23App%3EModalManager%3EModal(state_isVisible%3Dtrue%2C+showCloseModal%3Dtrue%2C+state_mouseDownInModal%3Dtrue%2C+state_showModalMask%3Dtrue%2C+state_showContainer%3Dfalse%2C+state_showPositionElement%3Dtrue)";
                        try
                        {
                            string postUrlInviteBoard = redirectDomain + ".pinterest.com/resource/BoardInviteResource/create/";
                            AfterInvitePageSourceData = pinterestAccountManager.globusHttpHelper.postFormDataProxyPin(new Uri(postUrlInviteBoard), InviteToBoardPostData, newHomePageUrl);
                        }
                        catch (Exception ex)
                        { };
                    }
                    if (!string.IsNullOrEmpty(AfterInvitePageSourceData))
                    {
                        string       ModuleName = "AddUserToBoard";
                        string       Status     = "Invitation Sent";
                        QueryManager qm         = new QueryManager();
                        qm.insertAccRePort(pinterestAccountManager.Username, ModuleName, "", BoardName, UserName, "", "", "", Status, "", "", DateTime.Now);
                        objAddUserToBoarddelegate();
                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Invitation sent to " + UserName + " for Board " + BoardName + " ]");
                        return(true);
                    }
                    else
                    {
                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [  Not Added to Board " + BoardName + " ]");
                        return(true);
                    }
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ " + UserName + " Not Added to Board " + BoardName + " ]");
                return(true);
            }
            return(false);
        }
예제 #26
0
        public void StartBoardsMultiThreaded(object objParameters)
        {
            PinInterestUser objPinUser = new PinInterestUser();

            try
            {
                if (!isStopBoards)
                {
                    try
                    {
                        lstThreadsBoards.Add(Thread.CurrentThread);
                        lstThreadsBoards.Distinct().ToList();
                        Thread.CurrentThread.IsBackground = true;
                    }
                    catch (Exception ex)
                    { };

                    try
                    {
                        Array paramsArray = new object[1];
                        paramsArray = (Array)objParameters;

                        objPinUser = (PinInterestUser)paramsArray.GetValue(0);

                        # region comment
                        //if (ClGlobul.lstListOfBoardNames.Count > BoardCreationBoardNum)
                        //{
                        //    BoardUrl = ClGlobul.lstListOfBoardNames[BoardCreationBoardNum];
                        //    BoardCreationBoardNum++;
                        //}
                        //else
                        //{
                        //    BoardCreationBoardNum = 0;
                        //    BoardUrl = ClGlobul.lstListOfBoardNames[BoardCreationBoardNum];
                        //}

                        //if (ClGlobul.lstListOfBoardNames.Count > 0)//lstBoardNameswithUserNames
                        //{
                        //    foreach (var itemBoardNames in ClGlobul.lstListOfBoardNames)
                        //    {
                        //        string[] arrBoardName = Regex.Split(itemBoardNames, ":");//test
                        //        string UserName = arrBoardName[0];
                        //        BoardName = arrBoardName[1];
                        //    }
                        //}
                        #endregion

                        #region Login

                        if (!objPinUser.isloggedin)
                        {
                            GlobusLogHelper.log.Info(" => [ Logging In With : " + objPinUser.Username + " ]");
                            bool checkLogin;
                            if (string.IsNullOrEmpty(objPinUser.ProxyPort))
                            {
                                objPinUser.ProxyPort = "80";
                            }
                            try
                            {
                                // checkLogin = ObjAccountManager.LoginPinterestAccount1(ref objPinUser, objPinUser.Username, objPinUser.Password, objPinUser.ProxyAddress, objPinUser.ProxyPort, objPinUser.ProxyUsername, objPinUser.ProxyPassword, objPinUser.ScreenName);
                                checkLogin = ObjAccountManager.LoginPinterestAccount1forlee(ref objPinUser, objPinUser.Username, objPinUser.Password, objPinUser.ProxyAddress, objPinUser.ProxyPort, objPinUser.ProxyUsername, objPinUser.ProxyPassword, objPinUser.ScreenName);

                                if (!checkLogin)
                                {
                                    GlobusLogHelper.log.Info(" => [ Logging UnSuccessfull : " + objPinUser.Username + " ]");
                                    return;
                                }
                                string checklogin = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com"));
                                //GlobusLogHelper.log.Info(" => [ Logged In With : " + objPinUser.Username + " ]");
                                //StartActionMultithreadBoards(ref objPinUser);
                            }

                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                            }
                        }
                        if (objPinUser.isloggedin == true)
                        {
                            try
                            {
                                GlobusLogHelper.log.Info(" => [ Logged In With : " + objPinUser.Username + " ]");
                                StartActionMultithreadBoards(ref objPinUser);
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                            }
                        }

                        #endregion
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                    }
                }
예제 #27
0
        public void StartActionMultithreadCommentByKeyword(ref PinInterestUser objPinUser, List <string> UserCount_CommentByKeyword)
        {
            try
            {
                try
                {
                    lstThreadsCommentByKeyword.Add(Thread.CurrentThread);
                    lstThreadsCommentByKeyword.Distinct().ToList();
                    Thread.CurrentThread.IsBackground = true;
                }
                catch (Exception ex)
                { };
                int      counter   = 0;
                string[] arrayItem = new string[100];

                foreach (string newItem in UserCount_CommentByKeyword)
                {
                    try
                    {
                        arrayItem = Regex.Split(newItem, "::");
                        if (arrayItem.Length == 3 && arrayItem[0] == objPinUser.Niches)
                        {
                            if (arrayItem.Length == 3)
                            {
                                string[] Keywordarrray = Regex.Split(arrayItem[1], ",");
                                foreach (string KeywordsItem in Keywordarrray)
                                {
                                    lock (this)
                                    {
                                        try
                                        {
                                            Keyword = KeywordsItem + "::" + arrayItem[2].ToString();
                                            lstCommnet.Add(Keyword);
                                            List <string> LstPins = new List <string>();
                                            LstPins = KeywordPins_New(KeywordsItem, MaxCommentByKeyword, ref objPinUser);
                                            //PinterestComments Comments = new PinterestComments();
                                            keyword = Utils.Utils.getBetween(KeywordsItem, "", "::");
                                            GlobusLogHelper.log.Info(" => [ Finding Pins On Keyword : " + KeywordsItem + " For " + objPinUser.Username + " ]");
                                            GlobusLogHelper.log.Info(" => [ " + LstPins.Count + " Pins On Keyword :" + KeywordsItem + " For " + objPinUser.Username + " ]");
                                            List <string> lstofPin = new List <string>();
                                            lstofPin = LstPins.Distinct().ToList();
                                            string[] lstCommnet_strlist = Regex.Split(newItem, "::");//lstCommnet.ToArray();
                                            foreach (string pin in lstofPin)
                                            {
                                                try
                                                {
                                                    clsSettingDB Db   = new clsSettingDB();
                                                    string       user = PinterestPins.getUserNameFromPinId(pin, ref objPinUser);

                                                    if (counter >= MaxCommentByKeyword)
                                                    {
                                                        break;
                                                    }
                                                    else
                                                    {
                                                        #region Commented
                                                        //comment = lstCommnet[RandomNumberGenerator.GenerateRandom(0, lstCommnet.Count)];

                                                        //if (comment.Contains("::"))
                                                        //{
                                                        //    comment = Regex.Split(comment, "::")[1];
                                                        //}
                                                        //else if (comment.Contains(":"))
                                                        //{
                                                        //    if (comment.Contains("http:"))
                                                        //    {
                                                        //        comment = comment.Split(':')[comment.Split(':').Count() - 1];
                                                        //        comment = "http:" + comment.Split(':')[comment.Split(':').Count() - 1];
                                                        //    }
                                                        //    else
                                                        //    {
                                                        //        comment = comment.Split(':')[comment.Split(':').Count() - 1];
                                                        //    }
                                                        //}
                                                        #endregion
                                                        #region
                                                        try
                                                        {
                                                            DataSet   DS = QM.selectCommentedPinDetails(objPinUser.Username, pin);
                                                            DataTable Dt = DS.Tables[0];

                                                            string   dateTime         = Dt.Rows[Dt.Rows.Count - 1].ItemArray[3].ToString();
                                                            DateTime previousDateTime = Convert.ToDateTime(dateTime);
                                                            DateTime currentDate      = DateTime.Today;
                                                            TimeSpan dt_Difference    = currentDate.Subtract(previousDateTime);
                                                            double   dt_Difference1   = dt_Difference.Days;
                                                            if (dt_Difference1 < 30)
                                                            {
                                                                continue;
                                                            }
                                                        }
                                                        catch (Exception Ex)
                                                        {
                                                            //CommentAddToLogger("Error ==> " + Ex.StackTrace);
                                                        }

                                                        #endregion
                                                        Thread.Sleep(1 * 1000);
                                                        bool IsCommented = objCommentManagers.Comment_new(ref objPinUser, pin, lstCommnet_strlist[2]);
                                                        if (IsCommented)
                                                        {
                                                            #region AccountReport

                                                            string module = "CommentByKeyword";
                                                            string status = "Commented";
                                                            Qm.insertAccRePort(objPinUser.Username, module, "https://www.pinterest.com/pin/" + pin, "", "", lstCommnet_strlist[2], KeywordsItem, "", status, "", "", DateTime.Now);
                                                            objCommentByKeywordDelegate();

                                                            #endregion
                                                            counter++;
                                                            GlobusLogHelper.log.Info(" => [ Commneted on Pin : " + pin + " From " + objPinUser.Username + " ]");
                                                            clsSettingDB Databse = new clsSettingDB();
                                                            Databse.insertMessageDate(objPinUser.Username, user.Replace("/", ""), pin, KeywordsItem, comment);
                                                            try
                                                            {
                                                                QueryManager.insertCommentedPinDetails(objPinUser.Username, pin, DateTime.Now.ToString());
                                                            }
                                                            catch { };

                                                            try
                                                            {
                                                                string CSV_Header = "Date" + "," + "UserName" + "," + "Comment" + "," + "Keyword" + "," + "Niche" + "," + "PinUrl";
                                                                string CSV_Data   = System.DateTime.Now.ToString() + "," + objPinUser.Username + "," + comment + "," + KeywordsItem + "," + objPinUser.Niches + "," + "https://www.pinterest.com/pin/" + pin;
                                                                string path       = PDGlobals.FolderCreation(PDGlobals.Pindominator_Folder_Path, "Comment");
                                                                PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, path + "\\CommentBykeyword.csv");
                                                            }
                                                            catch (Exception ex)
                                                            {
                                                            }
                                                        }
                                                        else
                                                        {
                                                            GlobusLogHelper.log.Info(" => [ Not Commneted on Pin : " + pin + " From " + objPinUser.Username + " ]");
                                                        }

                                                        //if (rdbDivideGivenByUserCommentByKeyword == true)
                                                        //{
                                                        //    CountGivenByUserCommentByKeyword--;
                                                        //    if (CountGivenByUserCommentByKeyword < 0)
                                                        //    {
                                                        //        break;
                                                        //    }
                                                        //}

                                                        int delay = RandomNumberGenerator.GenerateRandom(minDelayCommentByKeyword, maxDelayCommentByKeyword);
                                                        GlobusLogHelper.log.Info(" => [ Delay For " + delay + " Seconds ]");
                                                        Thread.Sleep(delay * 1000);
                                                    }
                                                }
                                                catch (Exception ex)
                                                {
                                                    GlobusLogHelper.log.Error(" Error : 3.4" + ex.StackTrace);
                                                }
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusLogHelper.log.Error(" Error : 3.4" + ex.StackTrace);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error(" Error : 3.4" + ex.StackTrace);
                    }

                    #region Comment
                    // }
                    //string[] lstCommnet_strlist = lstCommnet.ToArray();
                    //if (objPinUser.Niches == arrayItem[0])
                    //{
                    //    foreach (string FindKeyword in lstCommnet_strlist)
                    //    {

                    //        try
                    //        {
                    //            List<string> LstPins = KeywordPins_New(FindKeyword, MaxCommentByKeyword, ref objPinUser);
                    //            //PinterestComments Comments = new PinterestComments();
                    //            keyword = Utils.Utils.getBetween(FindKeyword, "", "::");
                    //            GlobusLogHelper.log.Info(" => [ Finding Pins On Keyword : " + FindKeyword + " For " + objPinUser.Username + " ]");
                    //            GlobusLogHelper.log.Info(" => [ " + LstPins.Count + " Pins On Keyword :" + FindKeyword + " For " + objPinUser.Username + " ]");
                    //            List<string> lstofPin = LstPins;
                    //            foreach (string pin in lstofPin)
                    //            {
                    //                clsSettingDB Db = new clsSettingDB();
                    //                string user = PinterestPins.getUserNameFromPinId(pin, ref objPinUser);

                    //                if (counter >= MaxCommentByKeyword)
                    //                {
                    //                    GlobusLogHelper.log.Info(" => [ PROCESS COMPLETED " + " For " + objPinUser.Username + " ]");
                    //                    GlobusLogHelper.log.Info("---------------------------------------------------------------------------------------------------------------------------");
                    //                    break;
                    //                }
                    //                else
                    //                {
                    //                    comment = lstCommnet[RandomNumberGenerator.GenerateRandom(0, lstCommnet.Count)];
                    //                    if (comment.Contains("::"))
                    //                    {
                    //                        comment = Regex.Split(comment, "::")[1];
                    //                    }
                    //                    else if (comment.Contains(":"))
                    //                    {
                    //                        if (comment.Contains("http:"))
                    //                        {
                    //                            comment = comment.Split(':')[comment.Split(':').Count() - 1];
                    //                            comment = "http:" + comment.Split(':')[comment.Split(':').Count() - 1];
                    //                        }
                    //                        else
                    //                        {
                    //                            comment = comment.Split(':')[comment.Split(':').Count() - 1];
                    //                        }
                    //                    }

                    //                    #region
                    //                    try
                    //                    {
                    //                        DataSet DS = QM.selectCommentedPinDetails(objPinUser.Username, pin);
                    //                        DataTable Dt = DS.Tables[0];

                    //                        string dateTime = Dt.Rows[Dt.Rows.Count - 1].ItemArray[3].ToString();
                    //                        DateTime previousDateTime = Convert.ToDateTime(dateTime);
                    //                        DateTime currentDate = DateTime.Today;
                    //                        TimeSpan dt_Difference = currentDate.Subtract(previousDateTime);
                    //                        double dt_Difference1 = dt_Difference.Days;
                    //                        if (dt_Difference1 < 30)
                    //                        {
                    //                            continue;
                    //                        }

                    //                    }
                    //                    catch (Exception Ex)
                    //                    {
                    //                        //CommentAddToLogger("Error ==> " + Ex.StackTrace);
                    //                    }

                    //                    #endregion

                    //                    bool IsCommented = objCommentManagers.Comment_new(ref objPinUser, pin, comment);
                    //                    if (IsCommented)
                    //                    {
                    //                        #region AccountReport

                    //                        string module = "CommentByKeyword";
                    //                        string status = "Commented";
                    //                        Qm.insertAccRePort(objPinUser.Username, module, pin, "", "", comment, keyword, "", status, "", "", DateTime.Now);
                    //                        objCommentByKeywordDelegate();

                    //                        #endregion

                    //                        GlobusLogHelper.log.Info(" => [ Commneted on Pin : " + pin + " From " + objPinUser.Username + " ]");
                    //                        clsSettingDB Databse = new clsSettingDB();
                    //                        Databse.insertMessageDate(objPinUser.Username, user.Replace("/", ""), pin, keyword, comment);
                    //                        try
                    //                        {
                    //                            QueryManager.insertCommentedPinDetails(objPinUser.Username, pin, DateTime.Now.ToString());
                    //                        }
                    //                        catch { };
                    //                        counter++;

                    //                        try
                    //                        {
                    //                            string CSV_Header = "Date" + "," + "UserName" + "," + "Comment" + "," + "Keyword" + "," + "Niche" + "," + "PinUrl";
                    //                            string CSV_Data = System.DateTime.Now.ToString() + "," + objPinUser.Username + "," + comment + "," + keyword + "," + objPinUser.Niches + "," + "https://www.pinterest.com/pin/" + pin;
                    //                            string path = PDGlobals.FolderCreation(PDGlobals.Pindominator_Folder_Path, "Comment");
                    //                            PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, path + "\\CommentBykeyword.csv");
                    //                        }
                    //                        catch (Exception ex)
                    //                        {

                    //                        }
                    //                    }
                    //                    else
                    //                    {
                    //                        GlobusLogHelper.log.Info(" => [ Not Commneted on Pin : " + pin + " From " + objPinUser.Username + " ]");
                    //                    }

                    //                    //if (rdbDivideGivenByUserCommentByKeyword == true)
                    //                    //{
                    //                    //    CountGivenByUserCommentByKeyword--;
                    //                    //    if (CountGivenByUserCommentByKeyword < 0)
                    //                    //    {
                    //                    //        break;
                    //                    //    }
                    //                    //}

                    //                    int delay = RandomNumberGenerator.GenerateRandom(minDelayCommentByKeyword, maxDelayCommentByKeyword);
                    //                    GlobusLogHelper.log.Info(" => [ Delay For " + delay + " Seconds ]");
                    //                    Thread.Sleep(delay * 1000);
                    //                }
                    //            }
                    //        }
                    //        catch (Exception ex)
                    //        {
                    //            GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                    //        }

                    //    }
                    ////}
                    #endregion
                }
                GlobusLogHelper.log.Info(" => [ PROCESS COMPLETED " + " For " + objPinUser.Username + " ]");
                GlobusLogHelper.log.Info("---------------------------------------------------------------------------------------------------------------------------");
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
            }
            finally
            {
                try
                {
                    if (countThreadControllerCommentByKeyword > Nothread_CommentByKeyword)
                    {
                        lock (CommentByKeywordObjThread)
                        {
                            Monitor.Pulse(CommentByKeywordObjThread);
                        }
                        CommentByKeyworddata_count--;
                    }
                }
                catch (Exception ex)
                {
                    GlobusLogHelper.log.Error(" Error : " + ex.StackTrace);
                }
                countThreadControllerCommentByKeyword--;
            }
        }
예제 #28
0
        public List <string> PopularPins(int PageCount, ref PinInterestUser objPinUser)
        {
            List <string> lstPopularPins       = new List <string>();
            string        Name                 = string.Empty;
            string        PopularPinPageSource = string.Empty;

            try
            {
                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Start Getting Popular Pins For this User " + objPinUser.Username + " ]");

                string bookmark = string.Empty;

                for (int i = 0; i < PageCount; i++)
                {
                    string LikeUrl = string.Empty;

                    if (i == 0)
                    {
                        LikeUrl = "http://pinterest.com/popular/";
                    }
                    else
                    {
                        LikeUrl = "http://pinterest.com/resource/CategoryFeedResource/get/?source_url=%2Fpopular%2F&data=%7B%22options%22%3A%7B%22feed%22%3A%22popular%22%2C%22bookmarks%22%3A%5B%22" + Uri.EscapeDataString(bookmark) + "%22%5D%7D%2C%22context%22%3A%7B%22app_version%22%3A%22" + objPinUser.App_version + "%22%7D%2C%22module%22%3A%7B%22name%22%3A%22GridItems%22%2C%22options%22%3A%7B%22scrollable%22%3Atrue%2C%22show_grid_footer%22%3Atrue%2C%22centered%22%3Atrue%2C%22reflow_all%22%3Atrue%2C%22virtualize%22%3Atrue%2C%22item_options%22%3A%7B%22show_pinner%22%3Atrue%2C%22show_pinned_from%22%3Afalse%2C%22show_board%22%3Atrue%2C%22show_via%22%3Afalse%7D%2C%22layout%22%3A%22variable_height%22%7D%7D%2C%22append%22%3Atrue%2C%22error_strategy%22%3A" + i + "%7D&module_path=App()%3EHeader()%3EDropdownButton()%3EDropdown()%3ECategoriesMenu(resource%3D%5Bobject+Object%5D%2C+name%3DCategoriesMenu%2C+resource%3DCategoriesResource(browsable%3Dtrue))&_=" + DateTime.Now.Ticks;
                    }

                    try
                    {
                        PopularPinPageSource = objPinUser.globusHttpHelper.getHtmlfromUrlProxy(new Uri(LikeUrl), "http://pinterest.com/", string.Empty, 80, "", "", objPinUser.UserAgent);
                    }
                    catch (Exception ex)
                    {
                        PopularPinPageSource = objPinUser.globusHttpHelper.getHtmlfromUrlProxy(new Uri(LikeUrl), objPinUser.ProxyAddress, Convert.ToInt32(objPinUser.ProxyPort), objPinUser.ProxyUsername, objPinUser.ProxyPassword);
                    }
                    ///get bookmarks value from page
                    ///
                    if (PopularPinPageSource.Contains("bookmarks"))
                    {
                        string[] bookmarksDataArr = System.Text.RegularExpressions.Regex.Split(PopularPinPageSource, "bookmarks");

                        string Datavalue = bookmarksDataArr[bookmarksDataArr.Count() - 1];

                        bookmark = Datavalue.Substring(Datavalue.IndexOf(": [\"") + 4, Datavalue.IndexOf("]") - Datavalue.IndexOf(": [\"") - 5);
                    }


                    List <string> lst     = System.Text.RegularExpressions.Regex.Split(PopularPinPageSource, "pin_id").ToList();
                    List <string> templst = new List <string>();
                    foreach (string item in lst)
                    {
                        if (!item.StartsWith("\": \"") || item.Contains("$") || item.Contains("?{pin}"))
                        {
                            continue;
                        }

                        if (item.Contains("id\": \"pinItButton") || item.Contains("uid\": \"Pin-"))// && item.Contains("/repins/"))
                        {
                            //templst.Add(item);
                            try
                            {
                                int FirstPinPoint  = item.IndexOf("\": \"");
                                int SecondPinPoint = item.IndexOf("}, ");

                                if (SecondPinPoint > 30)
                                {
                                    SecondPinPoint = item.IndexOf("\", ") + 1;
                                }

                                string Pinid = item.Substring(FirstPinPoint + 4, SecondPinPoint - FirstPinPoint - 5).Trim();

                                if (!lstPopularPins.Any(pid => pid == Pinid))
                                {
                                    lstPopularPins.Add(Pinid);
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error(" Error : " + ex.StackTrace);
                            }
                        }
                    }

                    lstPopularPins = lstPopularPins.Distinct().ToList();
                    lstPopularPins.Reverse();

                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Total Pin Urls Collected " + lstPopularPins.Count + " ]");
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" => Error : " + ex.StackTrace);
            }

            return(lstPopularPins);
        }
예제 #29
0
        public void StartCommentKeyword()
        {
            try
            {
                countThreadControllerCommentByKeyword = 0;
                int numberOfAccountPatchCommentByKeyword = 25;

                if (NoOfThreadsCommentByKeyword > 0)
                {
                    numberOfAccountPatchCommentByKeyword = NoOfThreadsCommentByKeyword;
                }
                CommentByKeyworddata_count = PDGlobals.loadedAccountsDictionary.Count();
                List <List <string> > list_listAccounts = new List <List <string> >();

                #region Divide Data Setting Comment
                //if (chkDivideDataCommentByKeyword == true)
                //{
                //    try
                //    {
                //        if (rdbDivideEquallyCommentByKeyword == true || rdbDivideGivenByUserCommentByKeyword == true)
                //        {
                //            int splitNo = 0;
                //            if (rdbDivideEquallyCommentByKeyword == true)
                //            {
                //                splitNo = ClGlobul.lstMessageKeyword.Count / PDGlobals.listAccounts.Count;
                //            }
                //            else if (rdbDivideGivenByUserCommentByKeyword == true)
                //            {
                //                if (Convert.ToInt32(CountGivenByUserCommentByKeyword) != 0)
                //                {
                //                    int res = Convert.ToInt32(Convert.ToInt32(CountGivenByUserCommentByKeyword));
                //                    splitNo = res;
                //                }
                //            }
                //            if (splitNo == 0)
                //            {
                //                splitNo = RandomNumberGenerator.GenerateRandom(0, ClGlobul.lstMessageKeyword.Count - 1);
                //            }
                //            list_lstTargetCommentByKeyword = Split(ClGlobul.lstMessageKeyword, splitNo);
                //        }
                //    }
                //    catch (Exception ex)
                //    {
                //        GlobusLogHelper.log.Error("Error : 3.1 " + ex.StackTrace);
                //    }
                //}

                #endregion

                if (PDGlobals.listAccounts.Count >= 1)
                {
                    list_listAccounts = Utils.Utils.Split(PDGlobals.listAccounts, numberOfAccountPatchCommentByKeyword);
                    foreach (List <string> listAccounts in list_listAccounts)
                    {
                        foreach (string account in listAccounts)
                        {
                            if (countThreadControllerCommentByKeyword > Nothread_CommentByKeyword)
                            {
                                try
                                {
                                    lock (CommentByKeywordObjThread)
                                    {
                                        Monitor.Wait(CommentByKeywordObjThread);
                                    }
                                }
                                catch (Exception Ex)
                                {
                                    GlobusLogHelper.log.Error(" Error : 3.2" + Ex.StackTrace);
                                }
                            }

                            string          acc = account.Split(':')[0];
                            PinInterestUser objPinInterestUser = null;
                            PDGlobals.loadedAccountsDictionary.TryGetValue(acc, out objPinInterestUser);
                            if (objPinInterestUser != null)
                            {
                                Thread profilerThread = new Thread(StartCommentByKeywordMultiThreaded);
                                profilerThread.Name         = "workerThread_Profiler_" + acc;
                                profilerThread.IsBackground = true;

                                profilerThread.Start(new object[] { objPinInterestUser });

                                countThreadControllerCommentByKeyword++;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error : 2" + ex.StackTrace);
            }
        }
예제 #30
0
        public void ThreadRepinMethod(Pins pin, PinInterestUser objPinUser)
        {
            try
            {
                try
                {
                    lstThreadsAddPinWithNewBoard.Add(Thread.CurrentThread);
                    lstThreadsAddPinWithNewBoard.Distinct().ToList();
                    Thread.CurrentThread.IsBackground = true;
                }
                catch (Exception ex)
                { };

                Board = Regex.Split(pin.Board, ":")[0];
                if (!string.IsNullOrEmpty(Board))
                {
                    //Board = pin.Board;
                    BoardNumber = objAddNewPinManager.GetBoardId(Board, ref objPinUser);
                    if (string.IsNullOrEmpty(BoardNumber))
                    {
                        GlobusLogHelper.log.Info(" => [ " + Board + " Not Found. Creating Board ]");
                        BoardNumber = CreateBoard_new(Board, "Other", ref objPinUser);
                        BoardNumber = objAddNewPinManager.GetBoardId(Board, ref objPinUser);
                    }
                }
                else
                {
                    if (objPinUser.Boards.Count <= 0)
                    {
                        objAddNewPinManager.GetBoards(ref objPinUser);
                    }
                    if (objPinUser.Boards.Count > 0)
                    {
                        Random Boardrnd = new Random();
                        int    BoardNum = 0;

                        try
                        {
                            BoardNum    = Boardrnd.Next(0, objPinUser.Boards.Count - 1);
                            BoardNumber = objPinUser.Boards[BoardNum];
                        }
                        catch (Exception ex)
                        {
                            //GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartNewPinCreationMultiThreaded() 1--> " + ex.Message, ApplicationData.ErrorLogFile);
                        }
                    }
                }

                ImageUrl = pin.ImageUrl;
                Desc     = pin.Description;

                string Data = objAddNewPinManager.NewPin(BoardNumber, Desc, ImageUrl, ref objPinUser);
                if (Data.Equals("true"))
                {
                    #region AccountReport

                    string module = "AddPinWithNewBoard";
                    string status = "Added";
                    objqm.insertAccRePort(objPinUser.Username, module, "", Board, "", Desc, "", ImageUrl, status, "", "", DateTime.Now);
                    objAddPinWithBoardDelegate();

                    #endregion

                    //GlobusLogHelper.log.Info(" => [ Pin Added To " + Board + " From " + objPinUser.Username + " ]");
                    try
                    {
                        string CSV_Header = "Date" + "," + "UserName" + "," + "Board" + "," + "Description" + "," + "ImageUrl";
                        string CSV_Data   = System.DateTime.Now.ToString() + "," + objPinUser.Username + "," + Board.Replace(",", " ").Replace("'", "") + "," + Desc.Replace(",", " ").Replace("'", "") + "," + ImageUrl.Replace(",", " ").Replace("'", "");

                        PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, Pinpath + "\\NewPin.csv");
                    }
                    catch (Exception ex)
                    {
                    }
                }
                else
                {
                    GlobusLogHelper.log.Info(" => [ Pin Not Added To " + Board + " From " + objPinUser.Username + " ]");
                }
            }
            catch (Exception ex)
            {
                //GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartNewPinCreationMultiThreaded() 2 --> " + ex.Message, ApplicationData.ErrorLogFile);
            }
            finally
            {
                try
                {
                    if (countThreadControllerAddPinWithNewBoard > Nothread_AddPinWithNewBoard)
                    {
                        lock (AddPinWithNewBoardObjThread)
                        {
                            Monitor.Pulse(AddPinWithNewBoardObjThread);
                        }
                        AddPinWithNewBoarddata_count--;
                    }
                }
                catch (Exception ex)
                {
                    GlobusLogHelper.log.Error(" Error : " + ex.StackTrace);
                }
                countThreadControllerAddPinWithNewBoard--;
                GlobusLogHelper.log.Info(" => [ PROCESS COMPLETED " + " For " + objPinUser.Username + " ]");
                GlobusLogHelper.log.Info("---------------------------------------------------------------------------------------------------------------------------");
            }
        }