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 getpageSourceFromProxy(object item)
        {
            if (proxyStop)
                return;
            try
            {
                Thread.CurrentThread.IsBackground = true;
                lstProxyThread.Add(Thread.CurrentThread);
                lstProxyThread = lstProxyThread.Distinct().ToList();
            }
            catch { }

            countParseProxiesThreads++;

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


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

                try
                {
                    if (proxyStop)
                        return;

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

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


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

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

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

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

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

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

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

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

        }
        public void StartInviteMultiThreaded(object objparameters)
        {
            PinInterestUser objPinUser = new PinInterestUser();

            try
            {
                Globussoft.GlobusHttpHelper httpHelper = new Globussoft.GlobusHttpHelper();
                Accounts Obj_AccountManager            = new Accounts();

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

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

                        #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 = httpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com"));
                                //GlobusLogHelper.log.Info(" => [ Logged In With : " + objPinUser.Username + " ]");
                                //StartActionMultithreadInvite(ref objPinUser);
                            }
                            catch { };
                        }
                        if (objPinUser.isloggedin == true)
                        {
                            try
                            {
                                GlobusLogHelper.log.Info(" => [ Logged In With : " + objPinUser.Username + " ]");
                                StartActionMultithreadInvite(ref objPinUser);
                            }
                            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);
            }

            finally
            {
                try
                {
                    if (countThreadControllerInvite > Nothread_Invite)
                    {
                        lock (InviteObjThread)
                        {
                            Monitor.Pulse(InviteObjThread);
                        }
                        Invitedata_count--;
                    }
                }
                catch (Exception ex)
                {
                    GlobusLogHelper.log.Error(" Error : " + ex.StackTrace);
                }
                countThreadControllerInvite--;

                //if (Invitedata_count == 0)  //|| DivideByUserinput < 0)
                //{

                GlobusLogHelper.log.Info(" => [ PROCESS COMPLETED " + " For " + objPinUser.Username + " ]");
                GlobusLogHelper.log.Info("---------------------------------------------------------------------------------------------------------------------------");

                //}
            }
        }
Пример #4
0
        //public List<string> GetHashTags_New(out string returnStatus)
        //{
        //    List<string> HashTags = new List<string>();
        //    string authenticityToken = string.Empty;
        //    string Woeid = string.Empty;
        //    try
        //    {
        //        //string pagesource = globushttpHelper.getHtmlfromUrl(new Uri("https://api.twitter.com/1/trends/daily.json"), "", "");
        //        Globussoft.GlobusHttpHelper HttpHelper = new Globussoft.GlobusHttpHelper();

        //        string twtPage = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/"), "", "");

        //        try
        //        {
        //            int startindex = twtPage.IndexOf("name=\"authenticity_token\"");
        //            string start = twtPage.Substring(startindex).Replace("name=\"authenticity_token\"", "");
        //            int endindex = start.IndexOf("\">");
        //            string end = start.Substring(0, endindex).Replace("value=\"", "");
        //            authenticityToken = end;
        //        }
        //        catch (Exception ex)
        //        {
        //            Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetHashTags_New() -- authenticityToken --> " + ex.Message, Globals.Path_TwitterDataScrapper);
        //            Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetHashTags_New() -- authenticityToken --> " + ex.Message, Globals.Path_TwtErrorLogs);
        //        }


        //        string pagesource = HttpHelper.postFormData(new Uri("https://twitter.com/trends/dialog"), "authenticity_token=" + authenticityToken + "&pc=true&woeid=1", "https://twitter.com/", "", "", "", "");

        //        string[] arrayDataWoied = Regex.Split(pagesource, "data-woeid");
        //        arrayDataWoied = arrayDataWoied.Skip(1).ToArray();
        //        foreach (string item in arrayDataWoied)
        //        {

        //            try
        //            {
        //                int startindex = item.IndexOf("=\\\"");
        //                string start = item.Substring(startindex).Replace("=\\\"", "");
        //                int endindex = start.IndexOf("\\\"");
        //                string end = start.Substring(0, endindex).Replace("value=\"", "");
        //                Woeid = end;
        //            }
        //            catch (Exception ex)
        //            {
        //                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetHashTags_New() -- Woeid --> " + ex.Message, Globals.Path_TwitterDataScrapper);
        //                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetHashTags_New() -- Woeid --> " + ex.Message, Globals.Path_TwtErrorLogs);
        //            }
        //            string HastagString = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/trends?k=" + Woeid + "&pc=true&personalized=false&src=module&woeid=" + Woeid + ""), "https://twitter.com/", "");

        //            string[] datatrendname = Regex.Split(HastagString, "data-trend-name=");
        //            datatrendname = datatrendname.Skip(1).ToArray();

        //            foreach (string trend in datatrendname)
        //            {
        //                try
        //                {
        //                    if (!trend.Contains("#\\"))
        //                    {
        //                        int startindex = trend.IndexOf("\\\"");
        //                        string start = trend.Substring(startindex).Replace("\\\"", "");
        //                        int endindex = start.IndexOf("\\");
        //                        string end = start.Substring(0, endindex).Replace("value=\"", "").Replace("\\\"", "");
        //                        if (!string.IsNullOrEmpty(end))
        //                        {
        //                            HashTags.Add(end);
        //                            Log("[ " + DateTime.Now + " ] => [ " + end + " ]");
        //                        }
        //                    }
        //                }
        //                catch (Exception ex)
        //                {
        //                    Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetHashTags_New() -- Woeid --> " + ex.Message, Globals.Path_TwitterDataScrapper);
        //                    Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetHashTags_New() -- Woeid --> " + ex.Message, Globals.Path_TwtErrorLogs);
        //                }
        //            }


        //        }
        //        returnStatus = "No Error";
        //        return HashTags;
        //    }
        //    catch (Exception ex)
        //    {
        //        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetHashTags_New() --> " + ex.Message, Globals.Path_TwitterDataScrapper);
        //        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetHashTags_New() --> " + ex.Message, Globals.Path_TwtErrorLogs);
        //        returnStatus = "Error";
        //        return HashTags;
        //    }
        //}
        #endregion

        public List <string> GetHashTags_New(out string returnStatus)
        {
            List <string> HashTags          = new List <string>();
            string        authenticityToken = string.Empty;
            string        Woeid             = string.Empty;
            List <string> lstWoeid          = new List <string>();
            Dictionary <string, string> dicRemoveDuplicate = new Dictionary <string, string>();

            try
            {
                //string pagesource = globushttpHelper.getHtmlfromUrl(new Uri("https://api.twitter.com/1/trends/daily.json"), "", "");
                Globussoft.GlobusHttpHelper HttpHelper = new Globussoft.GlobusHttpHelper();
                string twtPage = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/"), "", "");

                try
                {
                    int    startindex = twtPage.IndexOf("name=\"authenticity_token\"");
                    string start      = twtPage.Substring(startindex).Replace("name=\"authenticity_token\"", "");
                    int    endindex   = start.IndexOf("\">");
                    string end        = start.Substring(0, endindex).Replace("value=\"", "");
                    authenticityToken = end.Trim();
                }
                catch (Exception ex)
                {
                    Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetHashTags_New() -- authenticityToken --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                    Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetHashTags_New() -- authenticityToken --> " + ex.Message, Globals.Path_TwtErrorLogs);
                }


                string pagesource = HttpHelper.postFormData(new Uri("https://twitter.com/trends/dialog"), "authenticity_token=" + authenticityToken + "&pc=true&woeid=0", "https://twitter.com/", "", "", "", "");

                string[] arrayDataWoied = Regex.Split(pagesource, "data-woeid");
                arrayDataWoied = arrayDataWoied.Skip(1).ToArray();
                foreach (string item in arrayDataWoied)
                {
                    try
                    {
                        int    startindex = item.IndexOf("=\\\"");
                        string start      = item.Substring(startindex).Replace("=\\\"", "");
                        int    endindex   = start.IndexOf("\\\"");
                        string end        = start.Substring(0, endindex).Replace("value=\"", "");
                        Woeid = end;
                        lstWoeid.Add(Woeid);
                        lstWoeid = lstWoeid.Distinct().ToList();
                    }
                    catch (Exception ex)
                    {
                        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetHashTags_New() -- Woeid --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetHashTags_New() -- Woeid --> " + ex.Message, Globals.Path_TwtErrorLogs);
                    }
                }

                foreach (string tempWoeid in lstWoeid)
                {
                    string HastagString = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/trends?k=" + tempWoeid + "&pc=true&personalized=false&src=module&woeid=" + tempWoeid + ""), "https://twitter.com/", "");
                    //string HastagString = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/trends?k=" + tempWoeid + "&pc=true&src=module"), "https://twitter.com/", "");
                    string[] datatrendname = Regex.Split(HastagString, "data-trend-name=");
                    datatrendname = datatrendname.Skip(1).ToArray();

                    foreach (string trend in datatrendname)
                    {
                        try
                        {
                            if (!trend.Contains("#\\"))
                            {
                                int    startindex = trend.IndexOf("\\\"");
                                string start      = trend.Substring(startindex).Replace("\\\"", "");
                                int    endindex   = start.IndexOf("\\");
                                string end        = start.Substring(0, endindex).Replace("value=\"", "").Replace("\\\"", "");
                                if (!string.IsNullOrEmpty(end))
                                {
                                    try
                                    {
                                        dicRemoveDuplicate.Add(end, end);
                                        HashTags.Add(end);
                                        Log("[ " + DateTime.Now + " ] => [ " + end + " ]");
                                    }
                                    catch (Exception)
                                    {
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetHashTags_New() -- Woeid --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                            Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetHashTags_New() -- Woeid --> " + ex.Message, Globals.Path_TwtErrorLogs);
                        }
                    }
                }


                //}
                returnStatus = "No Error";
                return(HashTags);
            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetHashTags_New() --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetHashTags_New() --> " + ex.Message, Globals.Path_TwtErrorLogs);
                returnStatus = "Error";
                return(HashTags);
            }
        }
        public void StartInviteMultiThreaded(object objparameters)
        {
            PinInterestUser objPinUser = new PinInterestUser();
            try
            {
                Globussoft.GlobusHttpHelper httpHelper = new Globussoft.GlobusHttpHelper();
                Accounts Obj_AccountManager = new Accounts();

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

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

                        #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 = httpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com"));
                                //GlobusLogHelper.log.Info(" => [ Logged In With : " + objPinUser.Username + " ]");
                                //StartActionMultithreadInvite(ref objPinUser);
                            }
                            catch { };
                        }
                        if (objPinUser.isloggedin == true)
                        {
                            try
                            {
                                GlobusLogHelper.log.Info(" => [ Logged In With : " + objPinUser.Username + " ]");
                                StartActionMultithreadInvite(ref objPinUser);
                            }
                            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);
            }

            finally
            {
                try
                {
                    if (countThreadControllerInvite > Nothread_Invite)
                    {
                        lock (InviteObjThread)
                        {
                            Monitor.Pulse(InviteObjThread);
                        }
                        Invitedata_count--;
                    }
                }
                catch (Exception ex)
                {
                    GlobusLogHelper.log.Error(" Error : " + ex.StackTrace);
                }
                countThreadControllerInvite--;

                //if (Invitedata_count == 0)  //|| DivideByUserinput < 0)
                //{

                GlobusLogHelper.log.Info(" => [ PROCESS COMPLETED " + " For " + objPinUser.Username + " ]");
                GlobusLogHelper.log.Info("---------------------------------------------------------------------------------------------------------------------------");

                //}

            }

        }
Пример #6
0
        /// <summary>
        /// Makes Http Request to Confirmation URL from Mail, also requests other JS, CSS URLs
        /// </summary>
        /// <param name="ConfemUrl"></param>
        /// <param name="gif"></param>
        /// <param name="logpic"></param>
        public void LoginVerfy(string ConfemUrl, string gif, string logpic)
        {
            Globussoft.GlobusHttpHelper HttpHelper = new Globussoft.GlobusHttpHelper();

            int intProxyPort = 80;
            Regex IdCheck = new Regex("^[0-9]*$");

            if (!string.IsNullOrEmpty(_proxyPort) && IdCheck.IsMatch(_proxyPort))
            {
                intProxyPort = int.Parse(_proxyPort);
            }

            string PageSourse1 = HttpHelper.getHtmlfromUrlProxy(new Uri(ConfemUrl), _proxyAddress, intProxyPort, _proxyUsername, _proxyPassword);
            //string PageSourse1 = HttpHelper.getHtmlfromUrlProxy(new Uri(url), "127.0.0.1", 8888, "", "");

            string valueLSD = "name=" + "\"lsd\"";
            string pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/login.php"));

            int startIndex = pageSource.IndexOf(valueLSD) + 18;
            string value = pageSource.Substring(startIndex, 5);

            //Log("Logging in with " + Username);

            //string ResponseLogin = HttpHelper.postFormData(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + Email.Split('@')[0] + "%40" + Email.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "");
            string ResponseLogin = HttpHelper.postFormDataProxy(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + _Email.Split('@')[0] + "%40" + _Email.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "", _proxyAddress, intProxyPort, _proxyUsername, _proxyPassword);
            //string ResponseLogin = HttpHelper.postFormData(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + "rani.khanna" + "%40" + "hotmail.com" + "&pass="******"s15121985" + "&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "");
            /////ssss gif &s=a parse com  &s=a//////////////////////////
            string PageSourse12 = HttpHelper.getHtmlfromUrl(new Uri(ConfemUrl));
            string PageSourse13 = HttpHelper.getHtmlfromUrl(new Uri(gif));
            string PageSourse14 = HttpHelper.getHtmlfromUrl(new Uri(logpic + "&s=a"));
            string PageSourse15 = HttpHelper.getHtmlfromUrl(new Uri(logpic));


            string PageSourceConfirmed = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/?email_confirmed=1"));

            string pageSourceCheck = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=contact_importer"));
            //** FB Account Check email varified or not ***********************************************************************************//
            #region  FB Account Check email varified or not

            string pageSrc1 = string.Empty;
            string pageSrc2 = string.Empty;
            string pageSrc3 = string.Empty;
            string pageSrc4 = string.Empty;
            string substr1 = string.Empty;

            if (pageSourceCheck.Contains("Are your friends already on Facebook?") && pageSourceCheck.Contains("Skip this step"))
            {
                pageSrc1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=classmates_coworkers"));
            }
            if (pageSrc1.Contains("Fill out your Profile Info") && pageSrc1.Contains("Skip"))
            {
                pageSrc2 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic"));
            }
            if (pageSrc2.Contains("Set your profile picture") && pageSrc2.Contains("Skip"))
            {
                pageSrc3 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=summary"));
            }
            if (pageSrc3.Contains("complete the sign-up process"))
            {
                //LoggerWallPoste("not varified through " + Username);

            }
            if (pageSourceCheck.Contains("complete the sign-up process"))
            {
                //LoggerWallPoste("not varified through Email" + Username);
            }
            #endregion
            //** FB Account Check email varified or not ***********************************************************************************//

            string pageSourceHome = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/home.php"));

            //** User Id ***************//////////////////////////////////
            string UsreId = string.Empty;
            string ProFilePost = string.Empty;
            ////**Post Message For User***********************/////////////////////////////////////////////////////
            int count = 0;
            if (pageSourceHome.Contains("http://www.facebook.com/profile.php?id="))
            {
                string[] arrUser = Regex.Split(pageSourceHome, "href");
                foreach (String itemUser in arrUser)
                {
                    if (!itemUser.Contains("<!DOCTYPE"))
                    {
                        if (itemUser.Contains("http://www.facebook.com/profile.php?id="))
                        {

                            string[] arrhre = itemUser.Split('"');
                            ProFilePost = arrhre[1];
                            break;


                        }
                    }
                }
            }
            if (ProFilePost.Contains("http://www.facebook.com/profile.php?id="))
            {
                UsreId = ProFilePost.Replace("http://www.facebook.com/profile.php?id=", "");
            }



            //*** User Id **************//////////////////////////////////

            //*** Post Data **************//////////////////////////////////
            string fb_dtsg = pageSourceHome.Substring(pageSourceHome.IndexOf("fb_dtsg") + 16, 8);

            string post_form_id = pageSourceHome.Substring(pageSourceHome.IndexOf("post_form_id"), 200);
            string[] Arr = post_form_id.Split('"');
            post_form_id = Arr[4];
            post_form_id = post_form_id.Replace("\\", "");
            post_form_id = post_form_id.Replace("\\", "");
            post_form_id = post_form_id.Replace("\\", "");
            //string Response1 = HttpHelper.postFormData(new Uri("http://www.facebook.com/desktop/notifier/transfer.php?__a=1"), "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&lsd&post_form_id_source=AsyncRequest&__user="******"http://www.facebook.com/desktop/notifier/transfer.php?__a=1"), "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&lsd&post_form_id_source=AsyncRequest&__user="******"http://www.facebook.com/ajax/httponly_cookies.php?dc=snc2&__a=1"), "keys[0]=1150335208&post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&lsd&post_form_id_source=AsyncRequest&__user="******"http://www.facebook.com/ajax/contextual_help.php?__a=1&set_name=welcome&__user="******"http://www.facebook.com/"));

            pageSourceCheck1111 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/"));

            if (pageSourceCheck1111.Contains("complete the sign-up process"))
            {
                Console.WriteLine("Account is not verified for : " + _Email);
                AddToListBox("Account is not verified for : " + _Email);
            }

            string pageSource11 = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/login.php"));

            startIndex = pageSource.IndexOf(valueLSD) + 18;
            value = pageSource.Substring(startIndex, 5);

            //Log("Logging in with " + Username);

            string ResponseLogin11 = HttpHelper.postFormDataProxy(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + _Email.Split('@')[0] + "%40" + _Email.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "", _proxyAddress, intProxyPort, _proxyUsername, _proxyPassword);

            string PageSourceConfirmed11 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/?email_confirmed=1"));

            if (PageSourceConfirmed11.Contains("complete the sign-up process"))
            {
                Console.WriteLine("Account is not verified for : " + _Email);
                AddToListBox("Account is not verified for : " + _Email);
            }

            //LoggerVerify("Email verification completed for : " + Email);
        }
        public static string GetUserIDFromUsername(string username, out string Status)
        {
            string GetStatus = string.Empty;
            Globussoft.GlobusHttpHelper httpHelper = new Globussoft.GlobusHttpHelper();

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

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

            try
            {
                #region gs httpHelper code
                //if (username.Contains("@"))
                //{

                //}
                //string pagesource = httpHelper.getHtmlfromUrl(new Uri("https://api.twitter.com/1/users/show.xml?screen_name=" + username), "api.twitter.com", "");
                #endregion
                string id = string.Empty;
                string pagesource = string.Empty;

                ChilkatHttpHelpr httpHelper1 = new ChilkatHttpHelpr();
                if (NumberHelper.ValidateNumber(username))
                {
                    pagesource = httpHelper1.GetHtml("https://api.twitter.com/1/users/show.xml?user_id=" + username);
                    if (string.IsNullOrEmpty(pagesource))
                    {
                        pagesource = httpHelper1.GetHtml("https://api.twitter.com/1/users/show.xml?user_id=" + username);
                    }
                }
                else
                {
                    pagesource = httpHelper1.GetHtml("https://api.twitter.com/1/users/show.xml?screen_name=" + username);
                    if (string.IsNullOrEmpty(pagesource))
                    {
                        pagesource = httpHelper1.GetHtml("https://api.twitter.com/1/users/show.xml?screen_name=" + username);
                    }
                }

                if (!pagesource.Contains("Rate limit exceeded. Clients may not make more than 150 requests per hour.") && !pagesource.Contains("Sorry, that page does not exist") && !pagesource.Contains("User has been suspended"))
                {
                    if (NumberHelper.ValidateNumber(username))
                    {
                        int length = pagesource.IndexOf("</screen_name>");
                        username = pagesource.Substring(pagesource.IndexOf("<screen_name>"), length - pagesource.IndexOf("<screen_name>")).Replace("<screen_name>", "");
                        user_id = username;
                        GetStatus = "No Error";
                    }
                    else
                    {
                        int length = pagesource.IndexOf("</id>");
                        id = pagesource.Substring(pagesource.IndexOf("<id>"), length - pagesource.IndexOf("<id>")).Replace("<id>", "");
                        user_id = id;
                        GetStatus = "No Error";
                    }
                }
                else if (pagesource.Contains("Rate limit exceeded. Clients may not make more than 150 requests per hour."))
                {
                    GetStatus = "Rate limit exceeded";
                }
                else if (pagesource.Contains("Sorry, that page does not exist"))
                {
                    GetStatus = "Sorry, that page does not exist";
                }
                else if (pagesource.Contains("User has been suspended"))
                {
                    GetStatus = "User has been suspended";
                }
            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetUserIDFromUsername() -- " + username + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetUserIDFromUsername() -- " + username + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
                GetStatus = "Error";
            }
            Status = GetStatus;
            return user_id;
        }
Пример #8
0
        public static void RequestJSCSSIMG(string pageSource, ref GlobusHttpHelper HttpHelper)
        {
            ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

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

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

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

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

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

                listURLs = listURLs.Distinct().ToList();
                foreach (string item in listURLs)
                {
                    try
                    {
                        string res = HttpHelper.getHtmlfromUrl(new Uri(item),"" ,"");
                    }
                    catch { };
                }

            }
            catch { };
        }
        public List <string> GetMembers(string keyword, out string ReturnStatus)
        {
            string        cursor       = "-1";
            string        FollowingUrl = string.Empty;
            List <string> lstIds       = new List <string>();
            string        userID;
            string        Screen_name;
            int           counter = 0;

            try
            {
                Globussoft.GlobusHttpHelper HttpHelper = new Globussoft.GlobusHttpHelper();

StartAgain:
                if (counter == 0)
                {
                    FollowingUrl = keyword;
                    counter++;
                }
                else
                {
                    FollowingUrl = keyword + "/timeline?cursor=" + cursor + "&cursor_index=&cursor_offset=&include_available_features=1&include_entities=1&is_forward=true";
                }


                String DataCursor = string.Empty;


                string Data = HttpHelper.getHtmlfromUrl(new Uri(FollowingUrl), "", "");
                if (string.IsNullOrEmpty(Data))
                {
                    Data = HttpHelper.getHtmlfromUrl(new Uri(FollowingUrl), "", "");
                }

                if (string.IsNullOrEmpty(Data))
                {
                    AddToLog_ScrapMember("Either Url in Invalid or PageSource is getting Null or Empty.");

                    ReturnStatus = "Error";
                    return(lstIds);
                }
                String DataCursor1 = string.Empty;

                if (!Data.Contains("Rate limit exceeded") && !Data.Contains("{\"errors\":[{\"message\":\"Sorry, that page does not exist\",\"code\":34}]}") && !string.IsNullOrEmpty(Data))
                {
                    String[] DataDivArr;
                    if (Data.Contains("js-stream-item stream-item stream-item"))
                    {
                        DataDivArr = Regex.Split(Data, "js-stream-item stream-item stream-item");
                    }
                    else
                    {
                        DataDivArr = Regex.Split(Data, "js-stream-item");
                    }

                    foreach (var DataDivArr_item in DataDivArr)
                    {
                        if (DataDivArr_item.Contains("data-cursor"))
                        {
                            String DataCurso = System.Text.RegularExpressions.Regex.Split(Data, "data-cursor")[1];
                            DataCursor1 = DataCurso.Substring(DataCurso.IndexOf("="), DataCurso.IndexOf(">")).Replace(">", string.Empty).Replace("\n", string.Empty).Replace("\"", string.Empty).Replace("=", string.Empty).Trim();
                        }
                        if (DataDivArr_item.Contains("<!DOCTYPE html>") || DataDivArr_item.Contains("cursor"))
                        {
                            continue;
                        }

                        if (DataDivArr_item.Contains("data-screen-name") && DataDivArr_item.Contains(" data-user-id"))
                        {
                            int endIndex   = 0;
                            int startIndex = DataDivArr_item.IndexOf("data-screen-name");
                            try
                            {
                                endIndex = DataDivArr_item.IndexOf(">");
                            }
                            catch { }

                            if (endIndex == -1)
                            {
                                endIndex = DataDivArr_item.IndexOf("data-feedback-token");
                            }

                            string GetDataStr = DataDivArr_item.Substring(startIndex, endIndex);

                            string _SCRNameID = (GetDataStr.Substring(GetDataStr.IndexOf("data-user-id"), GetDataStr.IndexOf("data-feedback-token", GetDataStr.IndexOf("data-user-id")) - GetDataStr.IndexOf("data-user-id")).Replace("data-user-id", string.Empty).Replace("=", string.Empty).Replace("\"", "").Replace("\\\\n", string.Empty).Replace("data-screen-name=", string.Empty).Replace("\\", "").Trim());
                            string _SCRName   = (GetDataStr.Substring(GetDataStr.IndexOf("data-screen-name="), GetDataStr.IndexOf("data-user-id", GetDataStr.IndexOf("data-screen-name=")) - GetDataStr.IndexOf("data-screen-name=")).Replace("data-screen-name=", string.Empty).Replace("=", string.Empty).Replace("\"", "").Replace("\\\\n", string.Empty).Replace("data-screen-name=", string.Empty).Replace("\\", "").Trim());

                            if (noOfRecords > lstIds.Count)
                            {
                                lstIds.Add(_SCRName + ":" + _SCRNameID);
                                AddToLog_ScrapMember("[ " + DateTime.Now + " ] => [" + _SCRNameID + " :: " + _SCRName + " ]");
                                if (!File.Exists(Globals.Path_ScrapedMembersList))
                                {
                                    GlobusFileHelper.AppendStringToTextfileNewLine("UserID , UserName , Url", Globals.Path_ScrapedMembersList);
                                }
                                GlobusFileHelper.AppendStringToTextfileNewLine(_SCRNameID + "," + _SCRName + "," + keyword, Globals.Path_ScrapedMembersList);
                            }
                        }
                    }


                    if (noOfRecords != lstIds.Count)
                    {
                        if (Data.Contains("data-cursor"))
                        {
                            int    startindex = Data.IndexOf("data-cursor");
                            string start      = Data.Substring(startindex).Replace("data-cursor", "");
                            int    lastindex  = start.IndexOf("<div class=\"stream profile-stream\">");
                            if (lastindex == -1)
                            {
                                lastindex = start.IndexOf("\n");
                            }
                            string end = start.Substring(0, lastindex).Replace("\"", "").Replace("\n", string.Empty).Replace("=", string.Empty).Replace(">", string.Empty).Trim();
                            cursor = end;


                            if (cursor != "0")
                            {
                                goto StartAgain;
                            }
                        }

                        if (Data.Contains("cursor"))
                        {
                            int    startindex = Data.IndexOf("cursor");
                            string start      = Data.Substring(startindex).Replace("cursor", "");
                            int    lastindex  = -1;

                            lastindex = start.IndexOf(",");
                            if (lastindex > 40)
                            {
                                lastindex = start.IndexOf("\n");
                            }
                            string end = start.Substring(0, lastindex).Replace("\"", "").Replace("\n", string.Empty).Replace("=", string.Empty).Replace(":", string.Empty).Trim();
                            cursor = end;
                            if (cursor != "0")
                            {
                                goto StartAgain;
                            }
                        }
                    }

                    ReturnStatus = "No Error";
                    return(lstIds);
                }
                else if (Data.Contains("401 Unauthorized"))
                {
                    ReturnStatus = "Account is Suspended. ";
                    return(new List <string>());
                }
                else if (Data.Contains("{\"errors\":[{\"message\":\"Sorry, that page does not exist\",\"code\":34}]}"))
                {
                    ReturnStatus = "Sorry, that page does not exist :";
                    return(lstIds);
                }
                else if (Data.Contains("Rate limit exceeded. Clients may not make more than 150 requests per hour."))
                {
                    ReturnStatus = "Rate limit exceeded. Clients may not make more than 150 requests per hour.:-";
                    return(lstIds);
                }
                else
                {
                    ReturnStatus = "Error";
                    return(lstIds);
                }
            }
            catch (Exception ex)
            {
                //Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> getMembers() -- "" --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> getMembers() -- " + "" + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
                //AddToLog_ScrapMember("[ " + DateTime.Now + " ] => [ You have entered invalid URL " + FollowingUrl + " ]");

                ReturnStatus = "Error";

                return(lstIds);
            }
        }
Пример #10
0
        public void getFollowUserBySearch(object parameter)
        {
            try
            {
                if (FollowtweetKeywordList.Count > 0)
                {
                    string USerIdToFollow = string.Empty;

                    Array paramsArray = new object[1];

                    paramsArray = (Array)parameter;

                    KeyValuePair<string, TweetAccountManager> keyValue = (KeyValuePair<string, TweetAccountManager>)paramsArray.GetValue(0);

                    TweetAccountManager tweetAccountManager = keyValue.Value;

                    USerIdToFollow = (string)paramsArray.GetValue(1);

                    if (!tweetAccountManager.IsLoggedIn)
                    {
                        tweetAccountManager.Login();
                    }


                    if (tweetAccountManager.IsLoggedIn)
                    {
                        GlobusHttpHelper globusHttpHelper = new Globussoft.GlobusHttpHelper();

                        globusHttpHelper = tweetAccountManager.globusHttpHelper;

                        Follower.Follower Follower = new global::Follower.Follower();
                        string status = "";
                        Follower.FollowUsingProfileID(ref tweetAccountManager.globusHttpHelper, "", tweetAccountManager.postAuthenticityToken, USerIdToFollow, out status);

                        if (status == "followed")
                        {
                            try
                            {
                                Console.WriteLine("followed");
                                AddToLog_Follower("Follow From User =>" + keyValue.Key);
                               
                            }
                            catch (Exception)
                            {
                                
                            }
                        }
                        else
                        {
                            Console.WriteLine("not followed From =>" + keyValue.Key);
                            AddToLog_Follower("Not Followed From User =>" + keyValue.Key);
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Пример #11
0
        public void LoginVerfy(string ConfemUrl, string gif, string logpic)
        {
            Globussoft.GlobusHttpHelper HttpHelper = new Globussoft.GlobusHttpHelper();

            int intProxyPort = 80;
            Regex IdCheck = new Regex("^[0-9]*$");

            if (!string.IsNullOrEmpty(proxyPort) && IdCheck.IsMatch(proxyPort))
            {
                intProxyPort = int.Parse(proxyPort);
            }

            string PageSourse1 = HttpHelper.getHtmlfromUrlProxy(new Uri(ConfemUrl), proxyAddress, intProxyPort, proxyUser, proxyPass);
            //string PageSourse1 = HttpHelper.getHtmlfromUrlProxy(new Uri(url), "127.0.0.1", 8888, "", "");

            string valueLSD = "name=" + "\"lsd\"";
            string pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/login.php"));

            int startIndex = pageSource.IndexOf(valueLSD) + 18;
            string value = pageSource.Substring(startIndex, 5);

            //Log("Logging in with " + Username);

            //string ResponseLogin = HttpHelper.postFormData(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + Email.Split('@')[0] + "%40" + Email.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "");
            string ResponseLogin = HttpHelper.postFormDataProxy(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + Username.Split('@')[0] + "%40" + Username.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "", proxyAddress, intProxyPort, proxyUser, proxyPass);
            //string ResponseLogin = HttpHelper.postFormData(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + "rani.khanna" + "%40" + "hotmail.com" + "&pass="******"s15121985" + "&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "");
            /////ssss gif &s=a parse com  &s=a//////////////////////////
            string PageSourse12 = HttpHelper.getHtmlfromUrl(new Uri(ConfemUrl));

            try
            {
                string PageSourse13 = HttpHelper.getHtmlfromUrl(new Uri(gif));
            }
            catch (Exception)
            {
            }
            try
            {
                string PageSourse14 = HttpHelper.getHtmlfromUrl(new Uri(logpic + "&s=a"));
            }
            catch (Exception)
            {
            }
            try
            {
                string PageSourse15 = HttpHelper.getHtmlfromUrl(new Uri(logpic));
            }
            catch (Exception)
            {
            }

            //** User Id ***************//////////////////////////////////
            string UsreId = string.Empty;
            string ProFilePost = string.Empty;

            //if (ResponseLogin.Contains("http://www.facebook.com/profile.php?id="))
            //{
            //    string[] arrUser = Regex.Split(ResponseLogin, "href");
            //    foreach (String itemUser in arrUser)
            //    {
            //        if (!itemUser.Contains("<!DOCTYPE"))
            //        {
            //            if (itemUser.Contains("http://www.facebook.com/profile.php?id="))
            //            {

            //                string[] arrhre = itemUser.Split('"');
            //                ProFilePost = arrhre[1];
            //                break;


            //            }
            //        }
            //    }
            //}
            //if (ResponseLogin.Contains("http://www.facebook.com/profile.php?id="))
            //{
            //    UsreId = ProFilePost.Replace("http://www.facebook.com/profile.php?id=", "");
            //}
            if (string.IsNullOrEmpty(UsreId))
            {
                UsreId = GlobusHttpHelper.ParseJson(ResponseLogin, "user");
            }


            //*** User Id **************//////////////////////////////////

            //*** Post Data **************//////////////////////////////////
            string fb_dtsg = GlobusHttpHelper.GetParamValue(ResponseLogin, "fb_dtsg");//pageSourceHome.Substring(pageSourceHome.IndexOf("fb_dtsg") + 16, 8);
            if (string.IsNullOrEmpty(fb_dtsg))
            {
                fb_dtsg = GlobusHttpHelper.ParseJson(ResponseLogin, "fb_dtsg");
            }

            string post_form_id = GlobusHttpHelper.GetParamValue(ResponseLogin, "post_form_id");//pageSourceHome.Substring(pageSourceHome.IndexOf("post_form_id"), 200);
            if (string.IsNullOrEmpty(post_form_id))
            {
                post_form_id = GlobusHttpHelper.ParseJson(ResponseLogin, "post_form_id");
            }

            string PageSourceConfirmed = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/?email_confirmed=1"));

            string pageSourceCheck = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=contact_importer"));

            

            ///Code for skipping additional optional Page
            try
            {
                string postDataSkipFirstStep = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=friend_requests&next_step_name=contact_importer&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=16581681208511510848190";

                string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), postDataSkipFirstStep);
                Thread.Sleep(1000);
            }
            catch (Exception)
            {
            }

            pageSourceCheck = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted/?step=contact_importer")); 


            //** FB Account Check email varified or not ***********************************************************************************//
            #region  FB Account Check email varified or not

            string pageSrc1 = string.Empty;
            string pageSrc2 = string.Empty;
            string pageSrc3 = string.Empty;
            string pageSrc4 = string.Empty;
            string substr1 = string.Empty;

            if (pageSourceCheck.Contains("Are your friends already on Facebook?") && pageSourceCheck.Contains("Skip this step"))
            {
                string newPostData = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=contact_importer&next_step_name=classmates_coworkers&previous_step_name=friend_requests&skip=Skip%20this%20step&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=165816776847576104244";
                string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData);

                pageSrc1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=classmates_coworkers"));

                Thread.Sleep(1000);

                pageSrc1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted/?step=classmates_coworkers")); 
            }
            if ((pageSrc1.Contains("Fill out your Profile Info") || pageSrc1.Contains("Fill out your Profile info")) && pageSrc1.Contains("Skip"))
            {
                string newPostData = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=classmates_coworkers&next_step_name=upload_profile_pic&previous_step_name=contact_importer&current_pane=info&hs[school][id][0]=&hs[school][text][0]=&hs[start_year][text][0]=-1&hs[year][text][0]=-1&hs[entry_id][0]=&college[entry_id][0]=&college[school][id][0]=0&college[school][text][0]=&college[start_year][text][0]=-1&college[year][text][0]=-1&college[type][0]=college&work[employer][id][0]=0&work[employer][text][0]=&work[entry_id][0]=&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=165816776847576104580";
                string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData);

                //pageSrc2 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic"));

                ///Post Data Parsing
                Dictionary<string, string> lstfriend_browser_id = new Dictionary<string, string>();

                string[] initFriendArray = Regex.Split(postRes, "FriendStatus.initFriend");

                int tempCount = 0;
                foreach (string item in initFriendArray)
                {
                    if (tempCount==0)
                    {
                        tempCount++;
                        continue;
                    }
                    if (tempCount > 0)
                    {
                        int startIndx = item.IndexOf("(\\") + "(\\".Length + 1;
                        int endIndx = item.IndexOf("\\", startIndx);
                        string paramValue = item.Substring(startIndx, endIndx - startIndx);
                        lstfriend_browser_id.Add("friend_browser_id[" + (tempCount-1) + "]=", paramValue);
                        tempCount++;
                    }
                }

                string partPostData = string.Empty;
                foreach (var item in lstfriend_browser_id)
                {
                    partPostData = partPostData + item.Key + item.Value + "&";
                }

                string newPostData1 = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=classmates_coworkers&next_step_name=upload_profile_pic&previous_step_name=contact_importer&current_pane=pymk&hs[school][id][0]=&hs[school][text][0]=&hs[year][text][0]=-1&hs[entry_id][0]=&college[entry_id][0]=&college[school][id][0]=0&college[school][text][0]=&college[year][text][0]=-1&college[type][0]=college&work[employer][id][0]=0&work[employer][text][0]=&work[entry_id][0]=&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&" + partPostData + "phstamp=1658167541109987992266";//"post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=classmates_coworkers&next_step_name=upload_profile_pic&previous_step_name=contact_importer&current_pane=pymk&friend_browser_id[0]=100002869910855&friend_browser_id[1]=100001857152486&friend_browser_id[2]=575678600&friend_browser_id[3]=100003506761599&friend_browser_id[4]=563402235&friend_browser_id[5]=1268675170&friend_browser_id[6]=1701838026&friend_browser_id[7]=623640106&friend_browser_id[8]=648873235&friend_browser_id[9]=100000151781814&friend_browser_id[10]=657007597&friend_browser_id[11]=1483373867&friend_browser_id[12]=778266161&friend_browser_id[13]=1087830021&friend_browser_id[14]=100001333876108&friend_browser_id[15]=100000534308531&friend_browser_id[16]=1213205246&friend_browser_id[17]=45608778&friend_browser_id[18]=100003080150820&friend_browser_id[19]=892195716&friend_browser_id[20]=100001238774509&friend_browser_id[21]=45602360&friend_browser_id[22]=100000054900916&friend_browser_id[23]=100001308090108&friend_browser_id[24]=100000400766182&friend_browser_id[25]=100001159247338&friend_browser_id[26]=1537081666&friend_browser_id[27]=100000743261988&friend_browser_id[28]=1029373920&friend_browser_id[29]=1077680976&friend_browser_id[30]=100000001266475&friend_browser_id[31]=504487658&friend_browser_id[32]=82600225&friend_browser_id[33]=1023509811&friend_browser_id[34]=100000128061486&friend_browser_id[35]=100001853125513&friend_browser_id[36]=576201748&friend_browser_id[37]=22806492&friend_browser_id[38]=100003232772830&friend_browser_id[39]=1447942875&friend_browser_id[40]=100000131241521&friend_browser_id[41]=100002076794734&friend_browser_id[42]=1397169487&friend_browser_id[43]=1457321074&friend_browser_id[44]=1170969536&friend_browser_id[45]=18903839&friend_browser_id[46]=695329369&friend_browser_id[47]=1265734280&friend_browser_id[48]=698096805&friend_browser_id[49]=777678515&friend_browser_id[50]=529685319&hs[school][id][0]=&hs[school][text][0]=&hs[year][text][0]=-1&hs[entry_id][0]=&college[entry_id][0]=&college[school][id][0]=0&college[school][text][0]=&college[year][text][0]=-1&college[type][0]=college&work[employer][id][0]=0&work[employer][text][0]=&work[entry_id][0]=&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user=100003556207009&phstamp=1658167541109987992266";
                string postRes1 = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData1);

                pageSrc2 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic"));

                Thread.Sleep(4000);

                pageSrc2 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic"));


                string newPostData2 = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=upload_profile_pic&previous_step_name=classmates_coworkers&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=165816812057527766201";
                string postRes2 = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData);

            }
            if (pageSrc2.Contains("Set your profile picture") && pageSrc2.Contains("Skip"))
            {
                string newPostData = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=upload_profile_pic&previous_step_name=classmates_coworkers&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=165816776847576104201";
                try
                {
                    string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData);

                    pageSrc3 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=summary"));
                    pageSrc3 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/home.php?ref=wizard"));
                }
                catch (Exception)
                {
                }
               
            }
            if (pageSrc3.Contains("complete the sign-up process"))
            {
                //LoggerWallPoste("not varified through " + Username);

            }
            if (pageSourceCheck.Contains("complete the sign-up process"))
            {
                //LoggerWallPoste("not varified through Email" + Username);
            }
            #endregion
            //** FB Account Check email varified or not ***********************************************************************************//

            string pageSourceHome = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/home.php"));

          
            ////**Post Message For User***********************/////////////////////////////////////////////////////
            int count = 0;
            
            //string[] Arr = post_form_id.Split('"');
            //post_form_id = Arr[4];
            //post_form_id = post_form_id.Replace("\\", "");
            //post_form_id = post_form_id.Replace("\\", "");
            //post_form_id = post_form_id.Replace("\\", "");
            //string Response1 = HttpHelper.postFormData(new Uri("http://www.facebook.com/desktop/notifier/transfer.php?__a=1"), "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&lsd&post_form_id_source=AsyncRequest&__user="******"http://www.facebook.com/desktop/notifier/transfer.php?__a=1"), "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&lsd&post_form_id_source=AsyncRequest&__user="******"http://www.facebook.com/ajax/httponly_cookies.php?dc=snc2&__a=1"), "keys[0]=1150335208&post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&lsd&post_form_id_source=AsyncRequest&__user="******"http://www.facebook.com/ajax/contextual_help.php?__a=1&set_name=welcome&__user="******"http://www.facebook.com/"));

            pageSourceCheck1111 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/"));

            if (pageSourceCheck1111.Contains("complete the sign-up process"))
            {
                Console.WriteLine("Account is not verified for : " + Username);
            }

            LoggerEmailVerify("Registration Succeeded for: " + Username);
            //LoggerVerify("Email verification completed for : " + Email);
        }
Пример #12
0
        public void getpageSourceFromProxy(object item)
        {
            if (proxyStop)
            {
                return;
            }
            try
            {
                Thread.CurrentThread.IsBackground = true;
                lstProxyThread.Add(Thread.CurrentThread);
                lstProxyThread = lstProxyThread.Distinct().ToList();
            }
            catch { }

            countParseProxiesThreads++;

            Array  Item_value = (Array)item;
            string ClGlobul_ProxyList_item = (string)Item_value.GetValue(0);

            Globussoft.GlobusHttpHelper GlobusHttpHelper = new Globussoft.GlobusHttpHelper();
            ChilkatHttpHelpr            objchilkat       = new ChilkatHttpHelpr();
            string proxyad       = string.Empty;
            string proxyport     = string.Empty;
            string proxyusername = string.Empty;
            string proxyPassword = string.Empty;
            string pagesource1   = string.Empty;
            string pagesource    = string.Empty;


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

                try
                {
                    if (proxyStop)
                    {
                        return;
                    }

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

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


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

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

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

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

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

                lock (lockerforNonWorkingProxies)
                {
                    GlobusFileHelper.AppendStringToTextfileNewLine(proxyad + ":" + proxyport + ":" + proxyusername + ":" + proxyPassword, GlobusFileHelper.NonWorkingProxiesList);
                }
            }
            finally
            {
                lock (lockerforProxies)
                {
                    countParseProxiesThreads--;
                    Monitor.Pulse(lockerforProxies);
                }
                Proxystatus--;
                if (Proxystatus == 0)
                {
                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                    GlobusLogHelper.log.Info("-----------------------------------------------------------------------------------------------------------------------------------");
                }
            }
        }
Пример #13
0
        /// <summary>
        /// Checks for Email Verification
        /// Also does Skip
        /// </summary>
        public bool CheckVerification(string response, ref Globussoft.GlobusHttpHelper HttpHelper)
        {
            //** FB Account Check email varified or not ***********************************************************************************//
            #region  FB Account Check email varified or not
            string pageSourceCheck = string.Empty;
            pageSourceCheck = response;
            string pageSrc1 = string.Empty;
            string pageSrc2 = string.Empty;
            string pageSrc3 = string.Empty;
            string pageSrc4 = string.Empty;
            string substr1  = string.Empty;

            #region Commented
            //if (pageSourceCheck.Contains("Are your friends already on Facebook?") && pageSourceCheck.Contains("Skip this step"))
            //{
            //    pageSrc1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=classmates_coworkers"));
            //}
            //if (pageSrc1.Contains("Fill out your Profile Info") && pageSrc1.Contains("Skip"))
            //{
            //    pageSrc2 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic"));
            //}
            //if (pageSrc2.Contains("Set your profile picture") && pageSrc2.Contains("Skip"))
            //{
            //    pageSrc3 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=summary"));
            //}
            //if (pageSrc3.Contains("complete the sign-up process"))
            //{
            //    return false;
            //}
            //if (pageSourceCheck.Contains("complete the sign-up process"))
            //{
            //    return false;
            //}

            #endregion

            ///Skip Code
            if ((pageSourceCheck.Contains("Are your friends already on Facebook?") && pageSourceCheck.Contains("Skip this step")) || pageSourceCheck.Contains("window.location.replace(\"http:\\/\\/www.facebook.com\\/gettingstarted.php") || pageSourceCheck.Contains("window.location.replace(\"http:\\/\\/www.facebook.com\\/confirmemail.php"))
            {
                pageSrc1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=classmates_coworkers"));
                //}
                Thread.Sleep(300);
                //if (pageSrc1.Contains("Fill out your Profile Info") && pageSrc1.Contains("Skip"))
                //{
                pageSrc2 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic"));
                Thread.Sleep(300);
                //}
                //if (pageSrc2.Contains("Set your profile picture") && pageSrc2.Contains("Skip"))
                //{
                pageSrc3 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=summary"));
                Thread.Sleep(300);
                //}

                ///Check if asks for email
                //If asks then Set Status as PhoneVerfiedOnly
                if (pageSrc3.Contains("complete the sign-up process"))
                {
                    PumpMessage("Account : " + Username + " is NOT Email verified");
                    InsertUpdateDatabase(AccountStatus.Status(ProfileStatus.PhoneVerfiedOnly));
                    return(false);
                }
                else if (pageSourceCheck.Contains("please login to your email account below") || pageSourceCheck.Contains("Go to your email"))
                {
                    PumpMessage("Account : " + Username + " is NOT Email verified");
                    InsertUpdateDatabase(AccountStatus.Status(ProfileStatus.PhoneVerfiedOnly));
                    return(false);
                }
            }

            ///Check if asks for email
            //If asks then Set Status as PhoneVerfiedOnly
            if (pageSourceCheck.Contains("complete the sign-up process"))
            {
                PumpMessage("Account : " + Username + " is NOT Email verified");
                InsertUpdateDatabase(AccountStatus.Status(ProfileStatus.PhoneVerfiedOnly));
                return(false);
            }
            else if (pageSourceCheck.Contains("window.location.replace(\"http:\\/\\/www.facebook.com\\/confirmemail.php"))
            {
                PumpMessage("Account : " + Username + " is NOT Email verified");
                InsertUpdateDatabase(AccountStatus.Status(ProfileStatus.PhoneVerfiedOnly));
                return(false);
            }
            else if (pageSourceCheck.Contains("please login to your email account below") || pageSourceCheck.Contains("Go to your email"))
            {
                PumpMessage("Account : " + Username + " is NOT Email verified");
                InsertUpdateDatabase(AccountStatus.Status(ProfileStatus.PhoneVerfiedOnly));
                return(false);
            }

            #endregion
            //** FB Account Check email varified or not ***********************************************************************************//

            PumpMessage("Account : " + Username + " is Email & Phone verified");
            InsertUpdateDatabase(AccountStatus.Status(ProfileStatus.PhonePlusEmailVerified));


            return(true);
        }
Пример #14
0
        public void getFollowUserBySearch(object parameter)
        {
            try
            {
                if (FollowtweetKeywordList.Count > 0)
                {
                    string USerIdToFollow = string.Empty;

                    Array paramsArray = new object[1];

                    paramsArray = (Array)parameter;

                    //KeyValuePair<string, TweetAccountManager> keyValue = (KeyValuePair<string, TweetAccountManager>)paramsArray.GetValue(0);

                    TweetAccountManager tweetAccountManager = (TweetAccountManager)paramsArray.GetValue(0);

                    USerIdToFollow = (string)paramsArray.GetValue(1);

                    if (!tweetAccountManager.IsLoggedIn)
                    {
                        tweetAccountManager.Login();
                    }

                    ///Return if Suspended
                    if (tweetAccountManager.AccountStatus == "Account Suspended")
                    {
                        //AddToLog_Follower(tweetAccountManager.Username + " : Suspended");
                        return;
                    }

                    if (tweetAccountManager.IsLoggedIn)
                    {
                        GlobusHttpHelper globusHttpHelper = new Globussoft.GlobusHttpHelper();

                        //string abc =  globusHttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/i/search/typeahead.json?count=10&q=abc"), "https://twitter.com/","");
                        globusHttpHelper = tweetAccountManager.globusHttpHelper;

                        Follower.Follower Follower = new global::Follower.Follower();
                        string status = "";
                        Follower.FollowUsingProfileID_New(ref tweetAccountManager.globusHttpHelper, "", tweetAccountManager.postAuthenticityToken, USerIdToFollow, out status);

                        if (status == "followed")
                        {
                            Console.WriteLine("followed");
                            AddToLog_Follower("[ " + DateTime.Now + " ] => [ Followed User >>> " + USerIdToFollow + " From " + tweetAccountManager.Username + " ]");

                            string username = string.Empty;
                            string userid = string.Empty;
                            try
                            {
                                if (NumberHelper.ValidateNumber(USerIdToFollow))
                                {
                                    string outStatus = string.Empty;
                                    username = TwitterSignup.TwitterSignup_TwitterDataScrapper.GetUserIdToUserName_New(USerIdToFollow, out outStatus, ref globusHttpHelper);
                                    userid = USerIdToFollow;
                                }
                                else
                                {
                                    string outStatus = string.Empty;
                                    userid = TwitterSignup.TwitterSignup_TwitterDataScrapper.GetUsernameToUserID_New(USerIdToFollow, out outStatus, ref globusHttpHelper);
                                    username = USerIdToFollow;
                                }

                                objclsSettingDB.InsertUpdateFollowTable(tweetAccountManager.Username, userid, username);
                            }
                            catch (Exception)
                            {
                            }
                            GlobusFileHelper.AppendStringToTextfileNewLine(tweetAccountManager.Username + ":" + tweetAccountManager.Password + ":" + username + ":" + userid + ":" + tweetAccountManager.proxyAddress + ":" + tweetAccountManager.proxyPort + ":" + tweetAccountManager.proxyUsername + ":" + tweetAccountManager.proxyPassword, Globals.path_SuccessfullyFollowAccounts);
                        }
                        else if (status == "Already Followed")
                        {
                            Console.WriteLine("Already followed From =>" + tweetAccountManager.Username);
                            AddToLog_Follower("[ " + DateTime.Now + " ] => [ Already Followed User >>> " + USerIdToFollow + " From " + tweetAccountManager.Username + " ]");
                            GlobusFileHelper.AppendStringToTextfileNewLine(tweetAccountManager.Username + ":" + tweetAccountManager.Password + ":" + "" + ":" + USerIdToFollow + ":" + tweetAccountManager.proxyAddress + ":" + tweetAccountManager.proxyPort + ":" + tweetAccountManager.proxyUsername + ":" + tweetAccountManager.proxyPassword, Globals.path_FailedToFollowAccounts);
                        }

                        else
                        {
                            Console.WriteLine("not followed From =>" + tweetAccountManager.Username);
                            AddToLog_Follower("[ " + DateTime.Now + " ] => [ Not Followed User >>> " + USerIdToFollow + " From " + tweetAccountManager.Username + " ]");
                            GlobusFileHelper.AppendStringToTextfileNewLine(tweetAccountManager.Username + ":" + tweetAccountManager.Password + ":" + "" + ":" + USerIdToFollow + ":" + tweetAccountManager.proxyAddress + ":" + tweetAccountManager.proxyPort + ":" + tweetAccountManager.proxyUsername + ":" + tweetAccountManager.proxyPassword, Globals.path_FailedToFollowAccounts);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " Mathod:- getFollowUserBySearch -->Error :- " + ex.Message, Globals.Path_FollowerErroLog);
            }
        }
Пример #15
0
        public void LoginVerfy(string ConfemUrl, string gif, string logpic)
        {
            Globussoft.GlobusHttpHelper HttpHelper = new Globussoft.GlobusHttpHelper();

            int   intProxyPort = 80;
            Regex IdCheck      = new Regex("^[0-9]*$");

            if (!string.IsNullOrEmpty(proxyPort) && IdCheck.IsMatch(proxyPort))
            {
                intProxyPort = int.Parse(proxyPort);
            }

            string PageSourse1 = HttpHelper.getHtmlfromUrlProxy(new Uri(ConfemUrl), proxyAddress, intProxyPort, proxyUser, proxyPass);
            //string PageSourse1 = HttpHelper.getHtmlfromUrlProxy(new Uri(url), "127.0.0.1", 8888, "", "");

            string valueLSD   = "name=" + "\"lsd\"";
            string pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/login.php"));

            int    startIndex = pageSource.IndexOf(valueLSD) + 18;
            string value      = pageSource.Substring(startIndex, 5);

            //Log("Logging in with " + Username);

            //string ResponseLogin = HttpHelper.postFormData(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + Email.Split('@')[0] + "%40" + Email.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "");
            string ResponseLogin = HttpHelper.postFormDataProxy(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + Username.Split('@')[0] + "%40" + Username.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "", proxyAddress, intProxyPort, proxyUser, proxyPass);
            //string ResponseLogin = HttpHelper.postFormData(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + "rani.khanna" + "%40" + "hotmail.com" + "&pass="******"s15121985" + "&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "");
            /////ssss gif &s=a parse com  &s=a//////////////////////////
            string PageSourse12 = HttpHelper.getHtmlfromUrl(new Uri(ConfemUrl));

            try
            {
                string PageSourse13 = HttpHelper.getHtmlfromUrl(new Uri(gif));
            }
            catch (Exception)
            {
            }
            try
            {
                string PageSourse14 = HttpHelper.getHtmlfromUrl(new Uri(logpic + "&s=a"));
            }
            catch (Exception)
            {
            }
            try
            {
                string PageSourse15 = HttpHelper.getHtmlfromUrl(new Uri(logpic));
            }
            catch (Exception)
            {
            }

            //** User Id ***************//////////////////////////////////
            string UsreId      = string.Empty;
            string ProFilePost = string.Empty;

            //if (ResponseLogin.Contains("http://www.facebook.com/profile.php?id="))
            //{
            //    string[] arrUser = Regex.Split(ResponseLogin, "href");
            //    foreach (String itemUser in arrUser)
            //    {
            //        if (!itemUser.Contains("<!DOCTYPE"))
            //        {
            //            if (itemUser.Contains("http://www.facebook.com/profile.php?id="))
            //            {

            //                string[] arrhre = itemUser.Split('"');
            //                ProFilePost = arrhre[1];
            //                break;


            //            }
            //        }
            //    }
            //}
            //if (ResponseLogin.Contains("http://www.facebook.com/profile.php?id="))
            //{
            //    UsreId = ProFilePost.Replace("http://www.facebook.com/profile.php?id=", "");
            //}
            if (string.IsNullOrEmpty(UsreId))
            {
                UsreId = GlobusHttpHelper.ParseJson(ResponseLogin, "user");
            }


            //*** User Id **************//////////////////////////////////

            //*** Post Data **************//////////////////////////////////
            string fb_dtsg = GlobusHttpHelper.GetParamValue(ResponseLogin, "fb_dtsg");//pageSourceHome.Substring(pageSourceHome.IndexOf("fb_dtsg") + 16, 8);

            if (string.IsNullOrEmpty(fb_dtsg))
            {
                fb_dtsg = GlobusHttpHelper.ParseJson(ResponseLogin, "fb_dtsg");
            }

            string post_form_id = GlobusHttpHelper.GetParamValue(ResponseLogin, "post_form_id");//pageSourceHome.Substring(pageSourceHome.IndexOf("post_form_id"), 200);

            if (string.IsNullOrEmpty(post_form_id))
            {
                post_form_id = GlobusHttpHelper.ParseJson(ResponseLogin, "post_form_id");
            }

            string PageSourceConfirmed = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/?email_confirmed=1"));

            string pageSourceCheck = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=contact_importer"));



            ///Code for skipping additional optional Page
            try
            {
                string postDataSkipFirstStep = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=friend_requests&next_step_name=contact_importer&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=16581681208511510848190";

                string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), postDataSkipFirstStep);
                Thread.Sleep(1000);
            }
            catch (Exception)
            {
            }

            pageSourceCheck = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted/?step=contact_importer"));


            //** FB Account Check email varified or not ***********************************************************************************//
            #region  FB Account Check email varified or not

            string pageSrc1 = string.Empty;
            string pageSrc2 = string.Empty;
            string pageSrc3 = string.Empty;
            string pageSrc4 = string.Empty;
            string substr1  = string.Empty;

            if (pageSourceCheck.Contains("Are your friends already on Facebook?") && pageSourceCheck.Contains("Skip this step"))
            {
                string newPostData = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=contact_importer&next_step_name=classmates_coworkers&previous_step_name=friend_requests&skip=Skip%20this%20step&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=165816776847576104244";
                string postRes     = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData);

                pageSrc1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=classmates_coworkers"));

                Thread.Sleep(1000);

                pageSrc1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted/?step=classmates_coworkers"));
            }
            if ((pageSrc1.Contains("Fill out your Profile Info") || pageSrc1.Contains("Fill out your Profile info")) && pageSrc1.Contains("Skip"))
            {
                string newPostData = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=classmates_coworkers&next_step_name=upload_profile_pic&previous_step_name=contact_importer&current_pane=info&hs[school][id][0]=&hs[school][text][0]=&hs[start_year][text][0]=-1&hs[year][text][0]=-1&hs[entry_id][0]=&college[entry_id][0]=&college[school][id][0]=0&college[school][text][0]=&college[start_year][text][0]=-1&college[year][text][0]=-1&college[type][0]=college&work[employer][id][0]=0&work[employer][text][0]=&work[entry_id][0]=&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=165816776847576104580";
                string postRes     = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData);

                //pageSrc2 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic"));

                ///Post Data Parsing
                Dictionary <string, string> lstfriend_browser_id = new Dictionary <string, string>();

                string[] initFriendArray = Regex.Split(postRes, "FriendStatus.initFriend");

                int tempCount = 0;
                foreach (string item in initFriendArray)
                {
                    if (tempCount == 0)
                    {
                        tempCount++;
                        continue;
                    }
                    if (tempCount > 0)
                    {
                        int    startIndx  = item.IndexOf("(\\") + "(\\".Length + 1;
                        int    endIndx    = item.IndexOf("\\", startIndx);
                        string paramValue = item.Substring(startIndx, endIndx - startIndx);
                        lstfriend_browser_id.Add("friend_browser_id[" + (tempCount - 1) + "]=", paramValue);
                        tempCount++;
                    }
                }

                string partPostData = string.Empty;
                foreach (var item in lstfriend_browser_id)
                {
                    partPostData = partPostData + item.Key + item.Value + "&";
                }

                string newPostData1 = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=classmates_coworkers&next_step_name=upload_profile_pic&previous_step_name=contact_importer&current_pane=pymk&hs[school][id][0]=&hs[school][text][0]=&hs[year][text][0]=-1&hs[entry_id][0]=&college[entry_id][0]=&college[school][id][0]=0&college[school][text][0]=&college[year][text][0]=-1&college[type][0]=college&work[employer][id][0]=0&work[employer][text][0]=&work[entry_id][0]=&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&" + partPostData + "phstamp=1658167541109987992266";//"post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=classmates_coworkers&next_step_name=upload_profile_pic&previous_step_name=contact_importer&current_pane=pymk&friend_browser_id[0]=100002869910855&friend_browser_id[1]=100001857152486&friend_browser_id[2]=575678600&friend_browser_id[3]=100003506761599&friend_browser_id[4]=563402235&friend_browser_id[5]=1268675170&friend_browser_id[6]=1701838026&friend_browser_id[7]=623640106&friend_browser_id[8]=648873235&friend_browser_id[9]=100000151781814&friend_browser_id[10]=657007597&friend_browser_id[11]=1483373867&friend_browser_id[12]=778266161&friend_browser_id[13]=1087830021&friend_browser_id[14]=100001333876108&friend_browser_id[15]=100000534308531&friend_browser_id[16]=1213205246&friend_browser_id[17]=45608778&friend_browser_id[18]=100003080150820&friend_browser_id[19]=892195716&friend_browser_id[20]=100001238774509&friend_browser_id[21]=45602360&friend_browser_id[22]=100000054900916&friend_browser_id[23]=100001308090108&friend_browser_id[24]=100000400766182&friend_browser_id[25]=100001159247338&friend_browser_id[26]=1537081666&friend_browser_id[27]=100000743261988&friend_browser_id[28]=1029373920&friend_browser_id[29]=1077680976&friend_browser_id[30]=100000001266475&friend_browser_id[31]=504487658&friend_browser_id[32]=82600225&friend_browser_id[33]=1023509811&friend_browser_id[34]=100000128061486&friend_browser_id[35]=100001853125513&friend_browser_id[36]=576201748&friend_browser_id[37]=22806492&friend_browser_id[38]=100003232772830&friend_browser_id[39]=1447942875&friend_browser_id[40]=100000131241521&friend_browser_id[41]=100002076794734&friend_browser_id[42]=1397169487&friend_browser_id[43]=1457321074&friend_browser_id[44]=1170969536&friend_browser_id[45]=18903839&friend_browser_id[46]=695329369&friend_browser_id[47]=1265734280&friend_browser_id[48]=698096805&friend_browser_id[49]=777678515&friend_browser_id[50]=529685319&hs[school][id][0]=&hs[school][text][0]=&hs[year][text][0]=-1&hs[entry_id][0]=&college[entry_id][0]=&college[school][id][0]=0&college[school][text][0]=&college[year][text][0]=-1&college[type][0]=college&work[employer][id][0]=0&work[employer][text][0]=&work[entry_id][0]=&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user=100003556207009&phstamp=1658167541109987992266";
                string postRes1     = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData1);

                pageSrc2 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic"));

                Thread.Sleep(4000);

                pageSrc2 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic"));


                string newPostData2 = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=upload_profile_pic&previous_step_name=classmates_coworkers&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=165816812057527766201";
                string postRes2     = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData);
            }
            if (pageSrc2.Contains("Set your profile picture") && pageSrc2.Contains("Skip"))
            {
                string newPostData = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=upload_profile_pic&previous_step_name=classmates_coworkers&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=165816776847576104201";
                try
                {
                    string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData);

                    pageSrc3 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=summary"));
                    pageSrc3 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/home.php?ref=wizard"));
                }
                catch (Exception)
                {
                }
            }
            if (pageSrc3.Contains("complete the sign-up process"))
            {
                //LoggerWallPoste("not varified through " + Username);
            }
            if (pageSourceCheck.Contains("complete the sign-up process"))
            {
                //LoggerWallPoste("not varified through Email" + Username);
            }
            #endregion
            //** FB Account Check email varified or not ***********************************************************************************//

            string pageSourceHome = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/home.php"));


            ////**Post Message For User***********************/////////////////////////////////////////////////////
            int count = 0;

            //string[] Arr = post_form_id.Split('"');
            //post_form_id = Arr[4];
            //post_form_id = post_form_id.Replace("\\", "");
            //post_form_id = post_form_id.Replace("\\", "");
            //post_form_id = post_form_id.Replace("\\", "");
            //string Response1 = HttpHelper.postFormData(new Uri("http://www.facebook.com/desktop/notifier/transfer.php?__a=1"), "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&lsd&post_form_id_source=AsyncRequest&__user="******"http://www.facebook.com/desktop/notifier/transfer.php?__a=1"), "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&lsd&post_form_id_source=AsyncRequest&__user="******"http://www.facebook.com/ajax/httponly_cookies.php?dc=snc2&__a=1"), "keys[0]=1150335208&post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&lsd&post_form_id_source=AsyncRequest&__user="******"http://www.facebook.com/ajax/contextual_help.php?__a=1&set_name=welcome&__user="******"http://www.facebook.com/"));

            pageSourceCheck1111 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/"));

            if (pageSourceCheck1111.Contains("complete the sign-up process"))
            {
                Console.WriteLine("Account is not verified for : " + Username);
            }

            LoggerEmailVerify("Registration Succeeded for: " + Username);
            //LoggerVerify("Email verification completed for : " + Email);
        }
        //valueURl = gResponse.ResponseUri.ToString();

        public string HttpUploadPictureForWall(ref GlobusHttpHelper HttpHelper, string userid, string url, string paramName, string contentType, string localImagePath, NameValueCollection nvc, string proxyAddress, int proxyPort, string proxyUsername, string proxyPassword, string picfilepath, string fileName)
        {

            #region PostData_ForUploadImage
            string localImagePath1 = localImagePath.Replace(picfilepath, string.Empty).Replace("\\", string.Empty);

            #endregion


            bool isAddaCover = false;
            string responseStr = string.Empty;

            try
            {
                string boundary = "-----------------------------" + DateTime.Now.Ticks.ToString("X");
                byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");

                gRequest = (HttpWebRequest)WebRequest.Create(url);
                gRequest.ContentType = "multipart/form-data; boundary=" + "----" + boundary.Replace("-", "");
                //gRequest.Referer = "Referer: https://www.facebook.com/profile.php?id=" + userid + "&ref=tn_tnmn";
                if (url.Contains("https://in."))
                {
                    gRequest.Referer = "https://in.pinterest.com/";
                }
                else
                {
                    gRequest.Referer = "https://www.pinterest.com/";
                }
                if (url.Contains("https://in."))
                {
                    gRequest.Host = "in.pinterest.com";
                }
                else
                {
                    gRequest.Host ="www.pinterest.com";
                }
                if (url.Contains("https://in."))
                {
                    gRequest.Headers["Origin"] = "https://in.pinterest.com/";
                }
                else
                {
                    gRequest.Headers["Origin"] = "https://www.pinterest.com";
                }
                gRequest.Headers["X-File-Name"] = fileName;
                gRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36";
                gRequest.Headers["X-Requested-With"] = "XMLHttpRequest";
                gRequest.Accept = "*/*";
                // gRequest.Headers["Accept-Encoding"] = "gzip, deflate";
                gRequest.Headers["Accept-Language"] = "en-GB,en-US;q=0.8,en;q=0.6";
                foreach (Cookie item in gCookies)
                {
                    if (item.Name == "csrftoken")
                    {
                        string csrftokenValue = item.Value;

                        gRequest.Headers["X-CSRFToken"] = csrftokenValue;

                        break;
                    }
                }
                gRequest.Method = "POST";
                gRequest.KeepAlive = true;
                gRequest.Credentials = System.Net.CredentialCache.DefaultCredentials;

                ChangeProxy(proxyAddress, proxyPort, proxyUsername, proxyPassword);

                gRequest.CookieContainer = new CookieContainer(); //gCookiesContainer;

                #region CookieManagment

                if (this.gCookies != null && this.gCookies.Count > 0)
                {
                    gRequest.CookieContainer.Add(gCookies);
                }
                #endregion

                Stream rs = gRequest.GetRequestStream();


                string formdataTemplate = "Content-Disposition: form-data; name=\"{0}\"\r\n\r\n{1}";
                foreach (string key in nvc.Keys)
                {
                    rs.Write(boundarybytes, 0, boundarybytes.Length);
                    string formitem = string.Format(formdataTemplate, key, nvc[key]);
                    byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem);
                    rs.Write(formitembytes, 0, formitembytes.Length);
                }
                rs.Write(boundarybytes, 0, boundarybytes.Length);

                string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\nContent-Type: {2}\r\n\r\n";
                string header = string.Format(headerTemplate, paramName, fileName, contentType);
                byte[] headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
                rs.Write(headerbytes, 0, headerbytes.Length);

                FileStream fileStream = new FileStream(localImagePath, FileMode.Open, FileAccess.Read);
                byte[] buffer = new byte[4096];
                int bytesRead = 0;
                while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
                {
                    rs.Write(buffer, 0, bytesRead);
                }
                fileStream.Close();
                byte[] trailer = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "--\r\n");
                rs.Write(trailer, 0, trailer.Length);
                rs.Close();

                #region CookieManagment

                if (this.gCookies != null && this.gCookies.Count > 0)
                {
                    gRequest.CookieContainer.Add(gCookies);
                }

                #endregion

                WebResponse wresp = null;
                try
                {
                    wresp = gRequest.GetResponse();
                    Stream stream2 = wresp.GetResponseStream();
                    StreamReader reader2 = new StreamReader(stream2);
                    responseStr = reader2.ReadToEnd();
                    return responseStr;
                    //log.Debug(string.Format("File uploaded, server response is: {0}", reader2.ReadToEnd()));
                    //return true;
                }
                catch (Exception ex)
                {
                    //log.Error("Error uploading file", ex);
                    if (wresp != null)
                    {
                        wresp.Close();
                        wresp = null;
                    }
                    // return false;


                    Console.WriteLine("Error : " + ex.StackTrace);

                }
                finally
                {
                    gRequest = null;
                }
                return responseStr;

            }
            catch (Exception ex)
            {
                gRequest = null;
                Console.WriteLine("Error : " + ex.StackTrace);
            }
            return responseStr;
        }
Пример #17
0
        /// <summary>
        /// Sends Http Request to URL sent and also sends Request to gif URL, and 2 more URLs
        /// </summary>
        /// <param name="ConfemUrl">Facebook Confirmation URL</param>
        /// <param name="gif"></param>
        /// <param name="logpic"></param>
        public void LoginVerfyOld(string ConfemUrl, string gif, string logpic)
        {
            Globussoft.GlobusHttpHelper HttpHelper = new Globussoft.GlobusHttpHelper();

            int   intProxyPort = 80;
            Regex IdCheck      = new Regex("^[0-9]*$");

            if (!string.IsNullOrEmpty(proxyPort) && IdCheck.IsMatch(proxyPort))
            {
                intProxyPort = int.Parse(proxyPort);
            }

            string PageSourse1 = HttpHelper.getHtmlfromUrlProxy(new Uri(ConfemUrl), proxyAddress, intProxyPort, proxyUser, proxyPass);
            //string PageSourse1 = HttpHelper.getHtmlfromUrlProxy(new Uri(url), "127.0.0.1", 8888, "", "");

            string valueLSD   = "name=" + "\"lsd\"";
            string pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/login.php"));

            int    startIndex = pageSource.IndexOf(valueLSD) + 18;
            string value      = pageSource.Substring(startIndex, 5);

            //Log("Logging in with " + Username);

            string ResponseLogin = HttpHelper.postFormData(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + Username.Split('@')[0] + "%40" + Username.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "");
            /////ssss gif &s=a parse com  &s=a//////////////////////////
            string PageSourse12 = HttpHelper.getHtmlfromUrl(new Uri(ConfemUrl));
            string PageSourse13 = HttpHelper.getHtmlfromUrl(new Uri(gif));
            string PageSourse14 = HttpHelper.getHtmlfromUrl(new Uri(logpic + "&s=a"));
            string PageSourse15 = HttpHelper.getHtmlfromUrl(new Uri(logpic));

            string PageSourse16 = HttpHelper.getHtmlfromUrl(new Uri(ConfemUrl));


            string PageSourceConfirmed = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/?email_confirmed=1"));

            string pageSourceCheck = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=contact_importer"));

            //** FB Account Check email varified or not ***********************************************************************************//
            #region  FB Account Check email varified or not

            string pageSrc1 = string.Empty;
            string pageSrc2 = string.Empty;
            string pageSrc3 = string.Empty;
            string pageSrc4 = string.Empty;
            string substr1  = string.Empty;

            if (pageSourceCheck.Contains("Are your friends already on Facebook?") && pageSourceCheck.Contains("Skip this step"))
            {
                pageSrc1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=classmates_coworkers"));
            }
            if (pageSrc1.Contains("Fill out your Profile Info") && pageSrc1.Contains("Skip"))
            {
                pageSrc2 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic"));
            }
            if (pageSrc2.Contains("Set your profile picture") && pageSrc2.Contains("Skip"))
            {
                pageSrc3 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=summary"));
            }
            if (pageSrc3.Contains("complete the sign-up process"))
            {
                //LoggerWallPoste("not varified through " + Username);
            }
            if (pageSourceCheck.Contains("complete the sign-up process"))
            {
                //LoggerWallPoste("not varified through Email" + Username);
            }
            #endregion
            //** FB Account Check email varified or not ***********************************************************************************//

            string pageSourceHome = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/home.php"));

            //** User Id ***************//////////////////////////////////
            string UsreId      = string.Empty;
            string ProFilePost = string.Empty;
            ////**Post Message For User***********************/////////////////////////////////////////////////////
            int count = 0;
            if (pageSourceHome.Contains("http://www.facebook.com/profile.php?id="))
            {
                string[] arrUser = Regex.Split(pageSourceHome, "href");
                foreach (String itemUser in arrUser)
                {
                    if (!itemUser.Contains("<!DOCTYPE"))
                    {
                        if (itemUser.Contains("http://www.facebook.com/profile.php?id="))
                        {
                            string[] arrhre = itemUser.Split('"');
                            ProFilePost = arrhre[1];
                            break;
                        }
                    }
                }
            }
            if (ProFilePost.Contains("http://www.facebook.com/profile.php?id="))
            {
                UsreId = ProFilePost.Replace("http://www.facebook.com/profile.php?id=", "");
            }



            //*** User Id **************//////////////////////////////////

            //*** Post Data **************//////////////////////////////////
            string fb_dtsg = pageSourceHome.Substring(pageSourceHome.IndexOf("fb_dtsg") + 16, 8);

            string   post_form_id = pageSourceHome.Substring(pageSourceHome.IndexOf("post_form_id"), 200);
            string[] Arr          = post_form_id.Split('"');
            post_form_id = Arr[2];
            post_form_id = post_form_id.Replace("\\", "");
            post_form_id = post_form_id.Replace("\\", "");
            post_form_id = post_form_id.Replace("\\", "");
            fb_dtsg      = Arr[6];
            string Response1 = HttpHelper.postFormData(new Uri("http://www.facebook.com/desktop/notifier/transfer.php?__a=1"), "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&lsd&post_form_id_source=AsyncRequest&__user="******"http://www.facebook.com/ajax/httponly_cookies.php?dc=snc2&__a=1"), "keys[0]=1150335208&post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&lsd&post_form_id_source=AsyncRequest&__user="******"http://www.facebook.com/ajax/contextual_help.php?__a=1&set_name=welcome&__user="******"http://www.facebook.com/"));

            pageSourceCheck1111 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/"));

            if (pageSourceCheck1111.Contains("complete the sign-up process"))
            {
                Console.WriteLine("the account is not verified");
                //LoggerWallPoste("not varified through Email" + Username);
            }

            string pageSource11 = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/login.php"));

            startIndex = pageSource.IndexOf(valueLSD) + 18;
            value      = pageSource.Substring(startIndex, 5);

            //Log("Logging in with " + Username);

            string ResponseLogin11 = HttpHelper.postFormData(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + Username.Split('@')[0] + "%40" + Username.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "");

            string PageSourceConfirmed11 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/?email_confirmed=1"));

            if (PageSourceConfirmed11.Contains("complete the sign-up process"))
            {
                Console.WriteLine("the account is not verified");
                //LoggerWallPoste("not varified through Email" + Username);
            }
        }
        public List <string> GetAllBoardNames_new1(string screenName)
        {
            BaseLib.GlobusRegex         rgx        = new GlobusRegex();
            Globussoft.GlobusHttpHelper httpHelper = new Globussoft.GlobusHttpHelper();
            //GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Getting All Board Names ]");

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

            string[] data = Regex.Split(BoardPage, "is_collaborative");

            foreach (var itemdata in data)
            {
                try
                {
                    string boardUrl = Utils.Utils.getBetween(itemdata, ", \"url\":", ",").Replace("\"", "").Trim();

                    if (!lstBoardUrls.Contains(boardUrl) && !string.IsNullOrEmpty(boardUrl))
                    {
                        lstBoardUrls.Add(boardUrl);
                    }

                    if (itemdata.Contains("board_id"))
                    {
                        string boardId = Utils.Utils.getBetween(itemdata, "board_id\":", ",").Replace("\"", "").Trim();
                        if (!lstBoardId.Contains(boardId))
                        {
                            lstBoardId.Add(boardId);
                        }
                    }
                }
                catch (Exception ex)
                {
                    GlobusLogHelper.log.Error("Error :" + ex.StackTrace);
                }
            }

            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("boardName"))
                                {
                                    string BoardUrl   = string.Empty;
                                    int    startIndex = Dataitem.IndexOf("title");
                                    int    LastPoint  = Dataitem.IndexOf("<h2");
                                    string Board      = Dataitem.Substring(startIndex, LastPoint).Replace("\\n", string.Empty).Replace("\"", "").Replace("<div class=\\b", string.Empty).Replace("  ", string.Empty).Replace("\"title\"", "").Replace("</div", "");
                                    BoardUrl = rgx.StripTagsRegex(Board);
                                    try
                                    {
                                        Board = Utils.Utils.getBetween(BoardUrl, ">>", "<");
                                        //modified done
                                        if (Board == "")
                                        {
                                            Board = Utils.Utils.getBetween(BoardUrl, "title=", ">").Replace("\\", "").Trim();
                                        }
                                    }
                                    catch (Exception ex)
                                    { };
                                    if (!BoardNames.Contains(Board))
                                    {
                                        BoardNames.Add(Board);
                                        //DropDowenBox.Items.Add(Board);
                                    }
                                }
                            }
                        }
                        counter++;
                    }
                }
                catch (Exception ex)
                {
                    GlobusLogHelper.log.Error("Error :" + ex.StackTrace);
                }
            }

            return(BoardNames);
        }
Пример #19
0
        public static bool GetStatusLinks(string username)
        {
            int counter = 0;
            Globussoft.GlobusHttpHelper httpHelper = new Globussoft.GlobusHttpHelper();
            string user_id = string.Empty;
            bool tooManyLinks = true;
            try
            {
                string text = string.Empty;
                string PageSource = string.Empty;
                //http://a0.twimg.com/sticky/default_profile_images/default_profile_0_normal.png
                if (!string.IsNullOrEmpty(username) && NumberHelper.ValidateNumber(username))
                {
                    PageSource = httpHelper.getHtmlfromUrl(new Uri("https://api.twitter.com/1/statuses/user_timeline.xml?include_entities=true&inc%E2%80%8C%E2%80%8Blude_rts=true&include_rts=1&user_id=" + username + "&count=" + noOfstatus), "", "");
                }
                else
                {
                    PageSource = httpHelper.getHtmlfromUrl(new Uri("https://api.twitter.com/1/statuses/user_timeline.xml?include_entities=true&inc%E2%80%8C%E2%80%8Blude_rts=true&include_rts=1&screen_name=" + username + "&count=" + noOfstatus), "", "");
                }

                if (!string.IsNullOrEmpty(PageSource) && PageSource.Contains("Sorry, that page does not exist"))      //https://api.twitter.com/1/statuses/user_timeline.xml?include_entities=true&inc%E2%80%8C%E2%80%8Blude_rts=true&include_rts=1&screen_name=vikas&count=20" + username + "&count=" + noOfstatus), "", ""
                {
                    return tooManyLinks;
                }

                if (!string.IsNullOrEmpty(PageSource))
                {
                    string[] statusArray = Regex.Split(PageSource, "<status>");
                    statusArray = statusArray.Skip(1).ToArray();


                    foreach (string Status in statusArray)
                    {
                        try
                        {
                            int indexStart = Status.IndexOf("<text>");
                            if (Status.Contains("<profile_image_url>"))
                            {
                                string start = Status.Substring(indexStart);
                                int endIndex = start.IndexOf("</text>");
                                string end = start.Substring(0, endIndex);
                                text = end.Replace("<text>", "");
                            }

                            List<string> GetHrefs = GlobusRegex.GetHrefsFromString(text);

                            if (GetHrefs.Count >= 1)
                            {
                                counter++;
                            }

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

                    //FollowingsFollowersRatio_user_id = (count_Followings_user_id * 100) / count_Followers_user_id;
                    int PerLinks = (counter * 100) / 20;
                    //double PerLinks = a * 100;

                    if (PerLinks > Percentage)
                    {
                        tooManyLinks = false;
                    }
                }
                else
                {
                    tooManyLinks = false;
                }

            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetStatusLinks() -- " + username + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetStatusLinks() -- " + username + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
            }
            return tooManyLinks;
        }
Пример #20
0
        /// <summary>
        /// Returns Captcha Image from Facebook
        /// </summary>
        /// <param name="responseMessage"></param>
        /// <returns></returns>
        public string GetCaptchaImage(ref string responseMessage)
        {
            int intProxyPort = 80;
            Regex IdCheck = new Regex("^[0-9]*$");

            if (!string.IsNullOrEmpty(_proxyPort) && IdCheck.IsMatch(_proxyPort))
            {
                intProxyPort = int.Parse(_proxyPort);
            }

            AddToListBox("Fetching Captcha");
            LogFacebookCreator("Fetching Captcha");
            HttpHelper = new GlobusHttpHelper();  //Create new instance
            string pageSource = HttpHelper.getHtmlfromUrlProxy(new Uri("http://www.facebook.com/"), _proxyAddress, intProxyPort, _proxyUsername, _proxyPassword);


            #region CSS, JS, & Pixel requests to avoid Socket Detection
            ////**** update by ritesh 20-9-11  *****/////////////////////////////////
            #region Commented, done in next line
            ////CSS Request
            //foreach (string item in GetHrefsFromString(pageSource))
            //{
            //    if (item.Contains(".css"))
            //    {
            //        string cssSource = item.Replace(" ", "").Trim();
            //        try
            //        {
            //            string res = HttpHelper.getHtmlfromUrl(new Uri(cssSource));
            //        }
            //        catch (Exception)
            //        {
            //        }
            //    }
            //}

            ////JS Request
            //string[] scriptArr = Regex.Split(pageSource, "/script>");
            //foreach (string item in scriptArr)
            //{
            //    if (item.Contains("http://static.ak.fbcdn.net"))
            //    {
            //        int startIndx = item.LastIndexOf("src=") + "src=".Length + 1;
            //        int endIndx = item.IndexOf(">", startIndx) - 1;
            //        string jsSource = item.Substring(startIndx, endIndx - startIndx);
            //        if (jsSource.StartsWith("http://static.ak.fbcdn.net"))
            //        {
            //            try
            //            {
            //                string res = HttpHelper.getHtmlfromUrl(new Uri(jsSource));
            //            }
            //            catch (Exception)
            //            {
            //            }
            //        }
            //    }
            //} 
            #endregion

            ///JS, CSS, Image Requests
            //RequestJSCSSIMG(pageSource, ref HttpHelper);
            RequestsJSCSSIMG.RequestJSCSSIMG(pageSource, ref HttpHelper);


            try
            {
                string req1 = HttpHelper.getHtmlfromUrl(new Uri("http://static.ak.fbcdn.net/rsrc.php/v1/yC/r/6n91uRFZJAi.js"));
            }
            catch (Exception)
            {
            }
            try
            {
                string req2 = HttpHelper.getHtmlfromUrl(new Uri("http://static.ak.fbcdn.net/rsrc.php/v1/yd/r/dpT-tcRYFZy.js"));
            }
            catch (Exception)
            {
            }

            ///Pixel request
            string reg_instanceValue = GetParamValue(pageSource, "reg_instance");
            //string asyncSignal = RandomNumberGenerator.GenerateRandom(3000, 4000).ToString();
            string asyncSignal = string.Empty;
            try
            {
                asyncSignal = RandomNumberGenerator.GenerateRandom(3000, 8000).ToString();
            }
            catch (Exception)
            {
                
               
            }
            string pixel = HttpHelper.getHtmlfromUrl(new Uri("http://pixel.facebook.com/ajax/register/logging.php?action=form_focus&reg_instance=" + reg_instanceValue + "&asyncSignal=" + asyncSignal + "&__user=0")); 
            #endregion

            

            //Delay after loading Sign Up
            //Thread.Sleep(12000);

            //string Response1 = HttpHelper.postFormDataProxy(new Uri("http://ocsp.digicert.com/"), "", proxyAddress, intProxyPort, proxyUsername, proxyPassword);

            //string Response12 = HttpHelper.postFormDataProxy(new Uri("http://ocsp.digicert.com/"), "", proxyAddress, intProxyPort, proxyUsername, proxyPassword);

            //string pageSource12 = HttpHelper.getHtmlfromUrlProxy(new Uri("http://static.ak.fbcdn.net/rsrc.php/v1/yS/r/STeWPW2kh0m.png"), proxyAddress, intProxyPort, proxyUsername, proxyPassword);

            //**** update by ritesh 20-9-11  *****/////////////////////////////////

            //*** For post_form_id ********////////////////////////////////////////////////
            AddToListBox("searching the captcha data" + _Email);
            if (pageSource.Contains("post_form_id"))
            {
                string post_id = pageSource.Substring(pageSource.IndexOf("post_form_id"), 200);
                string[] Arr1 = post_id.Split('"');
                post_form_id = Arr1[2];
            }
            if (pageSource.Contains("lsd"))
            {
                string lsd_val = pageSource.Substring(pageSource.IndexOf("lsd"), 100);
                string[] Arr_lsd = lsd_val.Split('"');
                lsd = Arr_lsd[2];
            }
            if (pageSource.Contains("reg_instance"))
            {
                string reg_instance_val = pageSource.Substring(pageSource.IndexOf("reg_instance"), 200);
                string[] Arr_reg = reg_instance_val.Split('"');
                reg_instance = Arr_reg[4];
            }
            firstname = FirstName.Replace(" ", "%20");
            lastname = LastName.Replace(" ", "%20");
            reg_email__ = _Email.Replace("@", "%40");
            reg_email_confirmation__ = _Email.Replace("@", "%40");
            reg_passwd__ = _Password.Replace("@", "%40");
            sex = SexSelect;
            birthday_month = RandomNumberGenerator.GenerateRandom(1, 12).ToString();
            birthday_day = RandomNumberGenerator.GenerateRandom(1, 28).ToString();
            birthday_year = RandomNumberGenerator.GenerateRandom(1980, 1990).ToString();


            if (pageSource.Contains("captcha_persist_data"))
            {
                string captcha_persist_data_val = pageSource.Substring(pageSource.IndexOf("captcha_persist_data"), 500);
                string[] Arr_captcha_persist_data_val = captcha_persist_data_val.Split('"');
                captcha_persist_data = Arr_captcha_persist_data_val[4];
            }
            if (pageSource.Contains("captcha_session"))
            {
                string captcha_session_val = pageSource.Substring(pageSource.IndexOf("captcha_session"), 200);
                string[] Arr_captcha_session_val = captcha_session_val.Split('"');
                captcha_session = Arr_captcha_session_val[4];
            }
            if (pageSource.Contains("extra_challenge_params"))
            {
                string extra_challenge_params_val = pageSource.Substring(pageSource.IndexOf("extra_challenge_params"), 500);
                string[] Arr_extra_challenge_params_val = extra_challenge_params_val.Split('"');
                authp_pisg_nonce_tt = Arr_extra_challenge_params_val[4];
                extra_challenge_params = Arr_extra_challenge_params_val[4];
                extra_challenge_params = extra_challenge_params.Replace("=", "%3D");
                extra_challenge_params = extra_challenge_params.Replace("&amp;", "%26");
            }

            //AddToListBox("get the first url" + Email);

            ///Delay after filling info
            int delay = 0;
            try
            {
                delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay)*1000;
                if (delay < 4000)
                {
                    delay = RandomNumberGenerator.GenerateRandom(8000, 12000);
                }
            }
            catch (Exception)
            {
            }

            AddToListBox("Delaying for " + delay/1000 + " seconds");
            Thread.Sleep(delay);

            ////////////////////////////////*****Gets Captcha URL****////////////////////////////////////////////////
            string pageSourceCaptcha = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/ajax/register.php?__a=3&post_form_id=" + post_form_id + "&lsd=" + lsd + "&reg_instance=" + reg_instance + "&locale=en_US&terms=on&abtest_registration_group=1&referrer=&md5pass=&validate_mx_records=1&ab_test_data=&firstname=" + firstname + "&lastname=" + lastname + "&reg_email__=" + reg_email__ + "&reg_email_confirmation__=" + reg_email_confirmation__ + "&reg_passwd__=" + reg_passwd__ + "&sex=" + sex + "&birthday_month=" + birthday_month + "&birthday_day=" + birthday_day + "&birthday_year=" + birthday_year + "&captcha_persist_data=" + captcha_persist_data + "&captcha_session=" + captcha_session + "&extra_challenge_params=" + extra_challenge_params + "&recaptcha_type=password&captcha_response=&ignore=captcha%7Cpc&__user=0"));

            //JS, CSS, Image Requests
            RequestsJSCSSIMG.RequestJSCSSIMG(pageSourceCaptcha, ref HttpHelper);

            if (!pageSourceCaptcha.Contains("There is an existing account associated with this email"))
            {
               
                if (pageSource.Contains("RegUtil.recaptcha_public_key"))
                {
                    string recaptcha_public_key_val = pageSource.Substring(pageSource.IndexOf("RegUtil.recaptcha_public_key"), 200);
                    string[] Arr_recaptcha_public_key = recaptcha_public_key_val.Split('"');
                    recaptcha_public_key = Arr_recaptcha_public_key[1];
                }
                if (authp_pisg_nonce_tt != null)
                {
                    string[] ArrpisgTemp = authp_pisg_nonce_tt.Split('=');
                    authp = ArrpisgTemp[1];
                    authp = authp.Replace("&amp;psig", "");
                    psig = ArrpisgTemp[2];
                    psig = psig.Replace("&amp;nonce", "");
                    nonce = ArrpisgTemp[3];
                    nonce = nonce.Replace("&amp;tt", "");
                    tt = ArrpisgTemp[4];
                    tt = tt.Replace("&amp;time", "");
                    time = ArrpisgTemp[5];
                    time = time.Substring(0, 10); 
                }

                AddToListBox("loading captcha" + _Email);

                string pageSourceCaptcha1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.google.com/recaptcha/api/challenge?k=" + recaptcha_public_key + "&ajax=1&xcachestop=0.4159115800857506&authp=" + authp + "&psig=" + psig + "&nonce=" + nonce + "&tt=" + tt + "&time=" + time + "&new_audio_default=1"));

                ////JS, CSS, Image Requests
                //RequestsJSCSSIMG.RequestJSCSSIMG(pageSourceCaptcha1, ref HttpHelper);

                // string challenge = string.Empty;
                if (pageSourceCaptcha1.Contains("challenge"))
                {

                    string challenge_val = pageSourceCaptcha1.Substring(pageSourceCaptcha1.IndexOf("challenge"), 300);
                    string[] Arr_challenge = challenge_val.Split('\'');
                    challenge = Arr_challenge[1];
                }

                return "http://www.google.com/recaptcha/api/image?c=" + challenge;
                //string pageSourceCaptcha2 = HttpHelper.getHtmlfromUrlImage(new Uri("http://www.google.com/recaptcha/api/image?c=" + challenge)); 
            }
            else
            {
                responseMessage = "There is an existing account with " + _Email;
                AddToListBox("There is an existing account with " + _Email);
                return null;
            }
        }
Пример #21
0
        public List<string> GetFollowYourFollowers(string userID, string Screen_name, out string ReturnStatus, Globussoft.GlobusHttpHelper Ghelper)
        {

            string cursor = "-1";
            string FollowingUrl = string.Empty;
            List<string> lstIds = new List<string>();
            string data_max_position = string.Empty;
            try
            {

                Globussoft.GlobusHttpHelper HttpHelper = new Globussoft.GlobusHttpHelper();
                HttpHelper = Ghelper;

            StartAgain:
                if (NumberHelper.ValidateNumber(userID))
                {
                    string UserPageUrl = string.Empty;
                    if (cursor == "-1")
                    {
                        //UserPageUrl = "https://twitter.com/account/redirect_by_id?id=" + userID;
                        UserPageUrl = "https://twitter.com/" + Screen_name;
                    }
                    else
                    {
                        //UserPageUrl = "https://twitter.com/" + Screen_name + "/followers/users?cursor=" + cursor + "&cursor_index=&cursor_offset=&include_available_features=1&include_entities=1&is_forward=true";

                        UserPageUrl = "https://twitter.com/" + Screen_name + "/followers/users?include_available_features=1&include_entities=1&max_position=" + data_max_position;
                    }
                    //FollowingUrl = "https://api.twitter.com/1/followers/ids.json?cursor=" + cursor + "&id=" + userID + "";//"https://api.twitter.com/1/friends/ids.json?cursor=-1&screen_name=SocioPro";
                    string GetUSerPage = HttpHelper.getHtmlfromUrl(new Uri(UserPageUrl), "", "");

                    FollowingUrl = HttpHelper.gResponse.ResponseUri + "/followers";

                }
                else
                {
                   //FollowingUrl = "https://twitter.com/" + userID + "/followers";
                    FollowingUrl = "https://twitter.com/" + Screen_name + "/followers";
                }

                String DataCursor = string.Empty;


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

                String DataCursor1 = string.Empty;

                if (!Data.Contains("Rate limit exceeded") && !Data.Contains("{\"errors\":[{\"message\":\"Sorry, that page does not exist\",\"code\":34}]}") && !string.IsNullOrEmpty(Data))
                {
                    String[] DataDivArr = System.Text.RegularExpressions.Regex.Split(Data, "user-actions btn-group not-following not-muting can-dm  ");
                    if (DataDivArr.Count() == 1)
                    {
                        DataDivArr = System.Text.RegularExpressions.Regex.Split(Data, "user-actions btn-group not-following not-muting can-dm ");
                    }

                   
                    foreach (var DataDivArr_item in DataDivArr)
                    {
                        if (DataDivArr_item.Contains("data-cursor"))
                        {
                            String DataCurso = System.Text.RegularExpressions.Regex.Split(Data, "data-cursor")[1];
                            DataCursor1 = DataCurso.Substring(DataCurso.IndexOf("="), DataCurso.IndexOf(">")).Replace(">", string.Empty).Replace("\n", string.Empty).Replace("\"", string.Empty).Replace("=", string.Empty).Trim();
                        }
                        //if (DataDivArr_item.Contains("<!DOCTYPE html>") || DataDivArr_item.Contains("cursor"))
                        //{
                        //    continue;
                        //}
                        if (DataDivArr_item.Contains("<!DOCTYPE html>"))
                        {
                            continue;
                        }

                        if (DataDivArr_item.Contains("data-screen-name") && DataDivArr_item.Contains(" data-user-id"))
                        {
                            int endIndex = 0;
                            int startIndex = DataDivArr_item.IndexOf(" data-user-id");
                            try
                            {
                                endIndex = DataDivArr_item.IndexOf(">");
                            }
                            catch { }

                            if (endIndex == -1)
                            {
                                endIndex = DataDivArr_item.IndexOf("data-feedback-token");
                            }
                            if (endIndex == -1)
                            {
                                endIndex = DataDivArr_item.IndexOf(" data-protected=\\\"false");
                            }

                            try
                            {
                                string GetDataStr = DataDivArr_item.Substring(startIndex, endIndex);


                                string _SCRNameID = (GetDataStr.Substring(GetDataStr.IndexOf("data-user-id"), GetDataStr.IndexOf("data-screen-name", GetDataStr.IndexOf("data-user-id")) - GetDataStr.IndexOf("data-user-id")).Replace("data-user-id", string.Empty).Replace("=", string.Empty).Replace("\"", "").Replace("\\\\n", string.Empty).Replace("data-screen-name=", string.Empty).Replace("\\", "").Trim());
                                string _SCRName = (GetDataStr.Substring(GetDataStr.IndexOf("data-screen-name="), GetDataStr.IndexOf("data-name", GetDataStr.IndexOf("data-screen-name=")) - GetDataStr.IndexOf("data-screen-name=")).Replace("data-screen-name=", string.Empty).Replace("=", string.Empty).Replace("\"", "").Replace("\\\\n", string.Empty).Replace("data-screen-name=", string.Empty).Replace("\\", "").Trim());
                          
                                //string _SCRNameID = System.Text.RegularExpressions.Regex.Split(GetDataStr, "data-screen-name")[0].Replace("data-user-id=", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Replace("n", "").Trim();
                                //string _SCRName = (GetDataStr.Substring(GetDataStr.IndexOf("data-screen-name"), GetDataStr.IndexOf("data-name=", GetDataStr.IndexOf("data-screen-name")) - GetDataStr.IndexOf("data-screen-name")).Replace("data-screen-name", string.Empty).Replace("\\\"", string.Empty).Replace("\"", string.Empty).Replace(",", "").Replace("=", "").Trim());

                                if (TweetAccountManager.noOfUnfollows > lstIds.Count)
                                {
                                    //lstIds.Add(_SCRName + ":" + _SCRNameID);
                                    lstIds.Add(_SCRName);
                                }
                            }
                            catch { }

                        }

                    }


                    if (TweetAccountManager.noOfUnfollows != lstIds.Count)
                    {

                        #region Old Cursor Commented Code
                        //if (Data.Contains("data-cursor"))
                        //{
                        //    int startindex = Data.IndexOf("data-cursor");
                        //    string start = Data.Substring(startindex).Replace("data-cursor", "");
                        //    int lastindex = start.IndexOf("<div class=\"stream profile-stream\">");
                        //    if (lastindex == -1)
                        //    {
                        //        lastindex = start.IndexOf("\n");
                        //    }
                        //    string end = start.Substring(0, lastindex).Replace("\"", "").Replace("\n", string.Empty).Replace("=", string.Empty).Replace(">", string.Empty).Trim();
                        //    cursor = end;
                        //    if (cursor != "0")
                        //    {


                        //        goto StartAgain;
                        //    }
                        //}

                        //if (Data.Contains("cursor"))
                        //{
                        //    int startindex = Data.IndexOf("cursor");
                        //    string start = Data.Substring(startindex).Replace("cursor", "");
                        //    int lastindex = start.IndexOf(",");
                        //    if (lastindex > 40)
                        //    {
                        //         lastindex = start.IndexOf("\n");
                        //    }
                        //    string end = start.Substring(0, lastindex).Replace("\"", "").Replace("\n", string.Empty).Replace("=", string.Empty).Replace(":", string.Empty).Trim();
                        //    cursor = end;
                        //    if (cursor != "0")
                        //    {
                        //        goto StartAgain;
                        //    }
                        //}
                        #endregion
                        data_max_position = Utils.getBetween(Data, "data-max-position=\"", "\"");
                        if (string.IsNullOrEmpty(data_max_position))
                        {
                            data_max_position = Utils.getBetween(Data, "data-min-position=\"", "\"");
                        }
                        if (!string.IsNullOrEmpty(data_max_position))
                        {
                            cursor = "1";
                            goto StartAgain;
                        }

                    }
                    //FollowingUrl = "https://twitter.com/Iloveindia6SihF/followers/users?cursor=" + DataCursor1 + "&cursor_index=&cursor_offset=&include_available_features=1&include_entities=1&is_forward=true";
                    //FollowingUrl = "https://twitter.com/Fergie/followers/users?cursor=" + DataCursor1 + "&include_available_features=1&include_entities=1&is_forward=true";

                    ReturnStatus = "No Error";
                    return lstIds;
                }
                else if (Data.Contains("401 Unauthorized"))
                {
                    ReturnStatus = "Account is Suspended. ";
                    return new List<string>();
                }
                else if (Data.Contains("{\"errors\":[{\"message\":\"Sorry, that page does not exist\",\"code\":34}]}"))
                {
                    ReturnStatus = "Sorry, that page does not exist :" + userID;
                    return lstIds;
                }
                else if (Data.Contains("Rate limit exceeded. Clients may not make more than 150 requests per hour."))
                {
                    ReturnStatus = "Rate limit exceeded. Clients may not make more than 150 requests per hour.:-" + userID;
                    return lstIds;
                }
                else
                {
                    ReturnStatus = "Error";
                    return lstIds;
                }
            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetFollowers1() -- " + userID + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetFollowers1() -- " + userID + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
                ReturnStatus = "Error";
                return lstIds;
            }
        }
        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;
        }
Пример #23
0
        public List<string> GetHashTags_New(out string returnStatus)
        {
            List<string> HashTags = new List<string>();
            string authenticityToken = string.Empty;
            string Woeid = string.Empty;
            List<string> lstWoeid = new List<string>();
            Dictionary<string, string> dicRemoveDuplicate = new Dictionary<string, string>();
           
            try
            {
                //string pagesource = globushttpHelper.getHtmlfromUrl(new Uri("https://api.twitter.com/1/trends/daily.json"), "", "");
                Globussoft.GlobusHttpHelper HttpHelper = new Globussoft.GlobusHttpHelper();
                string twtPage = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/"), "", "");

                try
                {
                    int startindex = twtPage.IndexOf("name=\"authenticity_token\"");
                    string start = twtPage.Substring(startindex).Replace("name=\"authenticity_token\"", "");
                    int endindex = start.IndexOf("\">");
                    string end = start.Substring(0, endindex).Replace("value=\"", "");
                    authenticityToken = end.Trim();
                }
                catch (Exception ex)
                {
                    Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetHashTags_New() -- authenticityToken --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                    Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetHashTags_New() -- authenticityToken --> " + ex.Message, Globals.Path_TwtErrorLogs);
                }


                string pagesource = HttpHelper.postFormData(new Uri("https://twitter.com/trends/dialog"), "authenticity_token=" + authenticityToken + "&pc=true&woeid=0", "https://twitter.com/", "", "", "", "");

                string[] arrayDataWoied = Regex.Split(pagesource, "data-woeid");
                arrayDataWoied = arrayDataWoied.Skip(1).ToArray();
                foreach (string item in arrayDataWoied)
                {

                    try
                    {
                        int startindex = item.IndexOf("=\\\"");
                        string start = item.Substring(startindex).Replace("=\\\"", "");
                        int endindex = start.IndexOf("\\\"");
                        string end = start.Substring(0, endindex).Replace("value=\"", "");
                        Woeid = end;
                        lstWoeid.Add(Woeid);
                        lstWoeid = lstWoeid.Distinct().ToList();
                    }
                    catch (Exception ex)
                    {
                        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetHashTags_New() -- Woeid --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetHashTags_New() -- Woeid --> " + ex.Message, Globals.Path_TwtErrorLogs);
                    }
                }

                foreach (string tempWoeid in lstWoeid)
                {
                    string HastagString = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/trends?k=" + tempWoeid + "&pc=true&personalized=false&src=module&woeid=" + tempWoeid + ""), "https://twitter.com/", "");
                    //string HastagString = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/trends?k=" + tempWoeid + "&pc=true&src=module"), "https://twitter.com/", "");
                    string[] datatrendname = Regex.Split(HastagString, "data-trend-name=");
                    datatrendname = datatrendname.Skip(1).ToArray();

                    foreach (string trend in datatrendname)
                    {
                        try
                        {
                            if (!trend.Contains("#\\"))
                            {
                                int startindex = trend.IndexOf("\\\"");
                                string start = trend.Substring(startindex).Replace("\\\"", "");
                                int endindex = start.IndexOf("\\");
                                string end = start.Substring(0, endindex).Replace("value=\"", "").Replace("\\\"", "");
                                if (!string.IsNullOrEmpty(end))
                                {
                                    try
                                    {
                                        dicRemoveDuplicate.Add(end, end);
                                        HashTags.Add(end);
                                        Log("[ " + DateTime.Now + " ] => [ " + end + " ]");
                                    }
                                    catch (Exception)
                                    {
                                    }
                                   
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetHashTags_New() -- Woeid --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                            Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetHashTags_New() -- Woeid --> " + ex.Message, Globals.Path_TwtErrorLogs);
                        }
                    }
                }


                #region Old Code
                //pagesource = HttpHelper.postFormData(new Uri("https://twitter.com/trends/dialog"), "authenticity_token=" + authenticityToken + "&pc=true&woeid=" + Woeid, "https://twitter.com/", "", "", "", "");

                //string[] datatrendname = Regex.Split(pagesource, "data-woeid=");
                //datatrendname = datatrendname.Skip(2).ToArray();

                //foreach (string trend in datatrendname)
                //{
                //    try
                //    {
                //        int startindex = trend.IndexOf("\\\"");
                //        string start = trend.Substring(startindex).Replace("\\\"", "");
                //        int endindex = start.IndexOf("\\");
                //        string end = start.Substring(0, endindex).Replace("value=\"", "").Replace("\\\"", "");

                //        String datawoeid = end;

                //        //https://twitter.com/trends?k=23424848&pc=true&personalized=false&src=module&woeid=23424848

                //        string HastagString = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/trends?k=" + Woeid + "&pc=true&personalized=false&src=module&woeid=" + Woeid + ""), "https://twitter.com/", "");

                //        if (!string.IsNullOrEmpty(end))
                //        {
                //            HashTags.Add(end);
                //            Log(end);
                //        }
                //    }
                //    catch (Exception ex)
                //    {
                //        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetHashTags_New() -- Woeid --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                //        Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetHashTags_New() -- Woeid --> " + ex.Message, Globals.Path_TwtErrorLogs);
                //    }
                //}

                #endregion

                //}
                returnStatus = "No Error";
                return HashTags;
            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetHashTags_New() --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetHashTags_New() --> " + ex.Message, Globals.Path_TwtErrorLogs);
                returnStatus = "Error";
                return HashTags;
            }
        }
Пример #24
0
        public List<string> GetAllBoardNames_new1(string screenName,ref PinInterestUser objPinUser)
        {
            BaseLib.GlobusRegex rgx = new GlobusRegex();         
            Globussoft.GlobusHttpHelper httpHelper = new Globussoft.GlobusHttpHelper();
            List<string> lstBoardIdNew = new List<string>();
            //GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Getting All Board Names ]");

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

            string[] data = Regex.Split(BoardPage, "is_collaborative");

            foreach (var itemdata in data)
            {
                try
                {
                    string boardUrl = getBetween(itemdata, ", \"url\":", ",").Replace("\"", "").Trim();

                    if (!lstBoardUrls.Contains(boardUrl) && !string.IsNullOrEmpty(boardUrl))
                    {
                        lstBoardUrls.Add(boardUrl);
                    }

                    if (itemdata.Contains("board_id"))
                    {
                        string boardId = getBetween(itemdata, "board_id\":", ",").Replace("\"", "").Trim();
                        if (!lstBoardIdNew.Contains(boardId))
                        {
                            lstBoardIdNew.Add(boardId);                                                      
                        }
                        objPinUser.lstBoardId = lstBoardIdNew;
                    }
                }
                catch (Exception ex)
                {
                    GlobusLogHelper.log.Error("Error :" + ex.StackTrace);
                }
            }

            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("boardName"))
                                {                                  
                                    string BoardUrl = string.Empty;
                                    int startIndex = Dataitem.IndexOf("title");
                                    int LastPoint = Dataitem.IndexOf("<h2");
                                    //string Board = Dataitem.Substring(startIndex, LastPoint).Replace("\\n", string.Empty).Replace("\"", "").Replace("<div class=\\b", string.Empty).Replace("  ", string.Empty).Replace("\"title\"", "").Replace("</div", "");
                                    string Board = Utils.Utils.getBetween(Dataitem, "<h2 class=\\\"title\\\">", "</h2>");
                                    //BoardUrl = rgx.StripTagsRegex(Board);
                                    //try
                                    //{                                      
                                    //    Board = getBetween(BoardUrl, ">>", "<");
                                    //    //modified done
                                    //    if (Board == "")
                                    //    {
                                    //        Board = getBetween(BoardUrl, "title=", ">").Replace("\\", "").Trim();
                                    //    }
                                    //}
                                    //catch(Exception ex)
                                    //{ };
                                    if (!BoardNames.Contains(Board))
                                    {
                                        BoardNames.Add(Board);
                                        //DropDowenBox.Items.Add(Board);

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

            return BoardNames;
        }
Пример #25
0
        public List<string> GetMembers(string keyword,out string ReturnStatus)
        {
            string cursor = "-1";
            string FollowingUrl = string.Empty;
            List<string> lstIds = new List<string>();
            string userID;
            string Screen_name;
            int counter = 0;
            try
            {

                Globussoft.GlobusHttpHelper HttpHelper = new Globussoft.GlobusHttpHelper();
                
            StartAgain:
                if (counter == 0)
                {
                    FollowingUrl = keyword;
                    counter++;
                }
                else
                {
                    FollowingUrl = keyword + "/timeline?cursor=" + cursor + "&cursor_index=&cursor_offset=&include_available_features=1&include_entities=1&is_forward=true";
                }


                String DataCursor = string.Empty;


                string Data = HttpHelper.getHtmlfromUrl(new Uri(FollowingUrl), "", "");
                if (string.IsNullOrEmpty(Data))
                {
                    Data = HttpHelper.getHtmlfromUrl(new Uri(FollowingUrl), "", "");
                }

                if (string.IsNullOrEmpty(Data))
                {
                    AddToLog_ScrapMember("Either Url in Invalid or PageSource is getting Null or Empty.");

                    ReturnStatus = "Error";
                    return lstIds;
                }
                String DataCursor1 = string.Empty;

                if (!Data.Contains("Rate limit exceeded") && !Data.Contains("{\"errors\":[{\"message\":\"Sorry, that page does not exist\",\"code\":34}]}") && !string.IsNullOrEmpty(Data))
                {

                    String[] DataDivArr;
                    if (Data.Contains("js-stream-item stream-item stream-item"))
                    {
                        DataDivArr = Regex.Split(Data, "js-stream-item stream-item stream-item");
                    }
                    else
                    {
                        DataDivArr = Regex.Split(Data, "js-stream-item");
                    }

                    foreach (var DataDivArr_item in DataDivArr)
                    {
                        if (DataDivArr_item.Contains("data-cursor"))
                        {
                            String DataCurso = System.Text.RegularExpressions.Regex.Split(Data, "data-cursor")[1];
                            DataCursor1 = DataCurso.Substring(DataCurso.IndexOf("="), DataCurso.IndexOf(">")).Replace(">", string.Empty).Replace("\n", string.Empty).Replace("\"", string.Empty).Replace("=", string.Empty).Trim();
                        }
                        if (DataDivArr_item.Contains("<!DOCTYPE html>") || DataDivArr_item.Contains("cursor"))
                        {
                            continue;
                        }

                        if (DataDivArr_item.Contains("data-screen-name") && DataDivArr_item.Contains(" data-user-id"))
                        {
                            int endIndex = 0;
                            int startIndex = DataDivArr_item.IndexOf("data-screen-name");
                            try
                            {
                                endIndex = DataDivArr_item.IndexOf(">");
                            }
                            catch { }

                            if (endIndex == -1)
                            {
                                endIndex = DataDivArr_item.IndexOf("data-feedback-token");
                            }

                            string GetDataStr = DataDivArr_item.Substring(startIndex, endIndex);

                            string _SCRNameID = (GetDataStr.Substring(GetDataStr.IndexOf("data-user-id"), GetDataStr.IndexOf("data-feedback-token", GetDataStr.IndexOf("data-user-id")) - GetDataStr.IndexOf("data-user-id")).Replace("data-user-id", string.Empty).Replace("=", string.Empty).Replace("\"", "").Replace("\\\\n", string.Empty).Replace("data-screen-name=", string.Empty).Replace("\\", "").Trim());
                            string _SCRName = (GetDataStr.Substring(GetDataStr.IndexOf("data-screen-name="), GetDataStr.IndexOf("data-user-id", GetDataStr.IndexOf("data-screen-name=")) - GetDataStr.IndexOf("data-screen-name=")).Replace("data-screen-name=", string.Empty).Replace("=", string.Empty).Replace("\"", "").Replace("\\\\n", string.Empty).Replace("data-screen-name=", string.Empty).Replace("\\", "").Trim());

                            if (noOfRecords > lstIds.Count)
                            {
                                lstIds.Add(_SCRName + ":" + _SCRNameID);
                                AddToLog_ScrapMember("[ " + DateTime.Now + " ] => [" + _SCRNameID + " :: "+_SCRName+" ]");
                                if (!File.Exists(Globals.Path_ScrapedMembersList))
                                {
                                    GlobusFileHelper.AppendStringToTextfileNewLine("UserID , UserName , Url", Globals.Path_ScrapedMembersList);
                                }
                                GlobusFileHelper.AppendStringToTextfileNewLine(_SCRNameID + "," + _SCRName + "," + keyword, Globals.Path_ScrapedMembersList);

                            }
                            

                        }

                    }


                    if (noOfRecords != lstIds.Count)
                    {


                        if (Data.Contains("data-cursor"))
                        {
                            int startindex = Data.IndexOf("data-cursor");
                            string start = Data.Substring(startindex).Replace("data-cursor", "");
                            int lastindex = start.IndexOf("<div class=\"stream profile-stream\">");
                            if (lastindex == -1)
                            {
                                lastindex = start.IndexOf("\n");
                            }
                            string end = start.Substring(0, lastindex).Replace("\"", "").Replace("\n", string.Empty).Replace("=", string.Empty).Replace(">", string.Empty).Trim();
                            cursor = end;


                            if (cursor != "0")
                            {


                                goto StartAgain;
                            }
                        }

                        if (Data.Contains("cursor"))
                        {
                            int startindex = Data.IndexOf("cursor");
                            string start = Data.Substring(startindex).Replace("cursor", "");
                            int lastindex = -1;

                            lastindex = start.IndexOf(",");
                            if (lastindex > 40)
                            {
                                lastindex = start.IndexOf("\n");

                            }
                            string end = start.Substring(0, lastindex).Replace("\"", "").Replace("\n", string.Empty).Replace("=", string.Empty).Replace(":", string.Empty).Trim();
                            cursor = end;
                            if (cursor != "0")
                            {
                                goto StartAgain;
                            }
                        }

                    }
                  
                    ReturnStatus = "No Error";
                    return lstIds;
                }
                else if (Data.Contains("401 Unauthorized"))
                {
                    ReturnStatus = "Account is Suspended. ";
                    return new List<string>();
                }
                else if (Data.Contains("{\"errors\":[{\"message\":\"Sorry, that page does not exist\",\"code\":34}]}"))
                {
                    ReturnStatus = "Sorry, that page does not exist :";
                    return lstIds;
                }
                else if (Data.Contains("Rate limit exceeded. Clients may not make more than 150 requests per hour."))
                {
                    ReturnStatus = "Rate limit exceeded. Clients may not make more than 150 requests per hour.:-";
                    return lstIds;
                }
                else
                {
                    ReturnStatus = "Error";
                    return lstIds;
                }
            }
            catch (Exception ex)
            {
                //Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> getMembers() -- "" --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> getMembers() -- " + "" + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
                //AddToLog_ScrapMember("[ " + DateTime.Now + " ] => [ You have entered invalid URL " + FollowingUrl + " ]");
               
                ReturnStatus = "Error";
               
                return lstIds;
            }
        }