Esempio n. 1
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 ]");
        }
Esempio n. 2
0
        public string Login()
        {
            Log("[ " + DateTime.Now + " ] => [ Logging in with Account : " + Username + " ]");
            string Status = "Failed";

            try
            {
                string firstUrl = "https://api.instagram.com/oauth/authorize/?client_id=9d836570317f4c18bca0db6d2ac38e29&redirect_uri=http://websta.me/&response_type=code&scope=comments+relationships+likes";

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

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


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

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

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

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

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



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



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


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

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


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

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



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

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

                //nameval.Clear();
                return(Status);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Esempio n. 3
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)
Esempio n. 4
0
        public string MyLoginForUnfollow(ref GlobDramProHttpHelper _GlobusHttpHelper, string url, string commentPostData, string referrer)
        {
            Log("[ " + DateTime.Now + " ] => [ Logging in with Account : " + Username + " ]");
            string Status = string.Empty;

            try
            {
                string firstUrl = "https://api.instagram.com/oauth/authorize/?client_id=9d836570317f4c18bca0db6d2ac38e29&redirect_uri=http://websta.me/&response_type=code&scope=comments+relationships+likes";

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

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

                string res_secondURL = string.Empty;

                if (!string.IsNullOrEmpty(proxyAddress) && !string.IsNullOrEmpty(proxyPort))
                {
                    try
                    {
                        res_secondURL = _GlobusHttpHelper.getHtmlfromUrlProxy(new Uri(secondURL), proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword);
                    }
                    catch (Exception ex)
                    {
                    }
                }
                else
                {
                    try
                    {
                        res_secondURL = _GlobusHttpHelper.getHtmlfromUrlProxy(new Uri(secondURL), "", 80, "", "");
                    }
                    catch { }
                }

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


                //Get Token Number of Id
                int    FirstPointToken_nextUrl     = res_nextUrl.IndexOf("csrfmiddlewaretoken");
                string FirstTokenSubString_nextUrl = res_nextUrl.Substring(FirstPointToken_nextUrl);
                int    SecondPointToken_nextUrl    = FirstTokenSubString_nextUrl.IndexOf("/>");
                this.Token = FirstTokenSubString_nextUrl.Substring(0, SecondPointToken_nextUrl).Replace("csrfmiddlewaretoken", string.Empty).Replace("value=", string.Empty).Replace("\"", string.Empty).Replace("'", string.Empty).Trim();



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

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

                if (res_postdata_Login.Contains("Please enter a correct username and password"))
                {
                    //Status = "Failed";
                    this.LoggedIn = false;
                }
                else if (res_postdata_Login.Contains("requesting access to your Instagram account") || postdata_Login.Contains("is requesting to do the following"))
                {
                    //Status = "AccessIssue";
                }
                else if (res_postdata_Login.Contains("logout") || postdata_Login.Contains("LOG OUT"))
                {
                    //Status = "Success";
                    string zone = string.Empty;
                    if (res_postdata_Login.Contains("data('userid'") && res_postdata_Login.Contains(")"))
                    {
                        try
                        {
                            zone = ScrapUserName.getBetween(res_postdata_Login, "data('userid'", ")");
                            if (!string.IsNullOrEmpty(zone))
                            {
                                try
                                {
                                    int start = zone.IndexOf("'");
                                    int end   = zone.LastIndexOf("'");
                                    Status = zone.Substring(start + 1, end - start - 1);
                                }
                                catch { }
                            }
                        }
                        catch { }
                    }
                    Log("[ " + DateTime.Now + " ] => [ Logged in with Account :" + Username + " ]");
                    this.LoggedIn = true;
                }

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