Пример #1
0
        public void HashTagFollow(ref InstagramAccountManager accountManager, List <string> Usercount)
        {
            try
            {
                GloBoardPro.HasTagListListThread.Add(Thread.CurrentThread);
                GloBoardPro.HasTagListListThread.Distinct();
                Thread.CurrentThread.IsBackground = true;
            }
            catch
            {
            }
            #region variables

            //List<string> Usercount = new List<string>();
            #endregion variables

            #region commented

            #endregion
            try
            {
                frm_stagram objfrm_stagram = (frm_stagram)Application.OpenForms["frm_stagram"];
                foreach (string urlToFollow in Usercount)
                {
                    FollowUrls(ref accountManager, urlToFollow);
                    Thread.Sleep(ClGlobul.hashTagDelay * 1000);
                    if (!string.IsNullOrEmpty(objfrm_stagram.txtHashTagDelay.Text) && NumberHelper.ValidateNumber(objfrm_stagram.txtHashTagDelay.Text))
                    {
                        mindelay = Convert.ToInt32(objfrm_stagram.txtHashTagDelay.Text);
                    }
                    if (!string.IsNullOrEmpty(objfrm_stagram.txtHashmaxTagDelay.Text) && NumberHelper.ValidateNumber(objfrm_stagram.txtHashmaxTagDelay.Text))
                    {
                        maxdelay = Convert.ToInt32(objfrm_stagram.txtHashmaxTagDelay.Text);
                    }

                    Random obj_rn = new Random();
                    int    delay  = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                    delay = obj_rn.Next(mindelay, maxdelay);
                    Log("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]");
                    Thread.Sleep(delay * 1000);

                    //Log("[ " + DateTime.Now + "] " + "[Delay is " + ClGlobul.hashTagDelay + " sec. ]");
                }
            }


            catch (Exception ex)
            {
            }
            finally
            {
                //process completed.
                ClGlobul.countNoOFAccountHashFollower--;
                if (ClGlobul.countNoOFAccountHashFollower == 0)
                {
                    Log("[ " + DateTime.Now + "] " + "[Process completed for Follow Using HashTag. ]");
                }
            }
        }
Пример #2
0
        public void HashTagLike(ref InstagramAccountManager accountManager, List <string> hashTag)//string hashTag
        {
            try
            {
                frm_stagram objfrm_stagram = (frm_stagram)Application.OpenForms["frm_stagram"];
                foreach (string urlToLike in hashTag)//hashTag //snapsVideoUrl
                {
                    LikeSnapsVideos(ref accountManager, urlToLike);
                    Thread.Sleep(ClGlobul.hashTagFolloweDelay * 1000);
                    if (!string.IsNullOrEmpty(objfrm_stagram.txtHashTagDelay.Text) && NumberHelper.ValidateNumber(objfrm_stagram.txtHashTagDelay.Text))
                    {
                        mindelay = Convert.ToInt32(objfrm_stagram.txtHashTagDelay.Text);
                    }
                    if (!string.IsNullOrEmpty(objfrm_stagram.txtHashmaxTagDelay.Text) && NumberHelper.ValidateNumber(objfrm_stagram.txtHashmaxTagDelay.Text))
                    {
                        maxdelay = Convert.ToInt32(objfrm_stagram.txtHashmaxTagDelay.Text);
                    }

                    Random obj_rn = new Random();
                    int    delay  = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                    delay = obj_rn.Next(mindelay, maxdelay);
                    Log("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]");
                    Thread.Sleep(delay * 1000);


                    // Log("[ " + DateTime.Now + "] " + "[Delay is " + ClGlobul.hashTagDelay + " sec. ]");
                }
            }

            catch (Exception ex)
            {
            }

            finally
            {
                //process completed.
                ClGlobul.countNOOfFollowersandImageDownload--;
                if (ClGlobul.countNOOfFollowersandImageDownload == 0)
                {
                    Log("[ " + DateTime.Now + "] " + "[Process completed for Like Using HashTag. ]");
                }
            }
        }
Пример #3
0
        public void startDownloadingImage(string itemImageTag, int delay)
        {
            string        pageSource     = string.Empty;
            List <string> lstCountScrape = new List <string>();

            if (stopScrapImageBool)
            {
                return;
            }
            //try
            //{
            GlobDramProHttpHelper _GlobusHttpHelper = new GlobDramProHttpHelper();

            try
            {
                pageSource = _GlobusHttpHelper.getHtmlfromUrl(new Uri(mainUrl), "");
            }
            catch { }
            string url = string.Empty;

            if (!string.IsNullOrEmpty(pageSource))
            {
                if (itemImageTag.Contains("#"))
                {
                    itemImageTag = itemImageTag.Replace("#", "%23");
                    url          = mainUrl + "tag/" + itemImageTag.Replace("%23", string.Empty);
                }
                else
                {
                    url = mainUrl + "n/" + itemImageTag.Replace("%23", string.Empty);
                }
                try
                {
                    pageSource = _GlobusHttpHelper.getHtmlfromUrl(new Uri(url), "");
                }
                catch { }
                if (!string.IsNullOrEmpty(pageSource))
                {
                    // if (pageSource.Contains("<div class=\"mainimg_wrapper\">"))
                    if (pageSource.Contains("class=\"username\""))
                    {
                        try
                        {
                            // string[] arr = Regex.Split(pageSource, "<div class=\"mainimg_wrapper\">");
                            string[] arr = Regex.Split(pageSource, "class=\"username\"");
                            if (arr.Length > 1)
                            {
                                arr = arr.Skip(1).ToArray();
                                foreach (var item in arr)
                                {
                                    string websiteLink = ScrapUserName.getBetween(item, "<a href=\"", "\"");
                                    websiteLink = "http://websta.me/" + websiteLink;
                                    string imageLink = ScrapUserName.getBetween(item, "src=\"", "\"");
                                    string imageid   = ScrapUserName.getBetween(item, ".2885-19/", "_a.jpg\">");
                                    string FullName  = ScrapUserName.getBetween(item, "\">", "</a>");
                                    lstCountScrape.Add(imageLink);
                                    lstCountScrape = lstCountScrape.Distinct().ToList();

                                    if (stopScrapImageBool)
                                    {
                                        return;
                                    }
                                    try
                                    {
                                        if (!string.IsNullOrEmpty(imageLink))
                                        {
                                            duplicatlink.Add(imageLink, imageid);

                                            string CSVData = websiteLink.Replace(",", string.Empty) + "," + imageLink.Replace(",", string.Empty) + "," + imageid.Replace(",", string.Empty) + "," + FullName.Replace(",", string.Empty);
                                            GramBoardProFileHelper.ExportDataCSVFile(CSVHeader, CSVData, CSVPath);
                                            classsforlogger objclasssforlogger = new classsforlogger();
                                            objclasssforlogger.AddToImageTagLogger("[ " + DateTime.Now + " ] => [ websiteLink : " + websiteLink + "   imageLink : " + imageLink + "   imageid : " + imageid + "   FullName : " + FullName);

                                            //frm_stagram objbbbFrmMain = (frm_stagram)Application.OpenForms["frm_stagram"];
                                            //objbbbFrmMain.lstImageLogger.Items.Add("hey ram");
                                            if (lstCountScrape.Count >= ClGlobul.countNOOfFollowersandImageDownload)
                                            {
                                                return;
                                            }
                                        }
                                    }
                                    catch { }
                                    if (stopScrapImageBool)
                                    {
                                        return;
                                    }
                                    try
                                    {
                                        classsforlogger objclasssforlogger = new classsforlogger();

                                        lock (_lockObject)
                                        {
                                            try
                                            {
                                                frm_stagram objfrm_stagram = (frm_stagram)Application.OpenForms["frm_stagram"];

                                                if (!string.IsNullOrEmpty(objfrm_stagram.txtmaxDelayGetImageImage.Text) && NumberHelper.ValidateNumber(objfrm_stagram.txtmaxDelayGetImageImage.Text))
                                                {
                                                    mindelay = Convert.ToInt32(objfrm_stagram.txtmaxDelayGetImageImage.Text);
                                                }
                                                if (!string.IsNullOrEmpty(objfrm_stagram.txtminDelayGetImageImage.Text) && NumberHelper.ValidateNumber(objfrm_stagram.txtminDelayGetImageImage.Text))
                                                {
                                                    maxdelay = Convert.ToInt32(objfrm_stagram.txtminDelayGetImageImage.Text);
                                                }

                                                Random obj_rn = new Random();
                                                int    delay1 = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                                                delay1 = obj_rn.Next(mindelay, maxdelay);
                                                objclasssforlogger.AddToImageTagLogger("[ " + DateTime.Now + " ] => [ Delay For " + delay1 + " Seconds ]");
                                                Thread.Sleep(delay1 * 1000);
                                            }
                                            catch { }
                                        }

                                        //HashLogger.printLogger("[ " + DateTime.Now + " ] => [ " + imageId + " ]");
                                        //HashLogger.printLogger("[ " + DateTime.Now + " ] => [ Delay for " + delay + " seconds ]");
                                        objclasssforlogger.AddToImageTagLogger("[ " + DateTime.Now + " ] => [ " + websiteLink + " ]");
                                        //objclasssforlogger.AddToImageTagLogger("[ " + DateTime.Now + " ] => [ Delay for " + delay + " seconds ]");
                                        //Thread.Sleep(delay * 1000);


                                        if (lstCountScrape.Count >= ClGlobul.countNOOfFollowersandImageDownload)
                                        {
                                            return;
                                        }
                                    }
                                    catch { };
                                }
                            }

                            if (lstCountScrape.Count >= ClGlobul.countNOOfFollowersandImageDownload)
                            {
                                return;
                            }
                        }
                        catch { };
                    }
                }
            }



            classsforlogger objclasssforlogger1 = new classsforlogger();

            objclasssforlogger1.AddToImageTagLogger("[ " + DateTime.Now + " ] => [ Process Completed ]");
        }
Пример #4
0
        public void startUserScraper(string itemHash, int delay)

        {
            string        pageSource        = string.Empty;
            string        response          = string.Empty;
            string        postData          = string.Empty;
            List <string> lstCountScrapUser = new List <string>();

            if (stopScrapBool)
            {
                return;
            }
            try
            {
                GlobDramProHttpHelper _GlobusHttpHelper = new GlobDramProHttpHelper();
                pageSource = _GlobusHttpHelper.getHtmlfromUrl(new Uri(mainUrl), "");
                if (!string.IsNullOrEmpty(pageSource))
                {
                    //if (itemHash.StartsWith("#"))
                    //{
                    //    postData = "q=" + Uri.EscapeDataString(itemHash);
                    //}
                    //else
                    //{
                    //    postData = "q=" + Uri.EscapeDataString("#") + itemHash;
                    //}

                    postData = "q=" + Uri.EscapeDataString(itemHash);
                    string url     = "http://websta.me/search/" + postData.Substring(postData.IndexOf("=") + 1);
                    string referer = "http://websta.me/";
                    response = _GlobusHttpHelper.postFormData(new Uri(url), postData, referer, "");

                    if (!string.IsNullOrEmpty(response))
                    {
                        if (response.Contains("class=\"username\""))
                        {
                            try
                            {
                                string[] arrOfUserName = Regex.Split(response, "class=\"username\"");

                                if (arrOfUserName.Length > 0)
                                {
                                    arrOfUserName = arrOfUserName.Skip(1).ToArray();
                                    foreach (string itemArray in arrOfUserName)
                                    {
                                        if (stopScrapBool)
                                        {
                                            return;
                                        }
                                        try
                                        {
                                            string startString = "href=\"/n/";
                                            string endString   = "\">";
                                            if (itemArray.Contains(startString) && itemArray.Contains(endString))
                                            {
                                                string userName = string.Empty;
                                                try
                                                {
                                                    userName = getBetween(itemArray, startString, endString);
                                                    lstCountScrapUser.Add(userName);
                                                    lstCountScrapUser = lstCountScrapUser.Distinct().ToList();


                                                    if (!string.IsNullOrEmpty(userLink))
                                                    {
                                                        duplicateurl.Add(userLink + userName, userLink + userName);
                                                        #region CSV Write
                                                        try
                                                        {
                                                            string CSVData = itemHash.Replace(",", string.Empty) + "," + userName.Replace(",", string.Empty) + "," + (userLink + userName).Replace(",", string.Empty);
                                                            GramBoardProFileHelper.ExportDataCSVFile(CSVHeader, CSVData, CSVPath);
                                                        }
                                                        catch { }
                                                        try
                                                        {
                                                            GramBoardLogHelper.log.Info("[" + userName + "," + "itemHash:" + "," + itemHash + "," + "userName:"******"," + userName + "," + "userLink:" + "," + userLink + "," + " UserName" + userName + "]");
                                                        }
                                                        catch { };

                                                        #endregion

                                                        try
                                                        {
                                                            if (stopScrapBool)
                                                            {
                                                                return;
                                                            }
                                                            lock (_lockObject)
                                                            {
                                                                try
                                                                {
                                                                    GramBoardLogHelper.log.Info("=> [  UserName" + userName + " ]");
                                                                    //HashLogger.printLogger("[ " + DateTime.Now + " ] => [ Delay for " + delay + " seconds ]");
                                                                    //GramBoardLogHelper.log.Info(" => [ Delay for " + delay + " seconds ]");
                                                                    //Thread.Sleep(delay * 1000);

                                                                    frm_stagram objfrm_stagram = (frm_stagram)Application.OpenForms["frm_stagram"];

                                                                    if (!string.IsNullOrEmpty(objfrm_stagram.txtDelayHashTag.Text) && NumberHelper.ValidateNumber(objfrm_stagram.txtDelayHashTag.Text))
                                                                    {
                                                                        mindelay = Convert.ToInt32(objfrm_stagram.txtDelayHashTag.Text);
                                                                    }
                                                                    if (!string.IsNullOrEmpty(objfrm_stagram.MinHashTagMinDelay.Text) && NumberHelper.ValidateNumber(objfrm_stagram.MinHashTagMinDelay.Text))
                                                                    {
                                                                        maxdelay = Convert.ToInt32(objfrm_stagram.MinHashTagMinDelay.Text);
                                                                    }

                                                                    Random obj_rn = new Random();
                                                                    int    delay1 = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                                                                    delay1 = obj_rn.Next(mindelay, maxdelay);
                                                                    GramBoardLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay1 + " Seconds ]");
                                                                    Thread.Sleep(delay1 * 1000);
                                                                }
                                                                catch { }
                                                            }
                                                            if (lstCountScrapUser.Count >= ClGlobul.countNOOfFollowersandImageDownload)
                                                            {
                                                                return;
                                                            }
                                                        }
                                                        catch { }
                                                    }
                                                }
                                                catch { }
                                            }
                                        }
                                        catch { }
                                    }
                                }
                            }
                            catch { }
                        }
                    }//End of if (!string.IsNullOrEmpty(response))
                    else
                    {
                        //Do Nothing yet
                    }
                }//End of if (!string.IsNullOrEmpty(pageSource))
            }
            catch { }
            //GlobusLogHelper.log.Info("[" + DateTime.Now + " ]=>[Process Completed]");
            //HashLogger.printLogger("[ " + DateTime.Now + " ] => [  Process Completed ]");
        }//End of for-each (string itemHash in ClGlobul.HashTagForScrap)