Пример #1
0
        public string RegisterUser(string Username, string Password, string cpuID, string TransactionID, string Email, string servr)
        {
            GlobusHttpHelper HttpHelpr = new GlobusHttpHelper();
            string           res       = string.Empty;
            string           url       = string.Empty;

            //getHtmlfromUrl(new Uri(Photolink), "","");
            url = "http://" + servr + "/register.php?user="******"&pass="******"&cpid=" + cpuID + "&transid=" + TransactionID + "&email=" + Email + "&LicType=" + Globals.licType + " ";


            try
            {
                res = HttpHelpr.getHtmlfromUrl(new Uri(url), "", "", "");
                //res = HttpHelpr.GetHtml(url);

                if (string.IsNullOrEmpty(res))
                {
                    System.Threading.Thread.Sleep(1000);
                    res = HttpHelpr.getHtmlfromUrl(new Uri(url), "", "", "");
                    //res = HttpHelpr.GetHtml(url);
                }

                if (string.IsNullOrEmpty(res))
                {
                    Gtk.Application.Quit();
                }
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message, PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt");
            }
            return(res);
        }
        public List <string> FetchLinksToSearch(string yahoosearchpage)
        {
            bool          nextbuttonstatus = false;
            string        nextpagelink     = yahoosearchpage;
            List <string> spamtemplist     = new List <string>();
            bool          currentpagefound = false;

            try
            {
                do
                {
                    nextbuttonstatus = false;
                    currentpagefound = false;
                    string yahoopge = httphelper.getHtmlfromUrl(new Uri(nextpagelink));

                    string[] nextpagelinks = Regex.Split(yahoopge, "<a");
                    nextpagelink = "";

                    foreach (string links in nextpagelinks)
                    {
                        try
                        {
                            if (links.Contains("/question/index"))
                            {
                                string link = Regex.Replace(links, "  ", "").Replace("\t", "").Replace("\n", "");
                                link = link.Substring(8, link.IndexOf("\">") - 8);
                                spamtemplist.Add("http://answers.yahoo.com/" + link);
                            }
                            if (links.Contains("/search/search_result"))
                            {
                                if (nextpagelink == "" && currentpagefound == true && links.Contains(";page") && links.Contains("rel=\"next\" href=\"/search/search_result"))
                                {
                                    nextpagelink     = ("http://answers.yahoo.com" + links.Substring(18, links.IndexOf("\">") - 18)).Replace("&amp", "&").Replace(";p", "p");
                                    nextbuttonstatus = true;
                                }
                            }
                            if (links.Contains(" class=\"current"))
                            {
                                currentpagefound = true;
                            }
                        }
                        catch { Console.WriteLine("if condition error"); }
                    }
                } while (nextbuttonstatus != false);
            }
            catch { Console.WriteLine("error in do whil loop"); }
            return(spamtemplist);
        }
Пример #3
0
        protected override string GetPostData()
        {
            GlobusHttpHelper httphelper  = new GlobusHttpHelper();
            string           yahoopge    = httphelper.getHtmlfromUrl(new Uri("https://login.yahoo.com/config/login?.done=http://answers.yahoo.com%2findex&.src=knowsrch&.intl=us"));
            string           splitstring = ((yahoopge.Substring(yahoopge.IndexOf("onsubmit=") + 30, yahoopge.IndexOf("form: login information") - (yahoopge.IndexOf("onsubmit=") + 60))).Replace("\n", "").Replace("\t", "").Replace("<input type=\"hidden\" name=", "&").Replace(">", "").Replace("value", "").Replace("\"", "") + "&login="******"manish_patel226" + "&passwd=" + "man_007" + "&.save=Sign+In").Replace(" ", "").Replace("index", "");

            splitstring = splitstring.Substring(1, splitstring.Length - 1).Replace(":", "%3A").Replace("/", "%2F").Replace("knowsrch_ver=0&c=&ivt=&sg=", "knowsrch_ver%3D0%26c%3D%26ivt%3D%26sg%3D");
            return(splitstring);
        }
Пример #4
0
        public bool HotmailWithoutReference(string Email, string Password)
        {
            GlobusHttpHelper HttpHelper = new GlobusHttpHelper();
            bool             activate   = false;

            Chilkat.Http http = new Chilkat.Http();

            #region Hotmail
            try
            {
                if (Email.Contains("@hotmail"))
                {
                    if (popClient.Connected)
                    {
                        popClient.Disconnect();
                    }
                    popClient.Connect("pop3.live.com", int.Parse("995"), true);
                    popClient.Authenticate(Email, Password);
                    int Count = popClient.GetMessageCount();

                    for (int i = Count; i >= 1; i--)
                    {
                        OpenPOP.MIME.Message Message = popClient.GetMessage(i);
                        string subject = string.Empty;
                        subject = Message.Headers.Subject;

                        if (Message.Headers.Subject.Contains("[WordPress] Activate") && Message.Headers.Subject.Contains("wordpress.com"))
                        {
                            foreach (string href in GetUrlsFromStringHotmail(Message.MessageBody[0]))
                            {
                                try
                                {
                                    string staticUrl = string.Empty;
                                    staticUrl = href;

                                    string res = HttpHelper.getHtmlfromUrl(new Uri(staticUrl), "", "");

                                    responce = http.QuickGetStr(staticUrl);
                                    if (responce.Contains("Your account is now active"))
                                    {
                                        Log("[ " + DateTime.Now + " ] => [ Account activated ]");
                                        activate = true;
                                    }
                                }
                                catch (Exception ex)
                                {
                                }
                            }
                        }
                    }
                }
            }
            catch { };
            #endregion
            return(activate);
        }
Пример #5
0
        public void withDrawConnection(ref GlobusHttpHelper HttpHelper, Dictionary <string, string> SlectedContacts, string UserName)
        {
            try
            {
                string csrfToken   = string.Empty;
                string sourceAlias = string.Empty;

                string referer   = "https://www.linkedin.com/people/invites?trk=connect_hub_manage_invitations_sent";
                string actionUrl = "https://www.linkedin.com/people/invites/withdraw?isInvite=true";
                string postData  = string.Empty;

                string url = "https://www.linkedin.com/people/invites?trk=connect_hub_manage_invitations_sent";
                string src = HttpHelper.getHtmlfromUrl(new Uri(url));
                if (src.Contains("csrfToken="))
                {
                    try
                    {
                        csrfToken = Utils.getBetween(src, "csrfToken=", "\"");
                        if (csrfToken.Contains("%3A"))
                        {
                            csrfToken = csrfToken.Replace("%3A", ":");
                        }
                    }
                    catch
                    { }
                }
                if (src.Contains("sourceAlias"))
                {
                    try
                    {
                        sourceAlias = Utils.getBetween(src, "sourceAlias", "}");
                        sourceAlias = Utils.getBetween(sourceAlias, "value\":\"", "\"");
                        if (sourceAlias.Contains("\\u002d"))
                        {
                            sourceAlias = sourceAlias.Replace("\u002d", "-");
                        }
                    }
                    catch
                    { }
                }

                foreach (KeyValuePair <string, string> item in SlectedContacts)
                {
                    string invitationId = item.Value.Split(':')[1];
                    postData = "csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias + "&Ids=" + invitationId;
                    string responce = HttpHelper.postDataFormessagePosting(new Uri(actionUrl), postData, referer);
                    if (responce.Contains("status\":\"ok\""))
                    {
                        //AddLoggerManageConnection("");
                    }
                }
            }
            catch
            { }
        }
        private void CheckVersion()
        {
            try
            {
                thisVersionNumber = GetAssemblyVersion();
                string textFileLocationOnServer = "http://licensing.facedominator.com/licensing/ID/IDCheckVer/IDLatestVersion.txt";

                GlobusHttpHelper httpHelper = new GlobusHttpHelper();
                string textFileData = httpHelper.getHtmlfromUrl(new Uri(textFileLocationOnServer));
                string verstatus = string.Empty;
                if (Globals.IsProVersion)
                {
                    verstatus = "Fdpro Version";
                }
                if (Globals.IsBasicVersion)
                {
                    verstatus = "Fdbasic Version";
                }
                else if (Globals.IsProVersion && Globals.IsBasicVersion)
                {
                    verstatus = Globals.Licence_Details.Split('&')[1];
                }

                string latestVersion = Regex.Split(textFileData, "<:>")[0];
                string updateVersionPath = Regex.Split(textFileData, "<:>")[1];

                if (thisVersionNumber == latestVersion)
                {
                    this.Dispatcher.Invoke(new Action(delegate
                    {
                        ModernDialog.ShowMessage("You have the Updated Version", "Information", btnMessage);
                    }));

                }
                else
                {
                    this.Dispatcher.Invoke(new Action(delegate
                    {
                        var check = ModernDialog.ShowMessage("An Updated Version Available - Do you Want to Upgrade!", "Update Available", btnUsed);
                        if (check.ToString().Equals("Yes"))
                        {
                            System.Diagnostics.Process.Start("iexplore", updateVersionPath);
                            this.Dispatcher.Invoke(new Action(delegate
                            {
                                this.Close();
                            }));
                        }
                    }));
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }
Пример #7
0
        public static void ParsePAge(string url)
        {
            var gcc = new GlobusHttpHelper();

            var html = gcc.getHtmlfromUrl(new Uri(url));

            html = File.ReadAllText("F:/Matrix.html");
            var hd = new HtmlAgilityPack.HtmlDocument();

            hd.LoadHtml(html);

            var hn = hd.DocumentNode.SelectNodes("//*");
        }
Пример #8
0
        //public void ScraperHasTage(ref FacebookUser fbUser, string Hash, Guid BoardfbPageId)
        //{


        //    GlobusHttpHelper HttpHelper = fbUser.globusHttpHelper;
        //    string KeyWord = Hash;
        //    string pageSource_Home = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/hashtag/" + KeyWord));
        //    List<string> pageSouceSplit = new List<string>();
        //    string[] trendingArr = System.Text.RegularExpressions.Regex.Split(pageSource_Home, "li data-topicid=");
        //    string[] PagesLink = System.Text.RegularExpressions.Regex.Split(pageSource_Home, "uiLikePageButton");
        //    foreach (var item in PagesLink)
        //    {
        //        pageSouceSplit.Add(item);
        //    }
        //    PagesLink = PagesLink.Skip(1).ToArray();

        //    foreach (var item_pageSouceSplit in pageSouceSplit)
        //    {
        //        try
        //        {
        //            if (item_pageSouceSplit.Contains("<!DOCTYPE html>"))
        //            {
        //                continue;
        //            }
        //            Dictionary<string, string> listContent = ScrapHasTagPages(item_pageSouceSplit);
        //            Domain.Socioboard.Domain.Boardfbfeeds fbfeed = new Domain.Socioboard.Domain.Boardfbfeeds();
        //            fbfeed.Id = Guid.NewGuid();
        //            fbfeed.Isvisible = true;
        //            fbfeed.Message = listContent["Message"];
        //            fbfeed.Image = listContent["PostImage"];
        //            fbfeed.Description = listContent["Title"];
        //            string[] splitdate = System.Text.RegularExpressions.Regex.Split(listContent["Time"], "at");
        //            string d = splitdate[0].Trim();
        //            string t = splitdate[1].Trim();
        //            fbfeed.Createddate = Convert.ToDateTime(d + " " + t);
        //            fbfeed.Feedid = listContent["PostId"];
        //            fbfeed.Type = listContent["Type"];
        //            fbfeed.Type = listContent["Link"];
        //            fbfeed.Fbpageprofileid = BoardfbPageId;
        //             if (!boardrepo.checkFacebookFeedExists(fbfeed.Feedid, BoardfbPageId))
        //             {
        //                 boardrepo.addBoardFbPageFeed(fbfeed);
        //             }

        //            // Please Write Code get Dictionary data

        //            //


        //        }
        //        catch { };



        //    }


        //    try
        //    {


        //        string ajaxpipe_token = Utils.getBetween(pageSource_Home, "\"ajaxpipe_token\":\"", "\"");
        //        string[] data_c = System.Text.RegularExpressions.Regex.Split(pageSource_Home, "data-cursor=");
        //        string cursor = Utils.getBetween(data_c[4], "\"", "=");
        //        if (cursor.Contains("data-dedupekey"))
        //        {
        //            cursor = "-" + cursor;
        //            cursor = Utils.getBetween(cursor, "-", "\"");
        //        }
        //        string sectionid = Utils.getBetween(pageSource_Home, "section_id\\\":", ",");
        //        string userid = Utils.getBetween(pageSource_Home, "USER_ID\":\"", "\"");
        //        string feed_Id = "90842368";
        //        string pager_id = "u_ps_0_0_1n";
        //        for (int i = 2; i < 50; i++)
        //        {
        //            try
        //            {
        //                Thread.Sleep(30 * 1000);

        //                List<string> pageSouceSplitPagination = new List<string>();
        //                if (string.IsNullOrEmpty(fbUser.username))
        //                {
        //                    break;
        //                }
        //                //GlobusLogHelper.log.Info("Please wait... Searching for data from Page :" + i + "   with User Name : " + fbUser.username);


        //                string req = "https://www.facebook.com/ajax/pagelet/generic.php/LitestandMoreStoriesPagelet?ajaxpipe=1&ajaxpipe_token=" + ajaxpipe_token + "&no_script_path=1&data=%7B%22cursor%22%3A%22" + cursor + "%22%2C%22preload_next_cursor%22%3Anull%2C%22pager_config%22%3A%22%7B%5C%22edge%5C%22%3Anull%2C%5C%22source_id%5C%22%3Anull%2C%5C%22section_id%5C%22%3A" + sectionid + "%2C%5C%22pause_at%5C%22%3Anull%2C%5C%22stream_id%5C%22%3Anull%2C%5C%22section_type%5C%22%3A1%2C%5C%22sizes%5C%22%3Anull%2C%5C%22most_recent%5C%22%3Afalse%2C%5C%22unread_session%5C%22%3Afalse%2C%5C%22continue_top_news_feed%5C%22%3Afalse%2C%5C%22ranking_model%5C%22%3Anull%2C%5C%22unread_only%5C%22%3Afalse%7D%22%2C%22pager_id%22%3A%22" + pager_id + "%22%2C%22scroll_count%22%3A1%2C%22start_unread_session%22%3Afalse%2C%22start_continue_top_news_feed%22%3Afalse%2C%22feed_stream_id%22%3A" + feed_Id + "%2C%22snapshot_time%22%3Anull%7D&__user="******"&__a=1&__dyn=7nm8RW8BgCBynzpQ9UoHaEWCueyrhEK49oKiWFaaBGeqrYw8popyujhElx2ubhHximmey8szoyfwgo&__req=jsonp_2&__rev=1583304&__adt=" + i + "";      //
        //                string respReq = HttpHelper.getHtmlfromUrl(new Uri(req));

        //                respReq = respReq.Replace("\\", "").Replace("u003C", "<");
        //                string[] arrrespReq = System.Text.RegularExpressions.Regex.Split(respReq, "source_id");
        //                feed_Id = Utils.getBetween(respReq, "feed_stream_id", "snapshot_time");
        //                feed_Id = Utils.getBetween(feed_Id, "A", "u");

        //                string[] pager_id1 = System.Text.RegularExpressions.Regex.Split(respReq, "_4-u2 mbl ");
        //                pager_id = Utils.getBetween(pager_id1[2], "id=\"", "\"");
        //                data_c = System.Text.RegularExpressions.Regex.Split(respReq, "data-cursor=");
        //                if (data_c.Length < 8)
        //                {
        //                    cursor = Utils.getBetween(data_c[data_c.Length - 1], "\"", "=");
        //                }
        //                cursor = Utils.getBetween(data_c[8], "\"", "=");
        //                if (cursor.Contains("data-dedupekey"))
        //                {
        //                    cursor = "-" + cursor;
        //                    cursor = Utils.getBetween(cursor, "-", "\"");
        //                }

        //                string[] PagesLinkPagination = System.Text.RegularExpressions.Regex.Split(respReq, "<span>Suggested Post</span>");

        //                foreach (var item in PagesLinkPagination)
        //                {
        //                    pageSouceSplitPagination.Add(item);
        //                }

        //                PagesLink = System.Text.RegularExpressions.Regex.Split(respReq, "uiLikePageButton");
        //                foreach (var item in PagesLink)
        //                {
        //                    pageSouceSplitPagination.Add(item);
        //                }


        //                foreach (var item_pageSouceSplit in pageSouceSplit)
        //                {
        //                    try
        //                    {
        //                        if (item_pageSouceSplit.Contains("<!DOCTYPE html>"))
        //                        {
        //                            continue;
        //                        }
        //                        Dictionary<string, string> listContent = ScrapHasTagPages(item_pageSouceSplit);
        //                        Domain.Socioboard.Domain.Boardfbfeeds fbfeed = new Domain.Socioboard.Domain.Boardfbfeeds();
        //                        fbfeed.Id = Guid.NewGuid();
        //                        fbfeed.Isvisible = true;
        //                        fbfeed.Message = listContent["Message"];
        //                        fbfeed.Image = listContent["PostImage"];
        //                        fbfeed.Description = listContent["Title"];
        //                        string[] splitdate = System.Text.RegularExpressions.Regex.Split(listContent["Time"], "at");
        //                        string d = splitdate[0].Trim();
        //                        string t = splitdate[1].Trim();
        //                        fbfeed.Createddate = Convert.ToDateTime(d + " " + t);
        //                        fbfeed.Feedid = listContent["PostId"];
        //                        fbfeed.Type = listContent["Type"];
        //                        fbfeed.Type = listContent["Link"];
        //                        fbfeed.Fbpageprofileid = BoardfbPageId;
        //                        if (!boardrepo.checkFacebookFeedExists(fbfeed.Feedid, BoardfbPageId))
        //                        {
        //                            boardrepo.addBoardFbPageFeed(fbfeed);
        //                        }
        //                        // Please Write Code get Dictionary data

        //                        //

        //                    }
        //                    catch { };



        //                }

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



        //}



        //public Dictionary<string, string> ScrapHasTagPages(string Value)
        //{
        //    string redirectionHref = string.Empty;
        //    string title = string.Empty;
        //    List<string[]> Likedata = new List<string[]>();
        //    Dictionary<string, string> HasTagData = new Dictionary<string, string>();
        //    //  foreach (var Value in Likepages)
        //    {
        //        try
        //        {

        //            redirectionHref = Utils.getBetween(Value, "href=\"", "\"");
        //            string profileUrl = redirectionHref;//1
        //            if (redirectionHref.Contains("https://www.facebook.com"))
        //            {

        //                string[] Arr_Title = System.Text.RegularExpressions.Regex.Split(Value, "<span class=\"fwb fcg\"");
        //                foreach (var valuetitle in Arr_Title)
        //                {
        //                    try
        //                    {


        //                        // title = Utils.getBetween(valuetitle, "<a", "/a>");
        //                        title = Utils.getBetween(valuetitle, "\">", "/a>");
        //                        if (!title.Equals(string.Empty))
        //                        {
        //                            title = Utils.getBetween(title, "\">", "<");
        //                            if (!string.IsNullOrEmpty(title))
        //                            {
        //                                break;
        //                            }

        //                        }
        //                    }
        //                    catch (Exception)
        //                    {

        //                    }
        //                }
        //                string profileName = title;//2
        //                string Message = Utils.getBetween(Value, "<p>", "<").Replace("&#064;", "@").Replace("&amp;", "&").Replace("u0025", "%");//7

        //                string[] timeDetails = Regex.Split(Value, "<abbr");
        //                string postedTime = string.Empty;
        //                try
        //                {
        //                    postedTime = Utils.getBetween(timeDetails[1], "=\"", "\"");
        //                }
        //                catch { };
        //                string postid = string.Empty;

        //                try
        //                {
        //                    postid = Utils.getBetween(timeDetails[0], "fbid=", "&amp;");
        //                    if (postid == "")
        //                    {
        //                        postid = Utils.getBetween(timeDetails[0], "/posts/", "\" target=");
        //                    }
        //                }
        //                catch
        //                {
        //                }

        //                string[] DetailedInfo = System.Text.RegularExpressions.Regex.Split(Value, "<div class=\"_6m7\">");
        //                string detail = string.Empty;
        //                try
        //                {
        //                    detail = "-" + DetailedInfo[1];//8
        //                    detail = Utils.getBetween(detail, "-", "</div>").Replace("&amp;", "&").Replace("u0025", "%");
        //                    if (detail.Contains("<a "))
        //                    {
        //                        string GetVisitUrl = Utils.getBetween(detail, "\">", "</a>");
        //                        detail = Utils.getBetween("$$$####" + detail, "$$$####", "<a href=") + "-" + GetVisitUrl;
        //                    }
        //                }
        //                catch
        //                { };

        //                string[] ArrDetail = System.Text.RegularExpressions.Regex.Split(Value, "<div class=\"mbs _6m6\">");
        //                string Titles = string.Empty;
        //                // string Url = Utils.getBetween(ArrDetail[0], "", "");
        //                try
        //                {
        //                    Titles = Utils.getBetween(ArrDetail[1], ">", "</a>").Replace("&#064;", "@").Replace("&amp;", "&").Replace("u0025", "%");//6
        //                    if (Titles.Contains("Sachin Tendulkar"))
        //                    {

        //                    }
        //                }
        //                catch { };
        //                string SiteRedirectionUrl = string.Empty;
        //                try
        //                {
        //                    SiteRedirectionUrl = Utils.getBetween(ArrDetail[1], "LinkshimAsyncLink.swap(this, &quot;", ");");
        //                }
        //                catch { };
        //                try
        //                {
        //                    SiteRedirectionUrl = Uri.UnescapeDataString(SiteRedirectionUrl).Replace("\\u0025", "%").Replace("\\", "");//4
        //                }
        //                catch { };
        //                string websiteUrl = string.Empty;
        //                try
        //                {
        //                    websiteUrl = Utils.getBetween(SiteRedirectionUrl, "//", "/");
        //                }
        //                catch { };
        //                string redirectionImg = string.Empty;
        //                try
        //                {
        //                    string[] adImg = System.Text.RegularExpressions.Regex.Split(Value, "<img class=\"scaledImageFitWidth img\"");
        //                       redirectionImg = Utils.getBetween(adImg[1], "src=\"", "\"").Replace("&amp;", "&");
        //                }
        //                catch { };


        //                string[] profImg = System.Text.RegularExpressions.Regex.Split(Value, "<img class=\"_s0 5xib 5sq7 _rw img\"");
        //                string profileImg = string.Empty;
        //                try
        //                {
        //                    profileImg = Utils.getBetween(profImg[0], "src=\"", "\"").Replace("&amp;", "&");
        //                }
        //                catch { };
        //                HasTagData.Add("Title", title);
        //                HasTagData.Add("Time", postedTime);
        //                HasTagData.Add("Type", "link");
        //                HasTagData.Add("Message", Message);
        //                HasTagData.Add("Image", profileImg);
        //                HasTagData.Add("PostImage", redirectionImg);
        //                HasTagData.Add("PostId", postid);
        //                HasTagData.Add("Link", SiteRedirectionUrl);
        //            }
        //        }
        //        catch { };
        //    }

        //    return HasTagData;
        //}

        public static List <Domain.Socioboard.Domain.DiscoverySearch> ScraperHasTage(string Hash)
        {
            GlobusHttpHelper HttpHelper      = new GlobusHttpHelper();
            string           KeyWord         = Hash;
            string           pageSource_Home = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/hashtag/" + KeyWord));
            List <string>    pageSouceSplit  = new List <string>();

            string[] PagesLink = System.Text.RegularExpressions.Regex.Split(pageSource_Home, "_4-u2 mbm _5jmm _5pat _5v3q _4-u8");
            foreach (var item in PagesLink)
            {
                pageSouceSplit.Add(item);
            }
            PagesLink = PagesLink.Skip(1).ToArray();
            List <Domain.Socioboard.Domain.DiscoverySearch> discSearchList = new List <Domain.Socioboard.Domain.DiscoverySearch>();

            foreach (var item_pageSouceSplit in pageSouceSplit)
            {
                Domain.Socioboard.Domain.DiscoverySearch discSearchObj = new Domain.Socioboard.Domain.DiscoverySearch();
                try
                {
                    if (item_pageSouceSplit.Contains("<!DOCTYPE html>"))
                    {
                        continue;
                    }
                    Dictionary <string, string> listContent = ScrapHasTagPages(item_pageSouceSplit);
                    // Domain.Socioboard.Domain.Boardfbfeeds fbfeed = new Domain.Socioboard.Domain.Boardfbfeeds();
                    discSearchObj.Id = Guid.NewGuid();

                    discSearchObj.Message = listContent["Message"];
                    //discSearchObj.Image = listContent["PostImage"];
                    //discSearchObj.Description = listContent["Title"];
                    string[] splitdate = System.Text.RegularExpressions.Regex.Split(listContent["Time"], "at");
                    string   d         = splitdate[0].Trim();
                    string   t         = splitdate[1].Trim();
                    discSearchObj.CreatedTime = Convert.ToDateTime(d + " " + t);
                    discSearchObj.MessageId   = listContent["PostId"];
                    //discSearchObj.Type = listContent["Type"];
                    //discSearchObj.Link = listContent["Link"];
                    discSearchObj.FromId   = listContent["FromId"];
                    discSearchObj.FromName = listContent["FromName"];
                    //discSearchObj.Fbpageprofileid = BoardfbPageId;

                    discSearchList.Add(discSearchObj);
                }
                catch { };
            }
            return(discSearchList);
        }
Пример #9
0
        public static List <string> GetLatestTrendsFromTwiter()
        {
            ILog          logger      = LogManager.GetLogger(typeof(TwitterScrapeHelper));
            List <string> lstOfTrends = new List <string>();

            try
            {
                GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper();
                string           homepageUrl         = "https://twitter.com/";
                string           trendsUrl           = "https://twitter.com/i/trends?k=0b49e0976b&pc=true&personalized=false&show_context=true&src=module&woeid=23424977";

                string homePageResponse = objGlobusHttpHelper.getHtmlfromUrl(new Uri(trendsUrl), "", "");

                try
                {
                    string[] GetTrends = Regex.Split(homePageResponse, "data-trend-name=");
                    GetTrends = GetTrends.Skip(1).ToArray();
                    foreach (string item in GetTrends)
                    {
                        try
                        {
                            string trend = Utils.getBetween(item, "\"", "\\\"").Replace("&#39;", "'");
                            lstOfTrends.Add(trend);
                        }
                        catch (Exception ex)
                        {
                            //GlobusLogHelper.log.Error("Error Get Current Trends ==> " + ex.Message);
                            logger.Error("Error Get Current Trends ==> " + ex.Message);
                            logger.Error(ex.StackTrace);
                        }
                    }
                }
                catch (Exception ex)
                {
                    logger.Error("Error Get Current Trends ==> " + ex.Message);
                    logger.Error(ex.StackTrace);
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error Get Current Trends ==> " + ex.Message);
                logger.Error(ex.StackTrace);
            }
            return(lstOfTrends);
        }
Пример #10
0
        public Dictionary <string, string> getAllMembers(ref GlobusHttpHelper HttpHelper, string userName)
        {
            Dictionary <string, string> details = new Dictionary <string, string>();

            try
            {
                string url = "https://www.linkedin.com/people/invites?trk=connect_hub_manage_invitations_sent";
                string src = HttpHelper.getHtmlfromUrl(new Uri(url));
                if (src.Contains("{\"lastName\""))
                {
                    string[] arr = Regex.Split(src, "{\"lastName\"");
                    foreach (string item in arr)
                    {
                        try
                        {
                            if (!item.Contains("<!DOCTYPE"))
                            {
                                string invitationId = string.Empty;
                                string Id           = string.Empty;
                                string fullName     = Utils.getBetween(item, "i18n_check_to_remove\":\"", "\",");
                                fullName = Utils.getBetween(fullName + "###", "to remove", "###");
                                fullName = fullName.Trim();
                                if (item.Contains(""))
                                {
                                    invitationId = Utils.getBetween(item, "\"invitationId\":\"", "\",\"");
                                }
                                if (item.Contains("memberId\":"))
                                {
                                    Id = Utils.getBetween(item, "memberId\":", "}");
                                }
                                Id = userName + ":" + Id;
                                details.Add(Id, fullName + ":" + invitationId);
                            }
                        }
                        catch
                        { }
                    }
                }
            }
            catch
            { }
            return(details);
        }
        public bool RepinwithMessage(string PinId, string myMessage, string Board, string NumberOfPage, ref PinInterestUser objPinUser)
        {
            try
            {
                string getPinPageSource = string.Empty;
                string pinUrl = string.Empty;
                string url = "https://www.pinterest.com/pin/" + PinId;
                string CheckPinPageSource = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri(url), "", string.Empty, "");
                if (!CheckPinPageSource.Contains("<div>Something went wrong!</div>") && !CheckPinPageSource.Contains("<div>Sorry. We've let our engineers know.</div>") && !CheckPinPageSource.Contains("<div>Whoops! We couldn't find that page.</div>") && !CheckPinPageSource.Contains("<div class=\"suggestionText\">How about these instead?</div>"))
                {
                    pinUrl = "https://www.pinterest.com/pin/" + PinId + "/";
                }
                else
                {
                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Pin " + PinId + " Is InCorrect ]");
                }
								
                try
                {
                    if (!string.IsNullOrEmpty(Globals.ItemSelect))
                    {
						GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + "In" + Globals.ItemSelect + " ]");
                    }
                    else
                    {
						GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + " ]");

                    }
                }
                catch { };

                try
                {
                    GlobusHttpHelper objhttp = new GlobusHttpHelper();
                    getPinPageSource = objhttp.getHtmlfromUrl(new Uri(pinUrl), "", "", "");
                }
                catch { };

                string description = string.Empty;
                string link = string.Empty;
                string boardId = string.Empty;
                string RepinPagesource = string.Empty;
                string appVersion = string.Empty;
                try
                {
                    if (getPinPageSource.Contains("description_html"))
                    {
                        description = Utils.Utils.getBetween(getPinPageSource, "description_html\":", ", \"title\":").Replace("\"", "").Replace("&", "%26").Trim();
                        description = description.Replace(" ", "+").Replace(",", "%2C").Replace("amp;", "");
                    }
                    if (getPinPageSource.Contains("serving_link"))
                    {
                        link = Utils.Utils.getBetween(getPinPageSource, "serving_link\":", ", \"is_promoted").Replace("\"", "").Trim();
                        link = link.Replace(":", "%3A").Replace("/", "%2F").Replace("?", "%3F").Replace("=", "%3D").Replace("&", "%26");
                    }
                    if (getPinPageSource.Contains("board_id"))
                    {
                        try
                        {
                            if (string.IsNullOrEmpty(Board))
                            {
                                Random rnd = new Random();
                                int BoardNum = rnd.Next(0, objPinUser.Boards.Count - 1);
                                boardId = objPinUser.Boards[BoardNum];

                            }
                            else
                            {
                                boardId = Board;

                            }

                            if (string.IsNullOrEmpty(boardId.ToString()))
                            {
								GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [Board is not present in your account , can't repin]");
                                return false;
                            }
                        }
                        catch (Exception)
                        {


                        }

                    }
                    else if (getPinPageSource.Contains("board"))
                    {
                         boardId = Board;
                    }


                    lock (Lock_RepinonBoard)
                    {
                        string Checking = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com"));
                        if (Checking.Contains("profileName"))
                        {
                            if (Checking.Contains("profileName"))
                            {
                                appVersion = Utils.Utils.getBetween(Checking, "\"app_version\": \"", "\", \"");
                            }
                        }
                        else
                        {
                            ObjAccountManager.LoginPinterestAccount(ref objPinUser);
                        }

                        string RedirectUrl = GlobusHttpHelper.valueURl.Split('.')[0];
                        string newHomePage = RedirectUrl + ".pinterest.com";

                        string linkurl = string.Empty;

                        string RepinpostData = "source_url=%2Fpin%2F" + PinId + "%2F&data=%7B%22options%22%3A%7B%22pin_id%22%3A%22" + PinId + "%22%2C%22description%22%3A%22" + myMessage + "%22%2C%22link%22%3A%22" + link + "%22%2C%22is_video%22%3Afalse%2C%22board_id%22%3A%22" + Board + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=Modal()%3EPinCreate3(resource%3DPinResource(id%3D" + PinId + "))%3EBoardPicker(resource%3DBoardPickerBoardsResource(filter%3Dall))%3ESelectList(view_type%3DpinCreate3%2C+selected_section_index%3Dundefined%2C+selected_item_index%3Dundefined%2C+highlight_matched_text%3Dtrue%2C+suppress_hover_events%3Dundefined%2C+item_module%3D%5Bobject+Object%5D)";
                        string PostPageUrl = RedirectUrl + ".pinterest.com/resource/RepinResource/create/";
                        try
                        {
                            RepinPagesource = objPinUser.globusHttpHelper.postFormDataProxyREPin(new Uri(PostPageUrl), RepinpostData, newHomePage, objPinUser.App_version);
                        }
                        catch (Exception ex)
                        {
                        }


                        if (string.IsNullOrEmpty(RepinPagesource))
                        {

                            try
                            {
                                if (getPinPageSource.Contains("class=\"sourceFlagWrapper"))
                                {
                                    try
                                    {

                                        BaseLib.GlobusRegex rgx = new GlobusRegex();

                                        string urldata = System.Text.RegularExpressions.Regex.Split(System.Text.RegularExpressions.Regex.Split(getPinPageSource, "sourceFlagWrapper")[1], "</a>")[0];

                                        linkurl = rgx.GetHrefUrlTag(urldata).Replace("href=\"", string.Empty);
                                    }
                                    catch (Exception ex)
                                    {

                                    }
                                }
                                else if (string.IsNullOrEmpty(linkurl))
                                {
                                    try
                                    {
                                        string urldata = System.Text.RegularExpressions.Regex.Split(System.Text.RegularExpressions.Regex.Split(getPinPageSource, "sourceFlagWrapper")[1], "</a>")[0];

                                        string Datavalue = urldata.Substring(urldata.IndexOf("href=\\\""));

                                        int startindex = Datavalue.IndexOf("href=\\\"");
                                        string start = Datavalue.Substring(startindex).Replace("href=\\\"", "");
                                        int endindex = start.IndexOf("\\\"");
                                        string end = start.Substring(0, endindex);

                                        linkurl = end;// Datavalue.Substring(0, Datavalue.IndexOf("\\\">")).Replace("\\", string.Empty).Replace("\n", string.Empty).Replace(">", string.Empty).Replace("href=\"", string.Empty);
                                    }
                                    catch { };
                                }

                                try
                                {                                   
                                    string postdata1 = "source_url=%2Fpin%2F" + PinId + "%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + Board + "%22%2C%22description%22%3A%22" + myMessage + "%22%2C%22link%22%3A%22" + Uri.EscapeDataString(linkurl) + "%22%2C%22is_video%22%3Afalse%2C%22pin_id%22%3A%22" + PinId + "%22%7D%2C%22context%22%3A%7B%22app_version%22%3A%22" + objPinUser.App_version + "%22%2C%22https_exp%22%3Afalse%7D%7D&module_path=App()%3ECloseup(resource%3DPinResource(id%3D" + PinId + "))%3EPinActionBar(resource%3DPinResource(id%3D" + PinId + "))%3EShowModalButton(module%3DPinCreate)%23Modal(module%3DPinCreate(resource%3DPinResource(id%3D" + PinId + ")))";
                                    string afterposting = objPinUser.globusHttpHelper.postFormDataProxy(new Uri("https://www.pinterest.com/resource/RepinResource/create/"), postdata1, "http://www.pinterest.com/pin/" + PinId + "/", "", 0, "", "");
                                    if (!afterposting.Contains("<div>Uh oh! Something went wrong."))
                                    {
                                          return true;
                                    }
                                    return false;
                                }
                                catch (Exception ex)
                                {

                                };
                            }
                            catch (Exception ex)
                            {

                            }
                        }



                        if (!string.IsNullOrEmpty(RepinPagesource))
                        {
                            try
                            {
                                if (!string.IsNullOrEmpty(Globals.ItemSelect))
                                {
									GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + " In " + Globals.ItemSelect + " is Done. ]");
                                }
                                else
                                {
									GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + " is Done. ]");
                                }                           
                            }
                            catch { };

                            return true;
                        }
                        else
                        {
							GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining " + PinId + " For " + objPinUser.Username + " is Failed. ]");
                            return false;
                        }

                    }
                }
                catch { };

                return false;
            }
            catch (Exception Ex)
            {
                return false;
            }
        }
Пример #12
0
        public static string GetUserIDFromUsername_New(string username, out string Status, ref GlobusHttpHelper HttpHelper)
        {
            string GetStatus = string.Empty;

            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
            {
                string id = string.Empty;
                string pagesource = string.Empty;

                pagesource = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/" + 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"))
                {
                   // pagesource = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/" + username), "", "");

                    try
                    {
                        int startindex = pagesource.IndexOf("profile_id");
                        string start = pagesource.Substring(startindex).Replace("profile_id", "");
                        int endindex = start.IndexOf(",");
                        string end = start.Substring(0, endindex).Replace("&quot;", "").Replace("\"", "").Replace(":", "").Trim();
                        user_id = end.Trim();
                    }
                    catch
                    {
                    }

                    if (string.IsNullOrEmpty(user_id))
                    {
                        try
                        {
                            int startindex = pagesource.IndexOf("ProfileTweet-authorDetails\">");
                            string start = pagesource.Substring(startindex).Replace("ProfileTweet-authorDetails\">", "");
                            int endindex = start.IndexOf("\">");
                            string end = start.Substring(start.IndexOf("data-user-id="), endindex - start.IndexOf("data-user-id=")).Replace("data-user-id=", "").Replace("\"", "");
                            user_id = end.Trim();
                        }
                        catch
                        {
                        }
                    }

                    if (string.IsNullOrEmpty(user_id))
                    {
                        try
                        {
                            int startindex = pagesource.IndexOf("stats js-mini-profile-stats \" data-user-id=\"");
                            if (startindex == -1)
                            {
                                startindex = pagesource.IndexOf("user-actions btn-group not-following not-muting \" data-user-id=\"");
                            }
                            if (startindex == -1)
                            {
                                startindex = pagesource.IndexOf("user-actions btn-group not-following not-muting protected\" data-user-id=\"");
                            }
                            string start = pagesource.Substring(startindex).Replace("stats js-mini-profile-stats \" data-user-id=\"", "").Replace("user-actions btn-group not-following not-muting \" data-user-id=\"", "").Replace("user-actions btn-group not-following not-muting protected\" data-user-id=\"", "").Trim();
                            //int endindex = start.IndexOf("\">");
                            int endindex = start.IndexOf("\"");
                            string end = start.Substring(0, endindex);
                            user_id = end.Replace("\"", "");
                        }
                        catch
                        {
                        }
                    }
                }
                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 = "No Error";
            return user_id;
        }
Пример #13
0
        public void Start_Comment(ref InstagramUser IGcomment)
        {
            try
            {
                lstThreadsCommentPoster.Add(Thread.CurrentThread);
                lstThreadsCommentPoster.Distinct();
                Thread.CurrentThread.IsBackground = true;
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }

            try
            {
                bool ProcessStartORnot = false;

                GlobusHttpHelper obj = IGcomment.globusHttpHelper;
                //  string res_secondURL = obj.getHtmlfromUrl(new Uri(IGGlobals.Instance.IGTestURL), "");
                string res_secondURL = obj.getHtmlfromUrl(new Uri("https://www.instagram.com"), "");
                int    parsedValue;

                if (!string.IsNullOrEmpty(CommentPhoto_ID) && !string.IsNullOrEmpty(message_comment))
                {
                    string s = CommentPhoto_ID;
                    string k = message_comment;
                    ClGlobul.CommentIdsForMSG.Clear();
                    ClGlobul.commentMsgList.Clear();
                    if (s.Contains(','))
                    {
                        string[] Data = s.Split(',');

                        foreach (var item in Data)
                        {
                            ClGlobul.CommentIdsForMSG.Add(item);
                        }
                    }
                    else
                    {
                        ClGlobul.CommentIdsForMSG.Add(CommentPhoto_ID);
                    }
                    if (k.Contains(","))
                    {
                        string[] data1 = Regex.Split(k, ",");
                        foreach (string item in data1)
                        {
                            ClGlobul.commentMsgList.Add(item);
                        }
                    }
                    else
                    {
                        ClGlobul.commentMsgList.Add(message_comment);
                    }
                }
            }

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

            if (string.IsNullOrEmpty(message_comment_path))
            {
                if (!string.IsNullOrEmpty(message_comment))//txtsingalmsg
                {
                    // ClGlobul.commentMsgList.Clear();
                    if (Nothread_comment != 0)
                    {
                        //if (MessageBox.Show("Do you really want to Start Without Thread", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)  //txtsingalmsg
                        //{

                        //    ProcessStartORnot = true;
                        //    ClGlobul.NoOfcommentThread = 1;
                        //    try
                        //    {
                        //        string AllMessege = txtsingalmsg.Text.Trim();
                        //        string[] ListMessages = Regex.Split(AllMessege, ",");
                        //        foreach (string str in ListMessages)
                        //        {
                        //            ClGlobul.commentMsgList.Add(str);
                        //        }
                        //    }
                        //    catch { };
                        //}
                        //else
                        //{
                        //}
                    }
                    else
                    {
                        try
                        {
                            ClGlobul.NoOfcommentThread = Nothread_comment;

                            try
                            {
                                string   AllMessege   = message_comment;
                                string[] ListMessages = Regex.Split(AllMessege, ",");
                                foreach (string str in ListMessages)
                                {
                                    ClGlobul.commentMsgList.Add(str);
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }
                    }
                }
                else
                {
                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Please upload Comments. ]");
                }
            }

            if (status == "Success")
            {
                foreach (var CommentIdsForMSG_item in ClGlobul.CommentIdsForMSG)
                {
                    getComment(CommentIdsForMSG_item, ref IGcomment);
                }
            }

            else
            {
                if (status == "Failed")
                {
                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Login Fail. ]" + IGcomment.username);
                }
            }
        }
Пример #14
0
        public void SignupMultiThreaded(object parameters)
        {
            Array paramsArray = new object[3];

            paramsArray = (Array)parameters;

            string Email    = string.Empty;
            string Password = string.Empty;

            string proxyAddress  = string.Empty;
            string proxyPort     = string.Empty;
            string proxyUsername = string.Empty;
            string proxyPassword = string.Empty;

            string emailData = (string)paramsArray.GetValue(0);
            string username  = (string)paramsArray.GetValue(1);
            string name      = (string)paramsArray.GetValue(2);

            try
            {
                Email    = emailData.Split(':')[0];
                Password = emailData.Split(':')[1];
            }
            catch (Exception ex) { AddToListBox(ex.Message); }

            if (emailData.Split(':').Length > 5)
            {
                proxyAddress  = emailData.Split(':')[2];
                proxyPort     = emailData.Split(':')[3];
                proxyUsername = emailData.Split(':')[4];
                proxyPassword = emailData.Split(':')[5];
            }
            else if (emailData.Split(':').Length == 4)
            {
                proxyAddress = emailData.Split(':')[2];
                proxyPort    = emailData.Split(':')[3];
            }

            try
            {
                if (!(username.Count() < 15 || Password.Count() > 6))
                {
                    if (username.Count() > 15)
                    {
                        AddToListBox("Username Must Not be greater than 15 char");
                    }
                    else if (Password.Count() < 6)
                    {
                        AddToListBox("Password Must Not be less than 6 char");
                    }
                }
            }
            catch { }

            Random randm     = new Random();
            double cachestop = randm.NextDouble();

            string textUrl     = globusHelper.getHtmlfromUrlProxy(new Uri("https://twitter.com/signup"), proxyAddress, proxyPort, proxyUsername, proxyPassword, "", "");
            string pagesource1 = globusHelper.getHtmlfromUrl(new Uri("https://www.google.com/recaptcha/api/js/recaptcha_ajax.js"), "", "");
            string pagesource2 = globusHelper.getHtmlfromUrl(new Uri("https://www.google.com/recaptcha/api/challenge?k=6LfbTAAAAAAAAE0hk8Vnfd1THHnn9lJuow6fgulO&ajax=1&cachestop=" + cachestop + "&lang=en"), "", "");

            try
            {
                int    IndexStart = pagesource2.IndexOf("challenge :");
                string Start      = pagesource2.Substring(IndexStart);
                int    IndexEnd   = Start.IndexOf("',");
                string End        = Start.Substring(0, IndexEnd).Replace("challenge :", "").Replace("'", "").Replace(" ", "");
                capcthavalue = End;
                ImageURL     = "https://www.google.com/recaptcha/api/image?c=" + End;
            }
            catch (Exception ex)
            {
                Console.WriteLine("1 :" + ex.StackTrace);
            }

            WebClient webclient = new WebClient();

            webclient.DownloadFile(ImageURL, Application.LocalUserAppDataPath + "\\Image.jpg");

            try
            {
                int    StartIndex = textUrl.IndexOf("phx-signup-form");
                string Start      = textUrl.Substring(StartIndex);
                int    EndIndex   = Start.IndexOf("name=\"authenticity_token");
                string End        = Start.Substring(0, EndIndex).Replace("phx-signup-form", "").Replace("method=\"POST\"", "").Replace("action=\"https://twitter.com/account/create\"", "");
                authenticitytoken = End.Replace("class=\"\">", "").Replace("<input type=\"hidden\"", "").Replace("class=\"\">", "").Replace("value=\"", "").Replace("\n", "").Replace("\"", "").Replace(" ", "");
            }
            catch (Exception ex)
            {
                Console.WriteLine("2 :" + ex.StackTrace);
            }
            try
            {
                bool   Created       = true;
                string url           = "https://twitter.com/users/email_available?suggest=1&username=&full_name=&email=" + Email.Replace("@", "%40").Replace(" ", "") + "&suggest_on_username=true&context=signup";
                string EmailCheck    = globusHelper.getHtmlfromUrl(new Uri(url), "https://twitter.com/signup", "");
                string Usernamecheck = globusHelper.getHtmlfromUrl(new Uri("https://twitter.com/users/username_available?suggest=1&username="******"&full_name=" + name + "&email=&suggest_on_username=true&context=signup"), "https://twitter.com/signup", "");

                if (EmailCheck.Contains("Email has already been taken. An email can only be used on one Twitter account at a time"))
                {
                    Created = false;
                }
                else if (Usernamecheck.Contains("Username has already been taken"))
                {
                    Created = false;
                }
                else if (EmailCheck.Contains("You cannot have a blank email address"))
                {
                    Created = false;
                }

                if (Created)
                {
                    byte[] args = webclient.DownloadData(ImageURL);

                    string[] arr1 = new string[] { "indianbill007", "sumit1234", "" };

                    string captchaText             = DecodeDBC(arr1, args);
                    string postdata                = "authenticity_token=" + authenticitytoken + "&user%5Bname%5D=" + name + "&user%5Bemail%5D=" + Email.Replace(" ", "") + "&user%5Buser_password%5D=" + Password + "&user%5Bscreen_name%5D=" + username + "&user%5Bremember_me_on_signup%5D=1&user%5Bremember_me_on_signup%5D=&context=&recaptcha_challenge_field=" + capcthavalue + "&recaptcha_response_field=" + HttpUtility.UrlEncode(captchaText) + "&user%5Bdiscoverable_by_email%5D=1&user%5Bsend_email_newsletter%5D=1";
                    string AccountcraetePageSource = globusHelper.postFormData(new Uri("https://twitter.com/account/create"), postdata, "https://twitter.com/signup", "", "", "", "");

                    if (AccountcraetePageSource.Contains("id=\"signout-form\"") && AccountcraetePageSource.Contains("/logout"))
                    {
                        MessageBox.Show("Account created");
                    }


                    if (Created)
                    {
                        ClsEmailActivator EmailActivate = new ClsEmailActivator();
                        bool verified = EmailActivate.EmailVerification(Email.Replace(" ", ""), Password, ref globusHelper);
                        if (verified)
                        {
                            AddToListBox("Account Verified");
                        }
                    }
                }
                else
                {
                    if (EmailCheck.Contains("Email has already been taken. An email can only be used on one Twitter account at a time"))
                    {
                        AddToListBox("Email has already been taken. An email can only be used on one Twitter account at a time");
                    }
                    else if (Usernamecheck.Contains("Username has already been taken"))
                    {
                        AddToListBox("Username has already been taken");
                    }
                    else if (EmailCheck.Contains("You cannot have a blank email address"))
                    {
                        AddToListBox("You cannot have a blank email address");
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("3 :" + ex.StackTrace);
            }
        }
Пример #15
0
        public static List <string> GetPhotoId(string hashTag)
        {
            string           url = "http://websta.me/" + "tag/" + hashTag;
            GlobusHttpHelper objInstagramUser = new GlobusHttpHelper();
            List <string>    lstPhotoId       = new List <string> ();
            int counter = 0;


            string pageSource = objInstagramUser.getHtmlfromUrl(new Uri(url), "", "");

            if (!string.IsNullOrEmpty(pageSource))
            {
                if (pageSource.Contains("<div class=\"mainimg_wrapper\">"))
                {
                    string[] arr = Regex.Split(pageSource, "<div class=\"mainimg_wrapper\">");
                    if (arr.Length > 1)
                    {
                        arr = arr.Skip(1).ToArray();
                        foreach (string itemarr in arr)
                        {
                            try
                            {
                                string startString = "<a href=\"/p/";
                                string endString   = "\" class=\"mainimg\"";
                                string imageId     = string.Empty;
                                string imageSrc    = string.Empty;
                                if (itemarr.Contains("<a href=\"/p/"))
                                {
                                    int    indexStart = itemarr.IndexOf("<a href=\"/p/");
                                    string itemarrNow = itemarr.Substring(indexStart);
                                    if (itemarrNow.Contains(startString) && itemarrNow.Contains(endString))
                                    {
                                        try
                                        {
                                            imageId = GlobusHttpHelper.getBetween(itemarrNow, startString, endString).Replace("/", "");
                                        }
                                        catch { }
                                        if (!string.IsNullOrEmpty(imageId))
                                        {
                                            lstPhotoId.Add(imageId);
                                            lstPhotoId.Distinct();
                                            if (lstPhotoId.Count >= counterPhotoId)
                                            {
                                                return(lstPhotoId);
                                            }

                                            //imageId = "http://websta.me"+imageId;
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                            }
                        }



                        #region pagination
                        string pageLink = string.Empty;
                        while (true)
                        {
                            //if (stopScrapImageBool) return;
                            string startString = "<a href=\"";
                            string endString   = "\" class=\"mainimg\"";
                            string imageId     = string.Empty;
                            string imageSrc    = string.Empty;

                            if (!string.IsNullOrEmpty(pageLink))
                            {
                                pageSource = objInstagramUser.getHtmlfromUrl(new Uri(pageLink), "", "");
                            }

                            if (pageSource.Contains("<ul class=\"pager\">") && pageSource.Contains("rel=\"next\">"))
                            {
                                try
                                {
                                    pageLink = GlobusHttpHelper.getBetween(pageSource, "<ul class=\"pager\">", "rel=\"next\">");
                                }
                                catch { }
                                if (!string.IsNullOrEmpty(pageLink))
                                {
                                    try
                                    {
                                        int len = pageLink.IndexOf("<a href=\"");
                                        len      = len + ("<a href=\"").Length;
                                        pageLink = pageLink.Substring(len);
                                        pageLink = pageLink.Trim();
                                        pageLink = pageLink.TrimEnd(new char[] { '"' });
                                        pageLink = "http://websta.me/" + pageLink;
                                    }
                                    catch { }
                                    if (!string.IsNullOrEmpty(pageLink))
                                    {
                                        string response = string.Empty;
                                        try
                                        {
                                            response = objInstagramUser.getHtmlfromUrl(new Uri(pageLink), "", "");
                                        }
                                        catch { }
                                        if (!string.IsNullOrEmpty(response))
                                        {
                                            if (response.Contains("<div class=\"mainimg_wrapper\">"))
                                            {
                                                try
                                                {
                                                    string[] arr1 = Regex.Split(response, "<div class=\"mainimg_wrapper\">");
                                                    if (arr1.Length > 1)
                                                    {
                                                        arr1 = arr1.Skip(1).ToArray();
                                                        foreach (string items in arr1)
                                                        {
                                                            try
                                                            {
                                                                //if (stopScrapImageBool) return;
                                                                if (items.Contains("<a href=\"/p/"))
                                                                {
                                                                    int    indexStart = items.IndexOf("<a href=\"/p/");
                                                                    string itemarrNow = items.Substring(indexStart);

                                                                    try
                                                                    {
                                                                        imageId = GlobusHttpHelper.getBetween(itemarrNow, startString, endString).Replace("/", "");
                                                                    }
                                                                    catch { }
                                                                    if (!string.IsNullOrEmpty(imageId))
                                                                    {
                                                                        lstPhotoId.Add(imageId);
                                                                        lstPhotoId.Distinct();
                                                                        if (lstPhotoId.Count >= counterPhotoId)
                                                                        {
                                                                            return(lstPhotoId);
                                                                        }

                                                                        //imageId = "http://websta.me"+imageId;
                                                                    }


                                                                    counter++;

                                                                    //Addtologger("Image DownLoaded with ImageName  "+imageId+"_"+counter);
                                                                    if (lstPhotoId.Count >= counterPhotoId)
                                                                    {
                                                                        return(lstPhotoId);
                                                                    }
                                                                }
                                                            }
                                                            catch { }
                                                        }
                                                        if (lstPhotoId.Count >= counterPhotoId)
                                                        {
                                                            return(lstPhotoId);
                                                        }
                                                    }
                                                }
                                                catch { }
                                            }
                                        }
                                        else
                                        {
                                        }
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }
                                else
                                {
                                    break;
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                        #endregion
                    }
                }
            }
            return(lstPhotoId);
        }
Пример #16
0
        private void RequestJSCSSIMG(string pageSource, ref GlobusHttpHelper HttpHelper)
        {
            ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

            //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)
                    {
                        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)
            {
                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."))
                    {
                        try
                        {
                            string res = HttpHelper.getHtmlfromUrl(new Uri(jsSource));
                        }
                        catch (Exception)
                        {
                            Thread.Sleep(500);
                            try
                            {
                                string res = HttpHelper.getHtmlfromUrl(new Uri(jsSource));
                            }
                            catch (Exception)
                            {
                            }
                        }
                    }
                }
            }

            ///IMG Request
            string[] imageArr = Regex.Split(pageSource, "<img");
            foreach (string item in imageArr)
            {
                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.Contains(".png") || jsSource.Contains(".gif") || jsSource.Contains(".jpg") || jsSource.Contains(".jpeg"))
                        {
                            try
                            {
                                string res = HttpHelper.getHtmlfromUrl(new Uri(jsSource));
                            }
                            catch (Exception)
                            {
                                Thread.Sleep(500);
                                try
                                {
                                    string res = HttpHelper.getHtmlfromUrl(new Uri(jsSource));
                                }
                                catch (Exception)
                                {
                                }
                            }
                        }
                    }
                }
            }

        }
Пример #17
0
        private void btnStart_Searching_Click(object sender, EventArgs e)
        {


            AllOfTheseWords = (txtAllofTheseKeywords.Text).ToString();
            ThisExtractPhrase = (txtThisExactPhrase.Text).ToString();
            AnyOfTheseWords = (txtAnyOfTheseWords.Text).ToString();
            TheseHashTags = (txtTheseHashTags.Text).ToString();
            NoneOfTheseWords = (txtNoneofTheseWords.Text).ToString();
            FromTheseAccounts = (txtFromTheseAccounts.Text).ToString();
            ToTheseAccounts = (txtToTheseAccounts.Text).ToString();
            MentionTheseAccounts = (txtMentioningTheseAccounts.Text).ToString();
            NearThisPlace = (txtNearThisPlace.Text).ToString();

            
            AddToLog_AdvancedSearch("[ " + DateTime.Now + " ] => Process Started");

            try
            {
                if (string.IsNullOrEmpty(ThisExtractPhrase))
                {
                    ThisExtractPhrase = "";
                }
                else
                {
                    ThisExtractPhrase = "%20%22" + ThisExtractPhrase;
                }
            }
            catch { }

            try
            {

                if (string.IsNullOrEmpty(AnyOfTheseWords))
                {
                    AnyOfTheseWords = "";
                }
                else
                {
                    AnyOfTheseWords = "%22%20" + AnyOfTheseWords;
                }
            }
            catch
            { }


            try
            {
                if (string.IsNullOrEmpty(TheseHashTags))
                {
                    TheseHashTags = "";
                }
                else
                {
                    TheseHashTags = "%20%23" + TheseHashTags;
                }
            }
            catch
            { }


            try
            {
                if (string.IsNullOrEmpty(NoneOfTheseWords))
                {
                    NoneOfTheseWords = "";
                }
                else
                {
                    NoneOfTheseWords = "%20-" + NoneOfTheseWords;
                }
            }
            catch
            { }


            try
            {
                if (string.IsNullOrEmpty(FromTheseAccounts))
                {
                    FromTheseAccounts = "";
                }
                else
                {
                    FromTheseAccounts = "%20from%3A" + FromTheseAccounts;
                }
            }
            catch
            { }


            try
            {
                if (string.IsNullOrEmpty(ToTheseAccounts))
                {
                    ToTheseAccounts = "";
                }
                else
                {
                    ToTheseAccounts = "%20to%3A" + ToTheseAccounts;
                }
            }
            catch
            { }


            try
            {
                if (string.IsNullOrEmpty(MentionTheseAccounts))
                {
                    MentionTheseAccounts = "";
                }
                else
                {
                    MentionTheseAccounts = "%20%40" + MentionTheseAccounts;
                }
            }
            catch
            { }

            try
            {
                if (string.IsNullOrEmpty(NearThisPlace))
                {
                    NearThisPlace = "";
                }
                else
                {
                    NearThisPlace = "%20near%3A%22" + NearThisPlace;
                }
            }
            catch
            { }




            try
            {
                if (!string.IsNullOrEmpty(txtAllofTheseKeywords.Text))
                {
                    #region Commented
                    //try
                    //{
                    //    string Url = "https://twitter.com/search?f=realtime&q=" + AllOfTheseWords + ThisExtractPhrase + AnyOfTheseWords + NoneOfTheseWords + TheseHashTags + _selectedLanguage + FromTheseAccounts + ToTheseAccounts + MentionTheseAccounts + NearThisPlace + "%22%20within%3A15mi&src=typd";
                    //    string response = _GlobusHttpHelper.getHtmlfromUrl(new Uri(Url), "", "");
                    //}
                    //catch { } public List<StructTweetIDs> NewKeywordStructDataForSearchByKeyword(string keyword) 
                    #endregion
                    {
                        try
                        {
                            BaseLib.GlobusRegex regx = new GlobusRegex();
                           
                            int counter = 0;
                            string res_Get_searchURL = string.Empty;
                            string searchURL = string.Empty;
                            string maxid = string.Empty;
                            string TweetId = string.Empty;
                            string text = string.Empty;

                            string ProfileName = string.Empty;
                            string Location = string.Empty;
                            string Bio = string.Empty;
                            string website = string.Empty;
                            string NoOfTweets = string.Empty;
                            string Followers = string.Empty;
                            string Followings = string.Empty;
                            int noOfRecords = 0;
                            try
                            {
                                noOfRecords = int.Parse(txtNoOfRecords.Text);
                            }
                            catch { }


                        startAgain:


                            if (counter == 0)
                            {
                                searchURL = "https://twitter.com/i/search/timeline?q=" + AllOfTheseWords + ThisExtractPhrase + AnyOfTheseWords + NoneOfTheseWords + TheseHashTags + _selectedLanguage + FromTheseAccounts + ToTheseAccounts + MentionTheseAccounts + NearThisPlace + "%22%20within%3A15mi&src=typd" + "&f=realtime";
                                counter++;
                            }
                            else
                            {

                                searchURL = "https://twitter.com/i/search/timeline?q=" + AllOfTheseWords + ThisExtractPhrase + AnyOfTheseWords + NoneOfTheseWords + TheseHashTags + _selectedLanguage + FromTheseAccounts + ToTheseAccounts + MentionTheseAccounts + NearThisPlace + "%22%20within%3A15mi&src=typd" + "&f=realtime&include_available_features=1&include_entities=1&last_note_ts=0&oldest_unread_id=0&scroll_cursor=" + TweetId + "";
                            }


                            try
                            {
                                res_Get_searchURL = _GlobusHttpHelper.getHtmlfromUrl(new Uri(searchURL), "", "");
                                 AddToLog_AdvancedSearch("[ " + DateTime.Now + " ] => Finding results for entered details ");

                                if (string.IsNullOrEmpty(res_Get_searchURL))
                                {
                                    res_Get_searchURL = _GlobusHttpHelper.getHtmlfromUrl(new Uri(searchURL), "", "");
                                }

                                try
                                {
                                    //string sjss = globushttpHelper.getHtmlfromUrl(new Uri(searchURL), "", "");
                                    string[] splitRes = Regex.Split(res_Get_searchURL, "refresh_cursor");
                                    //splitRes = splitRes.Skip(1).ToArray();
                                    foreach (string item in splitRes)
                                    {
                                        if (item.Contains("refresh_cursor"))
                                        {
                                            int startIndex = item.IndexOf("TWEET-");
                                            string start = item.Substring(startIndex).Replace("data-user-id=\\\"", "");
                                            int endIndex = start.IndexOf("\"");
                                            string end = start.Substring(0, endIndex).Replace("id_str", "").Replace("\"", "").Replace(":", "").Replace("{", "").Replace("}", "").Replace("]", "");
                                            TweetId = end;


                                        }
                                        if (item.Contains("scroll_cursor"))
                                        {
                                            int startIndex = item.IndexOf("TWEET-");
                                            string start = item.Substring(startIndex).Replace("data-user-id=\\\"", "");
                                            int endIndex = start.IndexOf("\"");
                                            string end = start.Substring(0, endIndex).Replace("id_str", "").Replace("\"", "").Replace(":", "").Replace("{", "").Replace("}", "").Replace("]", "");
                                            TweetId = end;
                                        }
                                    }
                                }
                                catch (Exception)
                                {
                                }
                            }

                            catch (Exception ex)
                            {
                                System.Threading.Thread.Sleep(2000);
                                res_Get_searchURL = _GlobusHttpHelper.getHtmlfromUrl(new Uri(searchURL), "", "");


                            }
                            // && !res_Get_searchURL.Contains("has_more_items\":false")
                            if (!string.IsNullOrEmpty(res_Get_searchURL))
                            {
                                //string[] splitRes = Regex.Split(res_Get_searchURL, "data-item-id"); //Regex.Split(res_Get_searchURL, "\"in_reply_to_status_id_str\"");
                                string[] splitRes = Regex.Split(res_Get_searchURL, "data-item-id");

                                splitRes = splitRes.Skip(1).ToArray();


                                foreach (string item in splitRes)
                                {
                                    if (item.Contains("data-screen-name=") && !item.Contains("js-actionable-user js-profile-popup-actionable"))
                                    {
                                        //var avc = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(res_Get_searchURL);
                                        //string DataHtml = (string)avc["items_html"];
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                    string modified_Item = "\"from_user\"" + item;

                                    string id = "";
                                    try
                                    {
                                        int startIndex = item.IndexOf("data-user-id=");
                                        string start = item.Substring(startIndex).Replace("data-user-id=\\\"", "");
                                        int endIndex = start.IndexOf("\\\"");
                                        string end = start.Substring(0, endIndex).Replace("id_str", "").Replace("\"", "").Replace(":", "").Replace("{", "").Replace("}", "").Replace("]", "");
                                        id = end;
                                        //lst_structTweetIDs.Add(id);
                                        AddToLog_AdvancedSearch("[ " + DateTime.Now + " ] => User Id " + id);
                                    }
                                    catch (Exception ex)
                                    {
                                        id = "null";
                                        //Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetPhotoFromUsername() -- id -- " + keyword + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);

                                    }

                                    string from_user_id = "";
                                    try
                                    {
                                        int startIndex = item.IndexOf("data-screen-name=\\\"");
                                        string start = item.Substring(startIndex).Replace("data-screen-name=\\\"", "");
                                        int endIndex = start.IndexOf("\\\"");
                                        string end = start.Substring(0, endIndex).Replace("from_user_id\":", "").Replace("\"", "").Replace(":", "").Replace("{", "").Replace("_str", "").Replace("user", "").Replace("}", "").Replace("]", "");
                                        from_user_id = end;
                                        AddToLog_AdvancedSearch("[ " + DateTime.Now + " ] => User ScreenName " + from_user_id);
                                    }
                                    catch (Exception ex)
                                    {
                                        from_user_id = "null";
                                        // Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetPhotoFromUsername() -- " + keyword + " -- from_user_id --> " + ex.Message, Globals.Path_TwitterDataScrapper);

                                    }

                                    string tweetUserid = string.Empty;
                                    try
                                    {
                                        int startIndex = item.IndexOf("=\\\"");
                                        string start = item.Substring(startIndex).Replace("=\\\"", "");
                                        int endIndex = start.IndexOf("\\\"");
                                        string end = start.Substring(0, endIndex).Replace("from_user_id\":", "").Replace("\"", "").Replace(":", "").Replace("{", "").Replace("_str", "").Replace("user", "").Replace("}", "").Replace("]", "");
                                        tweetUserid = end;
                                        AddToLog_AdvancedSearch("[ " + DateTime.Now + " ] => Tweet Id " + tweetUserid);
                                    }
                                    catch (Exception ex)
                                    {
                                        from_user_id = "null";


                                    }

                                    ///Tweet Text 
                                    #region Commented
                                    //try
                                    //{


                                    //    int startindex = item.IndexOf("js-tweet-text tweet-text\"");
                                    //    if (startindex == -1)
                                    //    {
                                    //        startindex = 0;
                                    //        startindex = item.IndexOf("js-tweet-text tweet-text");
                                    //    }

                                    //    string start = item.Substring(startindex).Replace("js-tweet-text tweet-text\"", "").Replace("js-tweet-text tweet-text tweet-text-rtl\"", "");
                                    //    int endindex = start.IndexOf("</p>");

                                    //    if (endindex == -1)
                                    //    {
                                    //        endindex = 0;
                                    //        endindex = start.IndexOf("stream-item-footer");
                                    //    }

                                    //    string end = start.Substring(0, endindex);
                                    //    end = regx.StripTagsRegex(end);
                                    //    text = end.Replace("&nbsp;", "").Replace("a href=", "").Replace("/a", "").Replace("<span", "").Replace("</span", "").Replace("class=\\\"js-display-url\\\"", "").Replace("class=\\\"tco-ellipsis\\\"", "").Replace("class=\\\"invisible\\\"", "").Replace("<strong>", "").Replace("target=\\\"_blank\\\"", "").Replace("class=\\\"twitter-timeline-link\\\"", "").Replace("</strong>", "").Replace("rel=\\\"nofollow\\\" dir=\\\"ltr\\\" data-expanded-url=", "");
                                    //    text = text.Replace("&quot;", "").Replace("<", "").Replace(">", "").Replace("\"", "").Replace("\\", "").Replace("title=", "");

                                    //    string[] array = Regex.Split(text, "http");
                                    //    text = string.Empty;
                                    //    foreach (string itemData in array)
                                    //    {
                                    //        if (!itemData.Contains("t.co"))
                                    //        {
                                    //            string data = string.Empty;
                                    //            if (itemData.Contains("//"))
                                    //            {
                                    //                data = ("http" + itemData).Replace(" span ", string.Empty);
                                    //                if (!text.Contains(itemData.Replace(" ", "")))// && !data.Contains("class") && !text.Contains(data))
                                    //                {
                                    //                    text += data.Replace("u003c", string.Empty).Replace("u003e", string.Empty);
                                    //                }
                                    //            }
                                    //            else
                                    //            {
                                    //                if (!text.Contains(itemData.Replace(" ", "")))
                                    //                {
                                    //                    text += itemData.Replace("u003c", string.Empty).Replace("u003e", string.Empty).Replace("js-tweet-text tweet-text", "");
                                    //                }
                                    //            }
                                    //        }
                                    //    }
                                    //}
                                    //catch { };
                                    
                                    #endregion


                                    twtboardpro.TwitterDataScrapper.StructTweetIDs structTweetIDs = new twtboardpro.TwitterDataScrapper.StructTweetIDs();

                                    if (id != "null")
                                    {
                                        structTweetIDs.ID_Tweet = tweetUserid;
                                        structTweetIDs.ID_Tweet_User = id;
                                        structTweetIDs.username__Tweet_User = from_user_id;
                                        structTweetIDs.wholeTweetMessage = text;
                                        lst_structTweetIDs.Add(structTweetIDs);
                                    }


                                    //if (!File.Exists(Globals.Path_KeywordScrapedListData + "-" + keyword + ".csv"))
                                    //{
                                    //    GlobusFileHelper.AppendStringToTextfileNewLine("USERID , USERNAME , PROFILE NAME , BIO , LOCATION , WEBSITE , NO OF TWEETS , FOLLOWERS , FOLLOWINGS", Globals.Path_KeywordScrapedListData + "-" + keyword + ".csv");
                                    //}

                                    {

                                        ChilkatHttpHelpr objChilkat = new ChilkatHttpHelpr();
                                        GlobusHttpHelper HttpHelper = new GlobusHttpHelper();
                                        string ProfilePageSource = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/" + from_user_id), "", "");

                                        string Responce = ProfilePageSource;

                                        #region Convert HTML to XML

                                        string xHtml = objChilkat.ConvertHtmlToXml(Responce);
                                        Chilkat.Xml xml = new Chilkat.Xml();
                                        xml.LoadXml(xHtml);

                                        Chilkat.Xml xNode = default(Chilkat.Xml);
                                        Chilkat.Xml xBeginSearchAfter = default(Chilkat.Xml);
                                        #endregion

                                        int counterdata = 0;
                                        xBeginSearchAfter = null;
                                        string dataDescription = string.Empty;
                                        xNode = xml.SearchForAttribute(xBeginSearchAfter, "h1", "class", "ProfileHeaderCard-name");
                                        while ((xNode != null))
                                        {
                                            xBeginSearchAfter = xNode;
                                            if (counterdata == 0)
                                            {
                                                ProfileName = xNode.AccumulateTagContent("text", "script|style");
                                                counterdata++;
                                            }
                                            else if (counterdata == 1)
                                            {
                                                website = xNode.AccumulateTagContent("text", "script|style");
                                                counterdata++;
                                            }
                                            else
                                            {
                                                break;
                                            }
                                            
                                            xNode = xml.SearchForAttribute(xBeginSearchAfter, "a", "class", "u-textUserColor");
                                        }

                                        xBeginSearchAfter = null;
                                        dataDescription = string.Empty;
                                        xNode = xml.SearchForAttribute(xBeginSearchAfter, "p", "class", "ProfileHeaderCard-bio u-dir");//bio profile-field");
                                        while ((xNode != null))
                                        {
                                            xBeginSearchAfter = xNode;
                                            Bio = xNode.AccumulateTagContent("text", "script|style").Replace("&#39;", "'").Replace("&#13;&#10;", string.Empty).Trim();
                                            break;
                                        }

                                        xBeginSearchAfter = null;
                                        dataDescription = string.Empty;
                                        xNode = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "ProfileHeaderCard-locationText u-dir");//location profile-field");
                                        while ((xNode != null))
                                        {
                                            xBeginSearchAfter = xNode;
                                            Location = xNode.AccumulateTagContent("text", "script|style");
                                            break;
                                        }

                                        int counterData = 0;
                                        xBeginSearchAfter = null;
                                        dataDescription = string.Empty;
                                        xNode = xml.SearchForAttribute(xBeginSearchAfter, "a", "class", "ProfileNav-stat ProfileNav-stat--link u-borderUserColor u-textCenter js-tooltip js-nav");//location profile-field");
                                        while ((xNode != null))
                                        {
                                            xBeginSearchAfter = xNode;
                                            if (counterData == 0)
                                            {
                                                // NoOfTweets = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "ProfileNav-value");
                                                NoOfTweets = xNode.AccumulateTagContent("text", "script|style").Replace("Tweets", string.Empty).Replace(",", string.Empty).Replace("Tweet", string.Empty);
                                                counterData++;
                                            }
                                            else if (counterData == 1)
                                            {
                                                Followings = xNode.AccumulateTagContent("text", "script|style").Replace(" Following", string.Empty).Replace(",", string.Empty).Replace("Following", string.Empty);
                                                counterData++;
                                            }
                                            else if (counterData == 2)
                                            {
                                                Followers = xNode.AccumulateTagContent("text", "script|style").Replace("Followers", string.Empty).Replace(",", string.Empty).Replace("Follower", string.Empty);
                                                counterData++;
                                            }
                                            else
                                            {
                                                break;
                                            }
                                            //xNode = xml.SearchForAttribute(xBeginSearchAfter, "a", "class", "js-nav");
                                            xNode = xml.SearchForAttribute(xBeginSearchAfter, "a", "class", "ProfileNav-stat ProfileNav-stat--link u-borderUserColor u-textCenter js-tooltip js-openSignupDialog js-nonNavigable u-textUserColor");
                                        }


                                        if (!string.IsNullOrEmpty(from_user_id) && tweetUserid != "null")
                                        {
                                            string Id_user = tweetUserid.Replace("}]", string.Empty).Trim();
                                            Globals.lstScrapedUserIDs.Add(Id_user);
                                            // GlobusFileHelper.AppendStringToTextfileNewLine(id + "," + from_user_id + "," + ProfileName + "," + Bio.Replace(",", "") + "," + Location.Replace(",", "") + "," + website + "," + NoOfTweets.Replace(",", "").Replace("Tweets", "") + "," + Followers.Replace(",", "").Replace("Following", "") + "," + Followings.Replace(",", "").Replace("Followers", "").Replace("Follower", ""), Globals.Path_KeywordScrapedListData + "-" + keyword + ".csv");
                                            // Log("[ " + DateTime.Now + " ] => [ " + from_user_id + "," + Id_user + "," + ProfileName + "," + Bio.Replace(",", "") + "," + Location + "," + website + "," + NoOfTweets + "," + Followers + "," + Followings + " ]");
                                        }
                                    }


                                    
                                    lst_structTweetIDs = lst_structTweetIDs.Distinct().ToList();

                                    if (lst_structTweetIDs.Count >= noOfRecords)
                                    {
                                       // return lst_structTweetIDs;
                                    }

                                }

                                if (lst_structTweetIDs.Count <= noOfRecords)
                                {
                                    maxid = lst_structTweetIDs[lst_structTweetIDs.Count - 1].ID_Tweet;

                                    if (res_Get_searchURL.Contains("has_moreitems\":false"))
                                    {
                                       
                                    }
                                    else
                                    {
                                        goto startAgain;
                                    }
                                }
                                else
                                {
                                    if (res_Get_searchURL.Contains("has_more_items\":false"))
                                    {
                                        
                                    }
                                    else
                                        goto startAgain;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    }

                   
                }
            }


            catch
            { }


        }
        public string FormURL(ref LinkedinUser objLinkedinUser)
        {
            GlobusHttpHelper objHttpHelper = objLinkedinUser.globusHttpHelper;
            string           url           = "https://www.linkedin.com/sales/search/?";

            try
            {
                if (!string.IsNullOrEmpty(currentCompany))
                {
                    url = url + "&company=" + currentCompany;
                    // url = url + "&companyScope=" + GlobalsScraper.selectedCurrentPast_Input_SalesNav;
                }


                if (!string.IsNullOrEmpty(relationship))
                {
                    int      i = 0;
                    string[] rawRelationship      = Regex.Split(relationship, ",");
                    string   addRelationshipValue = "facet=N";
                    for (i = 0; i < rawRelationship.Count(); i++)
                    {
                        addRelationshipValue = addRelationshipValue + "&facet.N=" + rawRelationship[i];
                    }
                    url = url + addRelationshipValue;
                }
                if (!string.IsNullOrEmpty(location))
                {
                    string locationResponse = objHttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/ta/region?query=" + Uri.EscapeDataString(location)));
                    string rawLocationValue = Utils.getBetween(locationResponse, "\"id\":\"", "\",\"");
                    url = url + "&facet=G&facet.G=" + rawLocationValue;
                }
                if (!string.IsNullOrEmpty(title))
                {
                    url = url + "&jobTitle=" + title;
                }
                if (!string.IsNullOrEmpty(titleScope))
                {
                    url = url + "&titleScope=" + titleScope;
                }

                if (!string.IsNullOrEmpty(industry))
                {
                    int      i                = 0;
                    string[] rawIndustry      = Regex.Split(industry, ",");
                    string   addIndustryValue = "&facet=I";
                    for (i = 0; i < rawIndustry.Count(); i++)
                    {
                        addIndustryValue = addIndustryValue + "&facet.I=" + rawIndustry[i];
                    }
                    url = url + addIndustryValue;
                }
                if (!string.IsNullOrEmpty(country))
                {
                    //  url = url + "&countryCode=" + SalesNavigatorGlobals.country;
                }
                if (!string.IsNullOrEmpty(within))
                {
                    url = url + "&radiusMiles=" + within;
                }
                if (!string.IsNullOrEmpty(postalCode))
                {
                    url = url + "&postalCode=" + postalCode;
                }
                if (!string.IsNullOrEmpty(firstName))
                {
                    url = url + "&firstName=" + firstName;
                }
                if (!string.IsNullOrEmpty(lastName))
                {
                    url = url + "&lastName=" + lastName;
                }
                if (!string.IsNullOrEmpty(seniorityLevel))
                {
                    int      i = 0;
                    string[] rawSeniorityLevel = Regex.Split(seniorityLevel, ",");
                    string   addSeniorityValue = "&facet=SE";
                    for (i = 0; i < rawSeniorityLevel.Count(); i++)
                    {
                        addSeniorityValue = addSeniorityValue + "&facet.SE=" + rawSeniorityLevel[i];
                    }
                    url = url + addSeniorityValue;
                }
                if (!string.IsNullOrEmpty(function))
                {
                    int      i                = 0;
                    string[] rawFunction      = Regex.Split(function, ",");
                    string   addFunctionValue = "&facet=FA";
                    for (i = 0; i < rawFunction.Count(); i++)
                    {
                        addFunctionValue = addFunctionValue + "&facet.FA=" + rawFunction[i];
                    }
                    url = url + addFunctionValue;
                }
                if (!string.IsNullOrEmpty(companySize))
                {
                    int      i = 0;
                    string[] rawCompanySize      = Regex.Split(companySize, ",");
                    string   addCompanySizeValue = "&facet=CS";
                    for (i = 0; i < rawCompanySize.Count(); i++)
                    {
                        addCompanySizeValue = addCompanySizeValue + "&facet.CS=" + rawCompanySize[i];
                    }
                    url = url + addCompanySizeValue;
                }
                if (!string.IsNullOrEmpty(yearOfExperience))
                {
                    int      i = 0;
                    string[] rawYearsOfExperience      = Regex.Split(yearOfExperience, ",");
                    string   addYearsOfExperienceValue = "&facet=TE";
                    for (i = 0; i < rawYearsOfExperience.Count(); i++)
                    {
                        addYearsOfExperienceValue = addYearsOfExperienceValue + "&facet.TE=" + rawYearsOfExperience[i];
                    }
                    url = url + addYearsOfExperienceValue;
                }
                if (!string.IsNullOrEmpty(language))
                {
                    int      i                = 0;
                    string[] rawlanguage      = Regex.Split(language, ",");
                    string   addLanguageValue = "&facet=L";
                    for (i = 0; i < rawlanguage.Count(); i++)
                    {
                        addLanguageValue = addLanguageValue + "&facet.L=" + rawlanguage[i];
                    }
                    url = url + addLanguageValue;
                }
                if (!string.IsNullOrEmpty(whenJoined))
                {
                    int      i                  = 0;
                    string[] rawWhenJoined      = Regex.Split(whenJoined, ",");
                    string   addWhenJoinedValue = "&facet=DR";
                    for (i = 0; i < rawWhenJoined.Count(); i++)
                    {
                        addWhenJoinedValue = addWhenJoinedValue + "&facet.DR=" + rawWhenJoined[i];
                    }
                    url = url + addWhenJoinedValue;
                }
                //url = url + "&defaultSelection=false&start=replaceVariableCounter&count=100";
                url = url + "&defaultSelection=false&start=0&count=10&searchHistoryId=1540160093";


                if (!string.IsNullOrEmpty(keyword))
                {
                    url = url + "&keywords=" + Uri.EscapeDataString(keyword) + "&trk=lss-search-tab";
                }
                else
                {
                    url = url + "&trk=lss-search-tab";
                }
            }
            catch (Exception ex)
            {
            }
            return(url);
        }
		private void FindTheGroupUrls(GlobusHttpHelper chilkatHttpHelper, Dictionary<string, string> CheckDuplicates, string Username, int GetCountMember, string keyword)
		{

			try
			{
				lstThreadsGroupMemberScraper.Add(Thread.CurrentThread);
				lstThreadsGroupMemberScraper.Distinct();
				Thread.CurrentThread.IsBackground = true;
			}
			catch (Exception ex)
			{
				Console.WriteLine("Error : " + ex.StackTrace);
			}

			try
			{
				string strKeyword = keyword;
				string strGroupUrl = FBGlobals.Instance.fbfacebookSearchPhpQUrl + strKeyword + "&init=quick&type=groups";   // "https://www.facebook.com/search.php?q="
				strGroupUrl = "https://www.facebook.com/search/results/?q="+strKeyword+"&type=groups";
				string __user = "";
				string fb_dtsg = "";

				string pgSrc_FanPageSearch = chilkatHttpHelper.getHtmlfromUrl(new Uri(strGroupUrl),"","");



				__user = GlobusHttpHelper.GetParamValue(pgSrc_FanPageSearch, "user");
				if (string.IsNullOrEmpty(__user))
				{
					__user = GlobusHttpHelper.ParseJson(pgSrc_FanPageSearch, "user");
				}

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

				List<string> pagesList = GetGroups_FBSearch(pgSrc_FanPageSearch);


				List<string> distinctPages = pagesList.Distinct().ToList();
				foreach (string distpage in distinctPages)
				{
					try
					{
						string distpage1 = distpage.Replace("d", "groups/");
						sgroupid.Add(distpage1);
					}
					catch (Exception ex)
					{
						Console.WriteLine("Error : " + ex.StackTrace);
					}
				}
				string ajaxRequestURL = GetAjaxURL_MoreResults(pgSrc_FanPageSearch);



				List<string> list = new List<string>();
				List<string> lstLinkData = new List<string>();


				/*
				if(!String.IsNullOrEmpty(ajaxRequestURL))
				{
				ajaxRequestURL = FBGlobals.Instance.fbhomeurl + ajaxRequestURL + "&__a=1&__user="******"";   // "https://www.facebook.com/" 
				ajaxRequestURL = Uri.UnescapeDataString(ajaxRequestURL) + "&init=quick";

				string res_ajaxRequest = chilkatHttpHelper.getHtmlfromUrl(new Uri(ajaxRequestURL),"","");
				string[] Linklist = System.Text.RegularExpressions.Regex.Split(res_ajaxRequest, "href=");

				try
				{
					foreach (string itemurl in Linklist)
					{
						try
						{
							if (!itemurl.Contains("<!DOCTYPE html"))
							{
								if (!itemurl.Contains(@"http:\/\/www.facebook.com"))
								{
									lstLinkData.Add(itemurl);
									string strLink = itemurl.Substring(0, 70);

									if (strLink.Contains("group") && strLink.Contains("onclick"))
									{
										try
										{
											string[] tempArr = strLink.Split('"');
											string temp = tempArr[1];
											temp = temp.Replace("\\", "");
											temp = "https://www.facebook.com" + temp;   // "" 
											list.Add(temp);
										}
										catch (Exception ex)
										{
											Console.WriteLine("Error : " + ex.StackTrace);
										}
									}
								}
							}
						}
						catch (Exception ex)
						{
							Console.WriteLine("Error : " + ex.StackTrace);
						}
					}
				}
			
				catch (Exception ex)
				{
					Console.WriteLine("Error : " + ex.StackTrace);
				}




				}


*/


				string[] PageSplit  = {};

				if(true)
				{
					try{
						PageSplit = Regex.Split(pgSrc_FanPageSearch,"group_id");
					}
					catch{};

					if(PageSplit.Count()!=1)
					{

						try
						{
							List<string> PageSplitList = PageSplit.ToList();
							PageSplitList.RemoveAt(0);
							foreach(string item in PageSplitList)
							{
								if(item.Contains("<!DOCTYPE html>"))
								{
									continue;
								}

								list = list.Distinct().ToList();
								if(GroupManager.noOfGroupsToScrap <= list.Count())
								{
									break;
								}



								string groupId = FBUtils.getBetween(item,"=","\"");
								if(!string.IsNullOrEmpty(groupId))
								{
									list.Add("https://www.facebook.com/groups/" +groupId);
									AddToLogger_GroupManager("Added Group Id : " +  groupId);	
								}
							}

						}
						catch{};
					}


					else
					{

						try
						{
							try
							{
								PageSplit = Regex.Split(pgSrc_FanPageSearch,"<a href=\"/groups");
							}
							catch{};
							List<string> PageSplitList = PageSplit.ToList();
							PageSplitList.RemoveAt(0);
							foreach(string item in PageSplitList)
							{
								if(item.Contains("<!DOCTYPE html>"))
								{
									continue;
								}

								list = list.Distinct().ToList();
								if(GroupManager.noOfGroupsToScrap <= list.Count())
								{
									break;
								}



								string groupId = FBUtils.getBetween(item,"/","/");
								if(!string.IsNullOrEmpty(groupId))
								{
									list.Add("https://www.facebook.com/groups/" +groupId);
									AddToLogger_GroupManager("Added Group Id : " +  groupId);	
								}
							}

						}
						catch{};
					}

					int countForlistIteminPrvious =0;
					int countFormaximumScrap = 0;
					while(true)
					{
						countFormaximumScrap++;
						if(GroupManager.noOfGroupsToScrap<=countFormaximumScrap)
						{
							AddToLogger_GroupManager("No. of Groups Found To Scrape : " +  list.Count());
							break;							
						}
						list = list.Distinct().ToList();
						countForlistIteminPrvious = list.Count();

						try
						{

							if(GroupManager.noOfGroupsToScrap <= list.Count())
							{
								AddToLogger_GroupManager("No of Groups Found To Scrape : " +  list.Count());
								break;
							}

							PageSplit = Regex.Split(pgSrc_FanPageSearch,"rel=\"ajaxify\"");  //rel=\"ajaxify\"

							if(PageSplit.Count()==1)
							{
								string splitIt = "&amp;offset=";
								PageSplit = Regex.Split(pgSrc_FanPageSearch,splitIt);  //rel=\"ajaxify\"

								if(PageSplit.Count()==1)
								{
									AddToLogger_GroupManager("All Group Id Scraped ");
									break;
								}


								if(PageSplit.Count()>1)
								{

									PageSplit[1]  =  "/search/results/more/?q=" + strKeyword + "&amp;offset=" + PageSplit[1] ;
									ajaxRequestURL = FBUtils.getBetween(PageSplit[1],"","\\\"");

								}

							}
							else
							{

								ajaxRequestURL = FBUtils.getBetween(PageSplit[1],"href=\"","\"");
							}

							ajaxRequestURL = ajaxRequestURL.Replace("amp;","").Replace("type=all","type=groups").Replace("\\","%2C").Replace("u00252C","");

							ajaxRequestURL = "https://www.facebook.com" +  ajaxRequestURL + "&__user="******"&__a=1&__dyn=7AmajEyl35xKt2u6aEyx90BCxO4oKAdDgZ9LHwxBxCbzEeAq68K5Uc-dwIxbxjx27W88y98uyk4EKUyVWz9E&__req=c&__rev=" +  FBUtils.getBetween(PageSplit[1],"revision\":",",");

							pgSrc_FanPageSearch =  chilkatHttpHelper.getHtmlfromUrl(new Uri(ajaxRequestURL),"","");
							string allListGroup  = FBUtils.getBetween(pgSrc_FanPageSearch,"&quot;ents&quot;:&quot;","&quot");
							string[] Linklist = System.Text.RegularExpressions.Regex.Split(allListGroup, ",");
							foreach(string item in Linklist)
							{

								list = list.Distinct().ToList();
								if(GroupManager.noOfGroupsToScrap <= list.Count())
								{
									break;
								}


								try
								{
									if(!string.IsNullOrEmpty(item) && item.Count() < 20)
									{
										list.Add("https://www.facebook.com/groups/"+item);
										AddToLogger_GroupManager("Added Group Id : " +  item);	

									}
								}
								catch{};

							}
							if(countForlistIteminPrvious==list.Count())
							{
								AddToLogger_GroupManager("No of Groups Found To Scrape  : " +  list.Count());
								break;
							}
							list = list.Distinct().ToList();

						}
						catch{};
					}


				}

				list = list.Distinct().ToList();



				sgroupid.AddRange(list);
				//}
				foreach (string lsturl in sgroupid)
				{
					try
					{
						string findstatus = chilkatHttpHelper.getHtmlfromUrl(new Uri(lsturl),"","");


						GetCountMember = GetMemberCounts(GetCountMember, findstatus);

						//if (GroupUrlScraperCheckMembersMin <= GetCountMember && GroupUrlScraperCheckMembersMax >= GetCountMember)
						{
							List<string> GroupType =new List<string>();
							List<string> Groupmember = new List<string>();
							List<string> GroupName=new List<string>();



							try
							{
								if (GroupType[0].Contains("Closed Group"))
								{
									try
									{
										string[] owner = Regex.Split(findstatus, "uiInfoTable mtm profileInfoTable uiInfoTableFixed noBorder");

										string[] ownerlink = Regex.Split(owner[1], "uiProfilePortrait");

										if (ownerlink[0].Contains("Admins"))
										{
											string stradminlink = ownerlink[1].Substring(ownerlink[1].IndexOf("href=\""), (ownerlink[1].IndexOf(">", ownerlink[1].IndexOf("href=\"")) - ownerlink[1].IndexOf("href=\""))).Replace("href=\"", string.Empty).Replace("\"", string.Empty).Trim();
											string stradminname = ownerlink[1].Substring(ownerlink[1].IndexOf("/>"), (ownerlink[1].IndexOf("</a>", ownerlink[1].IndexOf("/>")) - ownerlink[1].IndexOf("/>"))).Replace("/>", string.Empty).Replace("\"", string.Empty).Trim();
										}
									}
									catch (Exception ex)
									{
										Console.WriteLine("Error : " + ex.StackTrace);
									}
								}
							}
							catch (Exception ex)
							{
								Console.WriteLine("Error : " + ex.StackTrace);
							}

							string NoOfGroupMember = string.Empty;
							if (Groupmember!=null)
							{


								foreach (string item in Groupmember)
								{
									try
									{
										if (!item.Contains("Facebook © 2012 English (US)") && item.Contains("members"))
										{
											NoOfGroupMember = item;
										}
									}
									catch (Exception ex)
									{
										Console.WriteLine("Error : " + ex.StackTrace);
									}

								}
							}
							if (findstatus.Contains("uiHeaderActions fsm fwn fcg"))
							{
								string[] Arr = System.Text.RegularExpressions.Regex.Split(findstatus,"uiHeaderActions fsm fwn fcg");
								if (Arr.Count()==3)
								{
									try
									{
										NoOfGroupMember = GlobusHttpHelper.getBetween(Arr[2], "/\">", "members</a>").Replace(",", string.Empty);
									}
									catch (Exception ex)
									{
										Console.WriteLine("Error : " + ex.StackTrace);
									}
								}

							}
							if (string.IsNullOrEmpty(NoOfGroupMember))
							{
								string[] Arr = System.Text.RegularExpressions.Regex.Split(findstatus, "uiHeader uiHeaderTopAndBottomBorder uiHeaderSection");

								try
								{
									NoOfGroupMember = GlobusHttpHelper.getBetween(Arr[1], "Members (", ")</h3>").Replace(",", string.Empty);
								}
								catch (Exception ex)
								{
									Console.WriteLine("Error : " + ex.StackTrace);
								}
							}

							string fanpageTitle = "";
							if(findstatus.Contains("id=\"pageTitle\">"))
							{
								try
								{
									fanpageTitle = FBUtils.getBetween(findstatus,"id=\"pageTitle\">","</title>");
								}
								catch{};

							}

							string fanpageCatagory = "";
							if(findstatus.Contains("_5mo6"))
							{
								try
								{

									string[] fanpageCatagoryList = Regex.Split(findstatus,"_5mo6");
									fanpageCatagory = FBUtils.getBetween(fanpageCatagoryList[1],">","<");
								}
								catch{};

							}


							if(fanpageTitle.Contains("&amp"))
							{
								fanpageTitle = fanpageTitle.Replace("&amp" , "");
							}


							string groupType =string.Empty;
							try
							{
								groupType = GroupType[0];
							}
							catch (Exception ex)
							{
								Console.WriteLine("Error : " + ex.StackTrace);
							}

							//if (CheckScrapeOpenGroupUrlsScraper)
							{
								try
								{
									//	if (groupType.Contains("Open group") || groupType.Contains("Open Group") || groupType.Contains("Public Group"))
									{
										//objclsgrpmngr.InsertGroupUrl(strKeyword, lsturl, groupType, Selectedusername);

										AddToLogger_GroupManager("Scraped GroupUrl Is :" + lsturl + "  GroupMember : " + GetCountMember + " Keyword : " + strKeyword + "UserName : "******" fanpageTitle : " + fanpageTitle + "fanpageCatagory : " + fanpageCatagory);

										try
										{

											if (!string.IsNullOrEmpty(ExportFilePathGroupMemberScraperByKeyWords))
											{
												//StreamReader  objStreamReader = new StreamReader(ExportFilePathGroupMemberScraperByKeyWords,Encoding.GetEncoding(1250));
												//string ReadExportFilePathGroupMemberScraperByKeyWords = objStreamReader.ReadToEnd();
												//objStreamReader.Close();
												List<string> lst_wholeDataOfCsv = 	Globussoft.GlobusFileHelper.readcsvfile(ExportFilePathGroupMemberScraperByKeyWords);
												string wholeDataOfCsv="";
												foreach(string str in lst_wholeDataOfCsv)
												{
													wholeDataOfCsv = wholeDataOfCsv + str;

												}
												if(!wholeDataOfCsv.Contains(lsturl))
												{




													string Grppurl = string.Empty;
													string Grpkeyword = string.Empty;
													string GrpTypes = string.Empty;

													Grppurl = lsturl;
													Grpkeyword = strKeyword;
													GrpTypes = groupType;


													try
													{
														CheckDuplicates.Add(Grppurl, Grppurl);


														string CSVHeader = "GroupUrl" + "," + "SearchKeyword" + "," + "NumberOfMember" + "," + "PageTitle" + "," + "PageCatagory";
														string CSV_Content = Grppurl.Replace(",","") + "," + Grpkeyword.Replace(",","") + ", "  + GetCountMember+ ","   + fanpageTitle.Replace(",","") + ", "  + fanpageCatagory.Replace(",","");

														string Txt_Content = Grppurl + "\t\t\t" + "," + Grpkeyword + "\t\t\t" +  "," + GetCountMember;

														Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, ExportFilePathGroupMemberScraperByKeyWords);   //FBGlobals.path_LinuxSuccessFullyLike

														//Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(Txt_Content, ExportFilePathGroupMemberScraperTxt);
														AddToLogger_GroupManager("Data Export In csv File !" + CSV_Content);



													}
													catch (Exception ex)
													{
														Console.WriteLine("Error : " + ex.StackTrace);
													}
												}
												else
												{
													AddToLogger_GroupManager("Data Aleady Exist in the csv path !");
												}
											}
										}
										catch (Exception ex)
										{
											Console.WriteLine("Error : " + ex.StackTrace);
										}

									}

								}
								catch (Exception ex)
								{
									Console.WriteLine("Error : " + ex.StackTrace);
								}


							}


							/*	if (CheckScrapeCloseGroupUrlsScraper)
							{
								if (groupType.Contains("Closed Group") || groupType.Contains("Closed Group"))
								{
									//  objclsgrpmngr.InsertGroupUrl(strKeyword, lsturl, groupType, Selectedusername);
									AddToLogger_GroupManager("Scrap GroupUrl Is :" + lsturl + "  GroupMember : " + GetCountMember + " Keyword : " + strKeyword + "UserName : "******"GroupUrl" + "," + "Groupkeyword" + ", " + "GroupTypes" + "," + "NumberOfMember";
												string CSV_Content = Grppurl + "," + Grpkeyword + ", " + GrpTypes + "," + GetCountMember;

												string Txt_Content = Grppurl + "\t\t\t" + "," + Grpkeyword + "\t\t\t" + ", " + GrpTypes + "\t\t\t" + "," + GetCountMember;

												//Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, ExportFilePathGroupMemberScraperByKeyWords);

												//Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(Txt_Content, ExportFilePathGroupMemberScraperTxt);
												AddToLogger_GroupManager("Data Export In csv File !" + CSV_Content);



											}
											catch (Exception ex)
											{
												Console.WriteLine("Error : " + ex.StackTrace);
											}
										}
									}
									catch (Exception ex)
									{
										Console.WriteLine("Error : " + ex.StackTrace);
									}

								}
							}*/
							/*try
							{

								if (!string.IsNullOrEmpty(ExportFilePathGroupMemberScraperByKeyWords) && CheckScrapeCloseGroupUrlsScraper == false && CheckScrapeOpenGroupUrlsScraper == false)
								{
									string Grppurl = string.Empty;
									string Grpkeyword = string.Empty;
									string GrpTypes = string.Empty;

									Grppurl = lsturl;
									Grpkeyword = strKeyword;
									GrpTypes = groupType;                              


									try
									{
										CheckDuplicates.Add(Grppurl, Grppurl);

										AddToLogger_GroupManager("Scrap GroupUrl Is :" + lsturl + "  GroupMember : " + GetCountMember + " Keyword : " + strKeyword + "UserName : "******"GroupUrl" + "," + "Groupkeyword" + ", " + "GroupTypes" + "," + "NumberOfMember";
										string CSV_Content = Grppurl + "," + Grpkeyword + ", " + GrpTypes + "," + GetCountMember;

										string Txt_Content = Grppurl + "\t\t\t" + "," + Grpkeyword + "\t\t\t" + ", " + GrpTypes + "\t\t\t" + "," + GetCountMember;

										//Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, ExportFilePathGroupMemberScraperByKeyWords);

										//Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(Txt_Content, ExportFilePathGroupMemberScraperTxt);
										AddToLogger_GroupManager("Data Export In csv File !" + CSV_Content);

									}
									catch (Exception ex)
									{
										Console.WriteLine("Error : " + ex.StackTrace);
									}
								}
							}
							catch (Exception ex)
							{
								Console.WriteLine("Error : " + ex.StackTrace);
							}  */                   
						}
					}
					catch (Exception ex)
					{
						Console.WriteLine("Error : " + ex.StackTrace);
					}
				}
			}
			catch (Exception ex)
			{
				Console.WriteLine("Error : " + ex.StackTrace);
			}


			//return GetCountMember;
		}
		private void FindTheGroupUrls_Old_Old(GlobusHttpHelper chilkatHttpHelper, Dictionary<string, string> CheckDuplicates, string Username, int GetCountMember, string keyword)
		{

			try
			{
				lstThreadsGroupMemberScraper.Add(Thread.CurrentThread);
				lstThreadsGroupMemberScraper.Distinct();
				Thread.CurrentThread.IsBackground = true;
			}
			catch (Exception ex)
			{
				Console.WriteLine("Error : " + ex.StackTrace);
			}

			try
			{
				string strKeyword = keyword;
				string strGroupUrl = FBGlobals.Instance.fbfacebookSearchPhpQUrl + strKeyword + "&init=quick&type=groups";   // "https://www.facebook.com/search.php?q="

				string __user = "";
				string fb_dtsg = "";

				string pgSrc_FanPageSearch = chilkatHttpHelper.getHtmlfromUrl(new Uri(strGroupUrl),"","");



				__user = GlobusHttpHelper.GetParamValue(pgSrc_FanPageSearch, "user");
				if (string.IsNullOrEmpty(__user))
				{
					__user = GlobusHttpHelper.ParseJson(pgSrc_FanPageSearch, "user");
				}

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

				List<string> pagesList = GetGroups_FBSearch(pgSrc_FanPageSearch);


				List<string> distinctPages = pagesList.Distinct().ToList();
				foreach (string distpage in distinctPages)
				{
					try
					{
						string distpage1 = distpage.Replace("d", "groups/");
						sgroupid.Add(distpage1);
					}
					catch (Exception ex)
					{
						Console.WriteLine("Error : " + ex.StackTrace);
					}
				}
				string ajaxRequestURL = GetAjaxURL_MoreResults(pgSrc_FanPageSearch);
				ajaxRequestURL = FBGlobals.Instance.fbhomeurl + ajaxRequestURL + "&__a=1&__user="******"";   // "https://www.facebook.com/" 
				ajaxRequestURL = Uri.UnescapeDataString(ajaxRequestURL) + "&init=quick";

				string res_ajaxRequest = chilkatHttpHelper.getHtmlfromUrl(new Uri(ajaxRequestURL),"","");
				string[] Linklist = System.Text.RegularExpressions.Regex.Split(res_ajaxRequest, "href=");
				List<string> list = new List<string>();
				List<string> lstLinkData = new List<string>();


				try
				{
					foreach (string itemurl in Linklist)
					{
						try
						{
							if (!itemurl.Contains("<!DOCTYPE html"))
							{
								if (!itemurl.Contains(@"http:\/\/www.facebook.com"))
								{
									lstLinkData.Add(itemurl);
									string strLink = itemurl.Substring(0, 70);

									if (strLink.Contains("group") && strLink.Contains("onclick"))
									{
										try
										{
											string[] tempArr = strLink.Split('"');
											string temp = tempArr[1];
											temp = temp.Replace("\\", "");
											temp = "https://www.facebook.com" + temp;   // "" 
											list.Add(temp);
										}
										catch (Exception ex)
										{
											Console.WriteLine("Error : " + ex.StackTrace);
										}
									}
								}
							}
						}
						catch (Exception ex)
						{
							Console.WriteLine("Error : " + ex.StackTrace);
						}
					}
				}
				catch (Exception ex)
				{
					Console.WriteLine("Error : " + ex.StackTrace);
				}


				list = list.Distinct().ToList();

				sgroupid.AddRange(list);
				//}
				foreach (string lsturl in sgroupid)
				{
					try
					{
						string findstatus = chilkatHttpHelper.getHtmlfromUrl(new Uri(lsturl),"","");


						GetCountMember = GetMemberCounts(GetCountMember, findstatus);

						//if (GroupUrlScraperCheckMembersMin <= GetCountMember && GroupUrlScraperCheckMembersMax >= GetCountMember)
						{
							List<string> GroupType =new List<string>();
							List<string> Groupmember = new List<string>();
							List<string> GroupName=new List<string>();



							try
							{
								if (GroupType[0].Contains("Closed Group"))
								{
									try
									{
										string[] owner = Regex.Split(findstatus, "uiInfoTable mtm profileInfoTable uiInfoTableFixed noBorder");

										string[] ownerlink = Regex.Split(owner[1], "uiProfilePortrait");

										if (ownerlink[0].Contains("Admins"))
										{
											string stradminlink = ownerlink[1].Substring(ownerlink[1].IndexOf("href=\""), (ownerlink[1].IndexOf(">", ownerlink[1].IndexOf("href=\"")) - ownerlink[1].IndexOf("href=\""))).Replace("href=\"", string.Empty).Replace("\"", string.Empty).Trim();
											string stradminname = ownerlink[1].Substring(ownerlink[1].IndexOf("/>"), (ownerlink[1].IndexOf("</a>", ownerlink[1].IndexOf("/>")) - ownerlink[1].IndexOf("/>"))).Replace("/>", string.Empty).Replace("\"", string.Empty).Trim();
										}
									}
									catch (Exception ex)
									{
										Console.WriteLine("Error : " + ex.StackTrace);
									}
								}
							}
							catch (Exception ex)
							{
								Console.WriteLine("Error : " + ex.StackTrace);
							}

							string NoOfGroupMember = string.Empty;
							if (Groupmember!=null)
							{


								foreach (string item in Groupmember)
								{
									try
									{
										if (!item.Contains("Facebook © 2012 English (US)") && item.Contains("members"))
										{
											NoOfGroupMember = item;
										}
									}
									catch (Exception ex)
									{
										Console.WriteLine("Error : " + ex.StackTrace);
									}

								}
							}
							if (findstatus.Contains("uiHeaderActions fsm fwn fcg"))
							{
								string[] Arr = System.Text.RegularExpressions.Regex.Split(findstatus,"uiHeaderActions fsm fwn fcg");
								if (Arr.Count()==3)
								{
									try
									{
										NoOfGroupMember = GlobusHttpHelper.getBetween(Arr[2], "/\">", "members</a>").Replace(",", string.Empty);
									}
									catch (Exception ex)
									{
										Console.WriteLine("Error : " + ex.StackTrace);
									}
								}

							}
							if (string.IsNullOrEmpty(NoOfGroupMember))
							{
								string[] Arr = System.Text.RegularExpressions.Regex.Split(findstatus, "uiHeader uiHeaderTopAndBottomBorder uiHeaderSection");

								try
								{
									NoOfGroupMember = GlobusHttpHelper.getBetween(Arr[1], "Members (", ")</h3>").Replace(",", string.Empty);
								}
								catch (Exception ex)
								{
									Console.WriteLine("Error : " + ex.StackTrace);
								}
							}
							string groupType =string.Empty;
							try
							{
								groupType = GroupType[0];
							}
							catch (Exception ex)
							{
								Console.WriteLine("Error : " + ex.StackTrace);
							}

							//if (CheckScrapeOpenGroupUrlsScraper)
							{
								try
								{
									//	if (groupType.Contains("Open group") || groupType.Contains("Open Group") || groupType.Contains("Public Group"))
									{
										//objclsgrpmngr.InsertGroupUrl(strKeyword, lsturl, groupType, Selectedusername);

										AddToLogger_GroupManager("Scrap GroupUrl Is :" + lsturl + "  GroupMember : " + GetCountMember + " Keyword : " + strKeyword + "UserName : "******"";
												foreach(string str in lst_wholeDataOfCsv)
												{
													wholeDataOfCsv = wholeDataOfCsv + str;

												}
												if(!wholeDataOfCsv.Contains(lsturl))
												{




													string Grppurl = string.Empty;
													string Grpkeyword = string.Empty;
													string GrpTypes = string.Empty;

													Grppurl = lsturl;
													Grpkeyword = strKeyword;
													GrpTypes = groupType;


													try
													{
														CheckDuplicates.Add(Grppurl, Grppurl);


														string CSVHeader = "GroupUrl" + "," + "SearchKeyword" + "," + "NumberOfMember";
														string CSV_Content = Grppurl + "," + Grpkeyword + ", "  + GetCountMember;

														string Txt_Content = Grppurl + "\t\t\t" + "," + Grpkeyword + "\t\t\t" +  "," + GetCountMember;

														Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, ExportFilePathGroupMemberScraperByKeyWords);   //FBGlobals.path_LinuxSuccessFullyLike

														//Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(Txt_Content, ExportFilePathGroupMemberScraperTxt);
														AddToLogger_GroupManager("Data Export In csv File !" + CSV_Content);



													}
													catch (Exception ex)
													{
														Console.WriteLine("Error : " + ex.StackTrace);
													}
												}
												else
												{
													AddToLogger_GroupManager("Data Aleady Exist in the csv path !");
												}
											}
										}
										catch (Exception ex)
										{
											Console.WriteLine("Error : " + ex.StackTrace);
										}

									}

								}
								catch (Exception ex)
								{
									Console.WriteLine("Error : " + ex.StackTrace);
								}


							}


							/*	if (CheckScrapeCloseGroupUrlsScraper)
							{
								if (groupType.Contains("Closed Group") || groupType.Contains("Closed Group"))
								{
									//  objclsgrpmngr.InsertGroupUrl(strKeyword, lsturl, groupType, Selectedusername);
									AddToLogger_GroupManager("Scrap GroupUrl Is :" + lsturl + "  GroupMember : " + GetCountMember + " Keyword : " + strKeyword + "UserName : "******"GroupUrl" + "," + "Groupkeyword" + ", " + "GroupTypes" + "," + "NumberOfMember";
												string CSV_Content = Grppurl + "," + Grpkeyword + ", " + GrpTypes + "," + GetCountMember;

												string Txt_Content = Grppurl + "\t\t\t" + "," + Grpkeyword + "\t\t\t" + ", " + GrpTypes + "\t\t\t" + "," + GetCountMember;

												//Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, ExportFilePathGroupMemberScraperByKeyWords);

												//Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(Txt_Content, ExportFilePathGroupMemberScraperTxt);
												AddToLogger_GroupManager("Data Export In csv File !" + CSV_Content);



											}
											catch (Exception ex)
											{
												Console.WriteLine("Error : " + ex.StackTrace);
											}
										}
									}
									catch (Exception ex)
									{
										Console.WriteLine("Error : " + ex.StackTrace);
									}

								}
							}*/
							/*try
							{

								if (!string.IsNullOrEmpty(ExportFilePathGroupMemberScraperByKeyWords) && CheckScrapeCloseGroupUrlsScraper == false && CheckScrapeOpenGroupUrlsScraper == false)
								{
									string Grppurl = string.Empty;
									string Grpkeyword = string.Empty;
									string GrpTypes = string.Empty;

									Grppurl = lsturl;
									Grpkeyword = strKeyword;
									GrpTypes = groupType;                              


									try
									{
										CheckDuplicates.Add(Grppurl, Grppurl);

										AddToLogger_GroupManager("Scrap GroupUrl Is :" + lsturl + "  GroupMember : " + GetCountMember + " Keyword : " + strKeyword + "UserName : "******"GroupUrl" + "," + "Groupkeyword" + ", " + "GroupTypes" + "," + "NumberOfMember";
										string CSV_Content = Grppurl + "," + Grpkeyword + ", " + GrpTypes + "," + GetCountMember;

										string Txt_Content = Grppurl + "\t\t\t" + "," + Grpkeyword + "\t\t\t" + ", " + GrpTypes + "\t\t\t" + "," + GetCountMember;

										//Globussoft.GlobusFileHelper.ExportDataCSVFile(CSVHeader, CSV_Content, ExportFilePathGroupMemberScraperByKeyWords);

										//Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(Txt_Content, ExportFilePathGroupMemberScraperTxt);
										AddToLogger_GroupManager("Data Export In csv File !" + CSV_Content);

									}
									catch (Exception ex)
									{
										Console.WriteLine("Error : " + ex.StackTrace);
									}
								}
							}
							catch (Exception ex)
							{
								Console.WriteLine("Error : " + ex.StackTrace);
							}  */                   
						}
					}
					catch (Exception ex)
					{
						Console.WriteLine("Error : " + ex.StackTrace);
					}
				}
			}
			catch (Exception ex)
			{
				Console.WriteLine("Error : " + ex.StackTrace);
			}


			//return GetCountMember;
		}
        public void ScrapeProfileDetails(ref GlobusHttpHelper objHttpHelper, List <string> ProfileUrls)
        {
            foreach (string profileURL in ProfileUrls)
            {
                try
                {
                    CheckDuplicate.Add(profileURL, profileURL);
                }
                catch (Exception)
                {
                    continue;
                }

                string name                = string.Empty;
                string memberID            = string.Empty;
                string imageUrl            = string.Empty;
                string connection          = string.Empty;
                string location            = string.Empty;
                string industry            = string.Empty;
                string headlineTitle       = string.Empty;
                string currentTitle        = string.Empty;
                string pastTitles          = string.Empty;
                string currentCompany      = string.Empty;
                string pastCompanies       = string.Empty;
                string skills              = string.Empty;
                string numberOfConnections = string.Empty;
                string education           = string.Empty;
                string email               = string.Empty;
                string phoneNumber         = string.Empty;
                //if (SalesNavigatorGlobals.isStop)
                //{
                //    return;
                //}
                try
                {
                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Scraping profile details of profile url : " + profileURL + " ]");

                    string pgSource = objHttpHelper.getHtmlfromUrl(new Uri(profileURL));
                    if (string.IsNullOrEmpty(pgSource))
                    {
                        pgSource = objHttpHelper.getHtmlfromUrl(new Uri(profileURL));
                    }
                    if (!pgSource.Contains("\"profile\":"))
                    {
                        Thread.Sleep(2000);
                        pgSource = objHttpHelper.getHtmlfromUrl(new Uri(profileURL));
                    }

                    name = GetName(pgSource);

                    memberID = Utils.getBetween(profileURL, "profile/", ",").Trim();

                    imageUrl = GetImageUrl(pgSource);

                    email = GetEmail(pgSource);

                    phoneNumber = GetPhoneNumber(pgSource);

                    connection = GetConnection(pgSource);

                    location = GetLocation(pgSource);

                    industry = GetIndustry(pgSource);

                    headlineTitle = GetHeadlineTitle(pgSource);

                    headlineTitle = headlineTitle.Replace("\\u002d", string.Empty);

                    string allTitles = GetAllTitle(pgSource).Replace("d/b/a", string.Empty).Replace("&amp;", string.Empty); //title at company : title at company : title at company

                    try
                    {
                        string[] titles = Regex.Split(allTitles, " : ");

                        currentTitle = Utils.getBetween(titles[0], "", " at ");

                        foreach (string item in titles)
                        {
                            if (string.IsNullOrEmpty(pastTitles))
                            {
                                pastTitles = Utils.getBetween(item, "", " at ");
                            }
                            else
                            {
                                pastTitles = pastTitles + ":" + Utils.getBetween(item, "", " at ");
                            }
                        }


                        currentCompany = Utils.getBetween(titles[0] + "@", " at ", "@").Replace("d/b/a", string.Empty);

                        foreach (string item in titles)
                        {
                            if (string.IsNullOrEmpty(pastCompanies))
                            {
                                pastCompanies = Utils.getBetween(item + "@", " at ", "@").Replace("d/b/a", string.Empty);
                            }
                            else
                            {
                                if (!pastCompanies.Contains(Utils.getBetween(item + "@", " at ", "@")))
                                {
                                    pastCompanies = pastCompanies + ":" + Utils.getBetween(item + "@", " at ", "@").Replace("d/b/a", string.Empty);
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                    }

                    skills = GetSkills(pgSource);

                    numberOfConnections = GetNumberOfConnections(pgSource);

                    education = GetEducation(pgSource);
                }
                catch (Exception ex)
                {
                }
                lstProfileUrls.Remove(profileURL);

                WriteDataToCSV(name, profileURL, memberID, connection, location, industry, headlineTitle, currentTitle, pastTitles, currentCompany, pastCompanies, skills, numberOfConnections, education, email, phoneNumber);
            }
        }
        public void GetMultipleRecords(ref GlobusHttpHelper HttpHelper)
        {
            try
            {
                string csrfToken      = string.Empty;
                string LastName       = string.Empty;
                string FirstName      = string.Empty;
                string Industry       = string.Empty;
                string Postalcode     = string.Empty;
                string Distance       = string.Empty;
                string contentSummary = string.Empty;
                string Title          = string.Empty;
                string Company        = string.Empty;
                string school         = string.Empty;
                string Country        = string.Empty;
                string countrycode    = string.Empty;
                string industrycode   = string.Empty;
                string rsid           = string.Empty;

                string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));

                try
                {
                    try
                    {
                        string[] Arr_Pst = Regex.Split(postalCode, "(");
                    }
                    catch { }
                    try
                    {
                        Postalcode = postalCode.Substring(0, postalCode.IndexOf(" "));
                        Country    = postalCode.Replace(Postalcode, string.Empty).Replace(")", string.Empty).Replace("(", string.Empty).Trim();
                    }
                    catch
                    {
                        if (Postalcode == string.Empty)
                        {
                            Postalcode = postalCode;
                        }
                    }
                }
                catch { }
                if (pageSource.Contains("csrfToken"))
                {
                    csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 100);
                    string[] Arr = csrfToken.Split('&');
                    csrfToken = Arr[0];
                    csrfToken = csrfToken.Replace("csrfToken=", "");
                    csrfToken = csrfToken.Replace("%3A", ":");
                }
                InBoardPro.GetIndustryCode  objIndustry       = new GetIndustryCode();
                Dictionary <string, string> Dict_IndustryCode = new Dictionary <string, string>();

                Dict_IndustryCode = objIndustry.getIndustry();
                foreach (KeyValuePair <string, string> item in Dict_IndustryCode)
                {
                    try
                    {
                        string toloweritem         = item.Value.ToLower();
                        string tolowerindustrytype = industryType.ToLower();
                        if (toloweritem == tolowerindustrytype)
                        {
                            //SearchCriteria.Country = item.Key;
                            industrycode = item.Key;
                            break;
                        }
                    }
                    catch
                    {
                    }
                }

                Dictionary <string, string> Dict_CountryCode = new Dictionary <string, string>();
                Dict_CountryCode = objIndustry.getCountry();
                foreach (KeyValuePair <string, string> item in Dict_CountryCode)
                {
                    try
                    {
                        string toloweritem        = item.Value.ToLower();
                        string tolowercountrytype = Country.ToLower();
                        if (toloweritem == tolowercountrytype)
                        {
                            countrycode = item.Key;
                            break;
                        }
                    }
                    catch
                    {
                    }
                }
                string Firstresponse = string.Empty;
                if (string.IsNullOrEmpty(countrycode))
                {
                    countrycode = "us";
                }

                string FirstGetRequestUrl = string.Empty;
                string FirstGetResponse   = string.Empty;
                {
                    try
                    {
                        FirstGetRequestUrl = "http://www.linkedin.com/search/fpsearch?lname=" + lastName + "&searchLocationType=I&countryCode=" + countrycode + "&postalCode=" + Postalcode + "&distance=" + distance + "&keepFacets=keepFacets&page_num=1&facet_I=" + industrycode + "&pplSearchOrigin=ADVS&viewCriteria=2&sortCriteria=R&redir=redir";
                        FirstGetResponse   = HttpHelper.getHtmlfromUrl1(new Uri(FirstGetRequestUrl));
                    }
                    catch { }
                }

                int RecordCount = 0;
                try
                {
                    RecordCount = objIndustry.GetPageNo(FirstGetResponse);

                    if (RecordCount == 0)
                    {
                        string getAdvPagedata = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/vsearch/f?adv=true&trk=advsrch"), "http://www.linkedin.com/");

                        try
                        {
                            int    startindex = getAdvPagedata.IndexOf("rsid=");
                            string start      = getAdvPagedata.Substring(startindex).Replace("rsid=", "");
                            int    endindex   = start.IndexOf("&amp;");
                            string end        = start.Substring(0, endindex);
                            rsid = end;
                        }
                        catch (Exception ex)
                        {
                        }

                        try
                        {
                            FirstGetRequestUrl = "http://www.linkedin.com/vsearch/p?lastName=" + lastName + "&postalCode=" + postalCode + "&openAdvancedForm=true&locationType=I&countryCode=" + countrycode + "&distance=" + distance + "&f_I=" + industrycode.Replace(" ", "") + "&rsid=" + rsid + "&orig=ADVS";
                            FirstGetResponse   = HttpHelper.getHtmlfromUrl1(new Uri(FirstGetRequestUrl));
                        }
                        catch { }
                    }

                    RecordCount = objIndustry.GetPageNo(FirstGetResponse);

                    if (lastName != string.Empty && industryType == string.Empty)
                    {
                        Loger("[ " + DateTime.Now + " ] => [ Get RecordCount : " + RecordCount + " Using UserName : "******" Zip Code : " + postalCode.ToString() + " Distance : " + distance + " LastName : " + lastName + " ]");
                    }

                    if (industryType != string.Empty && lastName == string.Empty)
                    {
                        Loger("[ " + DateTime.Now + " ] => [ Get RecordCount : " + RecordCount + " Using UserName : "******" Zip Code : " + postalCode.ToString() + " Distance : " + distance + " Industry : " + industryType + " ]");
                    }

                    if (lastName == string.Empty && industryType == string.Empty)
                    {
                        Loger("[ " + DateTime.Now + " ] => [ Get RecordCount : " + RecordCount + " Using UserName : "******" Zip Code : " + postalCode.ToString() + " Distance : " + distance + " ]");
                    }
                }
                catch { }
                try
                {
                    LinkedinScrappDbManager objLsManager = new LinkedinScrappDbManager();
                    objLsManager.InsertScarppRecordData(Postalcode, distance, industryType, lastName, RecordCount);
                }
                catch { }
                try
                {
                    string prxyadress = string.Empty;
                    try
                    {
                        if (!string.IsNullOrEmpty(proxyAddress) && !string.IsNullOrEmpty(proxyPort))
                        {
                            prxyadress = proxyAddress + ":" + proxyPort;
                        }
                    }
                    catch { }

                    if (lastName != string.Empty && industryType == string.Empty)
                    {
                        string CSVHeader   = "LastName" + "," + "CentralZipCode" + "," + "DistanceFromZipCode" + "," + "Number Of Result" + "," + "UserName" + "," + "Password" + "," + "Proxy" + "," + "ProxyPwd ";
                        string CSV_Content = lastName.ToString().Replace(",", ";") + "," + postalCode.ToString().Replace(",", ";") + "," + distance.ToString().Replace(",", ";") + "," + RecordCount.ToString().Replace(",", ";") + "," + accountUser.Replace(",", ";") + "," + accountPass.Replace(",", ";") + "," + prxyadress.Replace(",", ";") + "," + proxyPassword.Replace(",", ";");
                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_InBoardProGetDataResultCountLastNameWise);
                    }

                    if (industryType != string.Empty && lastName == string.Empty)
                    {
                        string CSVHeader   = "IndustryZone" + "," + "CentralZipCode" + "," + "DistanceFromZipCode" + "," + "Number Of Result" + "," + "UserName" + "," + "Password" + "," + "Proxy" + "," + "ProxyPwd ";
                        string CSV_Content = industryType.ToString().Replace(",", ";") + "," + postalCode.ToString().Replace(",", ";") + "," + distance.ToString().Replace(",", ";") + "," + RecordCount.ToString().Replace(",", ";") + "," + accountUser.Replace(",", ";") + "," + accountPass.Replace(",", ";") + "," + prxyadress.Replace(",", ";") + "," + proxyPassword.Replace(",", ";");
                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_InBoardProGetDataResultCountIndustryZoneWise);
                    }

                    if (lastName == string.Empty && industryType == string.Empty)
                    {
                        string CSVHeader   = "CentralZipCode" + "," + "DistanceFromZipCode" + "," + "Number Of Result" + "," + "UserName" + "," + "Password" + "," + "Proxy" + "," + "ProxyPwd ";
                        string CSV_Content = postalCode.ToString().Replace(",", ";") + "," + distance.ToString().Replace(",", ";") + "," + RecordCount.ToString().Replace(",", ";") + "," + accountUser.Replace(",", ";") + "," + accountPass.Replace(",", ";") + "," + prxyadress.Replace(",", ";") + "," + proxyPassword.Replace(",", ";");
                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_InBoardProGetDataResultCountZipCodeWise);
                    }
                }
                catch { }
            }
            catch { }
        }
        public void scrapUserInfo(object param)
        {
            try
            {
                Array paramsArray = new object[1];

                paramsArray = (Array)param;
                string UserName = (string)paramsArray.GetValue(0);

                string userId       = string.Empty;
                string ProfileName  = string.Empty;
                string Location     = string.Empty;
                string Bio          = string.Empty;
                string website      = string.Empty;
                string NoOfTweets   = string.Empty;
                string Followers    = string.Empty;
                string Followings   = string.Empty;
                string IsProfilePIc = string.Empty;

                ChilkatHttpHelpr objChilkat        = new ChilkatHttpHelpr();
                GlobusHttpHelper HttpHelper        = new GlobusHttpHelper();
                string           ProfilePageSource = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/" + UserName.Trim()), "", "");

                if (string.IsNullOrEmpty(ProfilePageSource))
                {
                    ProfilePageSource = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/" + UserName.Trim()), "", "");
                }
                if (string.IsNullOrEmpty(ProfilePageSource))
                {
                    AddToLog_ScrapMember("[ " + DateTime.Now + " ] => [ User  " + UserName + " is not exist or page source getting null.]");
                    return;
                }

                if (ProfilePageSource.Contains("Account suspended"))
                {
                    AddToLog_ScrapMember("[ " + DateTime.Now + " ] => [ User  " + UserName + " is suspended ]");
                    return;
                }

                string Responce = ProfilePageSource;

                #region Convert HTML to XML

                string      xHtml = objChilkat.ConvertHtmlToXml(Responce);
                Chilkat.Xml xml   = new Chilkat.Xml();
                xml.LoadXml(xHtml);

                Chilkat.Xml xNode             = default(Chilkat.Xml);
                Chilkat.Xml xBeginSearchAfter = default(Chilkat.Xml);
                #endregion

                int counterdata = 0;
                xBeginSearchAfter = null;
                string dataDescription = string.Empty;
                //xNode = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "profile-field");
                xNode = xml.SearchForAttribute(xBeginSearchAfter, "h1", "class", "ProfileHeaderCard-name");
                while ((xNode != null))
                {
                    xBeginSearchAfter = xNode;
                    if (counterdata == 0)
                    {
                        ProfileName = xNode.AccumulateTagContent("text", "script|style");
                        if (ProfileName.Contains("Verified account"))
                        {
                            ProfileName = ProfileName.Replace("Verified account", " ");
                        }
                        counterdata++;
                    }
                    else if (counterdata == 1)
                    {
                        website = xNode.AccumulateTagContent("text", "script|style");
                        if (website.Contains("Twitter Status"))
                        {
                            website = "";
                        }
                        counterdata++;
                    }
                    else
                    {
                        break;
                    }
                    //xNode = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "profile-field");
                    xNode = xml.SearchForAttribute(xBeginSearchAfter, "a", "class", "u-textUserColor");
                }

                xBeginSearchAfter = null;
                dataDescription   = string.Empty;
                xNode             = xml.SearchForAttribute(xBeginSearchAfter, "p", "class", "ProfileHeaderCard-bio u-dir");//bio profile-field");
                while ((xNode != null))
                {
                    xBeginSearchAfter = xNode;
                    Bio = xNode.AccumulateTagContent("text", "script|style").Replace("&#39;", "'").Replace("&#13;&#10;", string.Empty).Trim();
                    break;
                }

                xBeginSearchAfter = null;
                dataDescription   = string.Empty;
                //xNode = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "location profile-field");
                xNode = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "ProfileHeaderCard-locationText u-dir");//location profile-field");
                while ((xNode != null))
                {
                    xBeginSearchAfter = xNode;
                    Location          = xNode.AccumulateTagContent("text", "script|style");
                    break;
                }

                int counterData = 0;
                xBeginSearchAfter = null;
                dataDescription   = string.Empty;
                //xNode = xml.SearchForAttribute(xBeginSearchAfter, "a", "data-element-term", "tweet_stats");
                xNode = xml.SearchForAttribute(xBeginSearchAfter, "a", "class", "ProfileNav-stat ProfileNav-stat--link u-borderUserColor u-textCenter js-tooltip js-nav");
                while ((xNode != null))
                {
                    xBeginSearchAfter = xNode;
                    if (counterData == 0)
                    {
                        NoOfTweets = xNode.AccumulateTagContent("text", "script|style").Replace("Tweets", string.Empty).Replace(",", string.Empty).Replace("Tweet", string.Empty);
                        counterData++;
                    }
                    else if (counterData == 1)
                    {
                        Followings = xNode.AccumulateTagContent("text", "script|style").Replace(" Following", string.Empty).Replace(",", string.Empty).Replace("Following", string.Empty);
                        counterData++;
                    }
                    else if (counterData == 2)
                    {
                        Followers = xNode.AccumulateTagContent("text", "script|style").Replace("Followers", string.Empty).Replace(",", string.Empty).Replace("Follower", string.Empty);
                        counterData++;
                    }
                    else
                    {
                        break;
                    }
                    //xNode = xml.SearchForAttribute(xBeginSearchAfter, "a", "class", "js-nav");
                    xNode = xml.SearchForAttribute(xBeginSearchAfter, "a", "class", "ProfileNav-stat ProfileNav-stat--link u-borderUserColor u-textCenter js-tooltip js-openSignupDialog js-nonNavigable u-textUserColor");
                }

                try
                {
                    int    startindex = ProfilePageSource.IndexOf("profile_id");
                    string start      = ProfilePageSource.Substring(startindex).Replace("profile_id", "");
                    int    endindex   = start.IndexOf(",");
                    string end        = start.Substring(0, endindex).Replace("&quot;", "").Replace("\"", "").Replace(":", "").Trim();
                    userId = end.Trim();
                    if (userId.Length > 15)
                    {
                        startindex = ProfilePageSource.IndexOf("profile_id&quot");
                        start      = ProfilePageSource.Substring(startindex).Replace("profile_id&quot", "");
                        endindex   = start.IndexOf(",");
                        end        = start.Substring(0, endindex).Replace("&quot;", "").Replace("\"", "").Replace(":", "").Replace(";", "").Trim();
                        userId     = end.Trim();
                    }
                }
                catch { }

                if (ProfilePageSource.Contains("default_profile_6_400x400") || ProfilePageSource.Contains("default_profile_5_400x400") || ProfilePageSource.Contains("default_profile_4_400x400") || ProfilePageSource.Contains("default_profile_3_400x400") || ProfilePageSource.Contains("default_profile_2_400x400") || ProfilePageSource.Contains("default_profile_1_400x400") || ProfilePageSource.Contains("default_profile_0_400x400"))
                {
                    IsProfilePIc = "No";
                }
                else
                {
                    IsProfilePIc = "Yes";
                }
                if (!File.Exists(Globals.Path_UserListInfoData))
                {
                    GlobusFileHelper.AppendStringToTextfileNewLine("USERID , USERNAME , PROFILE NAME , BIO , LOCATION , WEBSITE , NO OF TWEETS , FOLLOWERS , FOLLOWINGS, ProfilePic", Globals.Path_UserListInfoData);
                }
                if (!string.IsNullOrEmpty(UserName))
                {
                    //string Id_user = item.ID_Tweet_User.Replace("}]", string.Empty).Trim();
                    //Globals.lstScrapedUserIDs.Add(Id_user);
                    GlobusFileHelper.AppendStringToTextfileNewLine(userId + "," + UserName + "," + ProfileName + "," + Bio.Replace(",", "") + "," + Location.Replace(",", "") + "," + website + "," + NoOfTweets.Replace(",", "").Replace("Tweets", "") + "," + Followers.Replace(",", "").Replace("Following", "") + "," + Followings.Replace(",", "").Replace("Followers", "").Replace("Follower", "") + "," + IsProfilePIc, Globals.Path_UserListInfoData);
                    AddToLog_ScrapMember("[ " + DateTime.Now + " ] => [ " + userId + "," + UserName + "," + ProfileName + "," + Bio.Replace(",", "") + "," + Location + "," + website + "," + NoOfTweets + "," + Followers + "," + Followings + " ," + IsProfilePIc + "]");
                }
            }
            catch { }
        }
        public void GetBoardsForRepinUpdated(ref PinInterestUser objPinUser, string Username)
        {
            try
            {                         
				GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Start Getting Boards For User " + Username + " ]");                                                  
                try
                {
                    if (string.IsNullOrEmpty(Globals.ItemSelect))
                    {
                        UserUrl = "http://pinterest.com/" + Username;
                    }
                    else
                    {
                        UserUrl = "http://pinterest.com/" + Username + "/" + Globals.ItemSelect;
                    
                    }
									
                    GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper();
                    string aa = objGlobusHttpHelper.getHtmlfromUrl(new Uri(UserUrl), "", "", objPinUser.UserAgent);

                    string[] Items = Regex.Split(aa, Username);
                    Items = Items.Skip(1).ToArray();                   
                    foreach (string item in Items)
                    {
                        try
                        {
                            if (item.Contains("board_id"))
                            {                         
                                string[] Data = System.Text.RegularExpressions.Regex.Split(item, "board_id");//{"board_id":
                                foreach (string Dataitem in Data)
                                {
                                    try
                                    {
                                        if (Dataitem.Contains("-end-"))
                                        {
                                            continue;
                                        }
                                        if (Dataitem.Contains("_1399706961_75.jpg"))
                                        {
                                            continue;
                                        }
                                        if (Dataitem.Contains("board_name") || Dataitem.Contains("name\": \"Board") || Dataitem.Contains("anchored\": true")) //"board_name": 
                                        {
                                            try
                                            {
                                                int LastPoint = Dataitem.IndexOf("board_name");//board_name //Board
                                                
                                                if (LastPoint <= 0)
                                                {
                                                    LastPoint = Dataitem.IndexOf(",");
                                                    ac = Dataitem.Substring(0, LastPoint).Replace("\": \"", string.Empty).Replace("\"", "").Replace(", ", string.Empty).Replace("field_set_keygrid_item}}name", string.Empty).Trim();
                                                }
                                                else
                                                {
                                                    ac = Dataitem.Substring(0, LastPoint).Replace("\": \"", string.Empty).Replace("\"", "").Replace(", ", string.Empty).Replace("field_set_keygrid_item}}name", string.Empty).Trim();
                                                }
                                                if (!objPinUser.Boards.Contains(ac))
                                                {
                                                    //I have to validate here so that only BoardId gets through
                                                    if (NumberHelper.ValidateNumber(ac))
                                                    {
                                                        objPinUser.Boards.Add(ac);
                                                    }
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                            }

                                        }                                    
                                    }
                                    catch(Exception ex)
                                    { };
                                }//end of Foreach loop
                                
                            }

                        }

                        catch (Exception ex)
                        {

                        }
                    }

                    objPinUser.Boards.Count();
                    //objPinUser.Boards.AddRange(Boards);
          
					GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Get All Boards for User " + objPinUser.Name + " ]");
                }
                catch (Exception ex)
                { };
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" => [ Boards Getting Process Failed ]");
            }
        }
        public List<string> GetUserFollowing(string UserName, int NoOfPage, int FollowingCount)
        {
            try
            {
                string FollowUrl = string.Empty;
                string AppVersion = string.Empty;
                string bookmark = string.Empty;
                string referer = string.Empty;
                string User = string.Empty;
                List<string> followings = new List<string>();
                ClGlobul.lstTotalUserScraped.Clear();
                List<string> lstFollowing = new List<string>();
				GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Starting Extraction Of Following For " + UserName + " ]");
                GlobusHttpHelper globusHttpHelper = new GlobusHttpHelper();

                string TotalFollowingUrl = "https://pinterest.com/" + UserName;
                string responseFollowingUrl = globusHttpHelper.getHtmlfromUrl(new Uri(TotalFollowingUrl), referer, string.Empty, "");
                int TotalFollowing = int.Parse(Utils.Utils.getBetween(responseFollowingUrl, "following_count\":", ","));
                int PageCount = TotalFollowing / 12 + 1;

                for (int i = 1; i <= PageCount; i++)
                {
                    try
                    {
                        string FollowerPageSource = string.Empty;

                        if (i == 1)
                        {
                            FollowUrl = "http://pinterest.com/" + UserName + "/following/";
                            FollowerPageSource = globusHttpHelper.getHtmlfromUrl(new Uri(FollowUrl), referer, string.Empty, "");
                            referer = FollowUrl;
                        }
                        else
                        {
                            FollowUrl = "https://pinterest.com/resource/UserFollowingResource/get/?source_url=%2F" + UserName + "%2Ffollowing%2F&data=%7B%22options%22%3A%7B%22username%22%3A%22" + UserName + "%22%2C%22bookmarks%22%3A%5B%22" + bookmark + "%3D%22%5D%7D%2C%22context%22%3A%7B%7D%7D&module_path=App(module%3D%5Bobject+Object%5D)&_=144204352215" + (i - 1);

                            try
                            {
                                FollowerPageSource = globusHttpHelper.getHtmlfromUrlProxy(new Uri(FollowUrl), referer, "", 80, string.Empty, "", "");
                            }
                            catch
                            {
                                FollowerPageSource = globusHttpHelper.getHtmlfromUrlProxy(new Uri(FollowUrl), "", Convert.ToInt32(""), "", "");

                            }
                            if (FollowerPageSource.Contains("Whoops! We couldn't find that page."))
                            {
                                break;
                            }
                        }

                        ///Get App Version 
                        if (FollowerPageSource.Contains("app_version") && string.IsNullOrEmpty(AppVersion))
                        {
                            string[] ArrAppVersion = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "app_version");
                            if (ArrAppVersion.Count() > 0)
                            {
                                string DataString = ArrAppVersion[ArrAppVersion.Count() - 1];

                                int startindex = DataString.IndexOf("\": \"");
                                int endindex = DataString.IndexOf("\", \"");

                                AppVersion = DataString.Substring(startindex, endindex - startindex).Replace("\": \"", "");
                            }
                        }

                        ///get bookmarks value from page 
                        ///
                        if (FollowerPageSource.Contains("bookmarks"))
                        {
                            string[] bookmarksDataArr = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "bookmarks");

                            string Datavalue = string.Empty;
                            if (bookmarksDataArr.Count() > 2)
                                Datavalue = bookmarksDataArr[bookmarksDataArr.Count() - 2];
                            else
                                Datavalue = bookmarksDataArr[bookmarksDataArr.Count() - 1];

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


                        try
                        {
                            if (!FollowerPageSource.Contains("No one has followed"))
                            {
                                List<string> lst = objGlobusRegex.GetHrefUrlTags(FollowerPageSource);
                                if (lst.Count == 0)
                                {
                                    lst = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "href").ToList();
                                    if (lst.Count() == 1)
                                    {
                                        lst = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "\"username\":").ToList();
                                    }
                                }
                                foreach (string item in lst)
                                {
                                    if (item.Contains("class=\"userWrapper") || item.Contains("class=\\\"userWrapper"))
                                    {
                                        try
                                        {
                                            if (item.Contains("\\"))
                                            {
                                                int FirstPinPoint = item.IndexOf("=\\\"/");
                                                int SecondPinPoint = item.IndexOf("/\\\"");
                                                User = item.Substring(FirstPinPoint, SecondPinPoint - FirstPinPoint).Replace("\"", string.Empty).Replace("\\", string.Empty).Replace("=", string.Empty).Replace("/", string.Empty).Trim();
                                            }
                                            else
                                            {
                                                int FirstPinPoint = item.IndexOf("href=");
                                                int SecondPinPoint = item.IndexOf("class=");

                                                User = item.Substring(FirstPinPoint, SecondPinPoint - FirstPinPoint).Replace("\"", string.Empty).Replace("href=", string.Empty).Replace("/", string.Empty).Trim();
                                            }
                                            if (followings.Count == FollowingCount)
                                            {
                                                break;
                                            }
                                            followings.Add(User);


                                            //GlobusLogHelper.log.Info(" => [ " + User + " ]");                                           

                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusLogHelper.log.Error(" Error : " + ex.StackTrace);
                                        }
                                    }
                                    if (i > 1)
                                    {
                                        if (item.Contains("\"request_identifier\":"))
                                        {
                                            continue;
                                        }
                                        else
                                        {
                                            try
                                            {
                                                User = Utils.Utils.getBetween(item, "\"", "\"");
                                                if (User == UserName)
                                                {
                                                    break;
                                                }
                                                followings.Add(User);

                                                //GlobusLogHelper.log.Info(" => [ " + User + " ]");

                                                if (followings.Count == FollowingCount)
                                                {
                                                    break;
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusLogHelper.log.Error(" Error : " + ex.StackTrace);
                                            }
                                        }
                                    }
                                }


                                followings = followings.Distinct().ToList();
                                foreach (string lstdata in followings)
                                {
                                    lstFollowing.Add(lstdata);
                                    #region AccountReport

                                    //string module = "Scraper";
                                    //string status = "Following";
                                    //qm.insertAccReportScrapeUser(module, lstdata, status, DateTime.Now);
                                    //objScraperDelegate();

                                    #endregion
                                    if (lstFollowing.Count >= maxNoOfRePinCount)
                                    {
                                        break;
                                    }
                                }
                                ClGlobul.lstTotalUserScraped = lstFollowing.Distinct().ToList();
                                if (ClGlobul.lstTotalUserScraped.Count >= maxNoOfRePinCount)
                                {
                                    return ClGlobul.lstTotalUserScraped;
                                }

                                Thread.Sleep(1000);
                            }
                            else
                            {
								GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ No following ]");
                                break;
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                        }
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                        break;

                    }
                }
				GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Total Followings : " + ClGlobul.lstTotalUserScraped.Count + " ]");            
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
            }

            return ClGlobul.lstTotalUserScraped;
        }
Пример #26
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 { };
        }
Пример #27
0
        private void SummitCaptchaMulti(string captchaText, ref GlobusHttpHelper HttpHelper,  string post_form_id, string lsd,
            string reg_instance,
            string firstname,
            string lastname,
            string reg_email__,
            string reg_email_confirmation__,
            string reg_passwd__,
            string sex,
            string birthday_month,
            string birthday_day,
            string birthday_year,
            string captcha_persist_data,
            string captcha_session,
            string extra_challenge_params,
            string recaptcha_public_key,
            string authp_pisg_nonce_tt,
            string authp,
            string psig,
            string nonce,
            string tt,
            string time,
            string challenge,
            string CaptchaSummit)
        {
            captchaText = captchaText.Replace(" ", "%20");
            string strUrl = "https://www.facebook.com/ajax/register.php?__a=5&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=DDAHLDHSSh%2FhZdZLLSDAdZDLLHDODLHHHHADAAAANR%2FmiZKICC%2FHB%2F&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&recaptcha_challenge_field=" + challenge + "&captcha_response=" + captchaText + "&__user=0";
            string pageSourceSummitCaptcha = HttpHelper.getHtmlfromUrl(new Uri(strUrl));

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

            if (!string.IsNullOrEmpty(pageSourceSummitCaptcha) && pageSourceSummitCaptcha.Contains("registration_succeeded"))
            {
                AddToListBox("Registration Succeeded");
                string res = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/c.php?email=" + reg_email__));

                // JS, CSS, Image Requests
                //RequestsJSCSSIMG.RequestJSCSSIMG(res, ref HttpHelper);
            }
            else if (!string.IsNullOrEmpty(pageSourceSummitCaptcha) && pageSourceSummitCaptcha.Contains("It looks like you already have an account on Facebook"))
            {
                strUrl = strUrl.Replace("https://www.facebook.com/ajax/register.php?__a=5&post_form_id=", "https://www.facebook.com/ajax/register.php?__a=6&post_form_id=");
                pageSourceSummitCaptcha = HttpHelper.getHtmlfromUrl(new Uri(strUrl));

                string res = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/c.php?email=" + reg_email__));

                // JS, CSS, Image Requests
                //RequestsJSCSSIMG.RequestJSCSSIMG(res, ref HttpHelper);
            }
            else if (!string.IsNullOrEmpty(pageSourceSummitCaptcha) && pageSourceSummitCaptcha.Contains("The text you entered didn't match the security check"))
            {
                AddToListBox("The text you entered didn't match the security check. Retrying..");
            }
            else if (!string.IsNullOrEmpty(pageSourceSummitCaptcha) && pageSourceSummitCaptcha.Contains("You took too much time"))
            {
                AddToListBox("You took too much time in submitting captcha. Retrying..");
            }
            else if (!string.IsNullOrEmpty(pageSourceSummitCaptcha) && pageSourceSummitCaptcha.Contains("to an existing account"))
            {
                AddToListBox("This email is associated to an existing account");
            }
           
            else
            {
                AddToListBox("Couldn't create account with " + reg_email__ + "");
            }
            
        }
        public string LoginUsingGlobusHttp(ref InstagramUser InstagramUser)
        {
            ///Sign In
            #region comment

            //GlobusHttpHelper httpHelper = InstagramUser.globusHttpHelper;


            //GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Logging in with Account : " + InstagramUser.username + " ]");
            //string Status = "Failed";
            //try
            //{
            //    string firstUrl = "https://api.instagram.com/oauth/authorize/?client_id=9d836570317f4c18bca0db6d2ac38e29&redirect_uri=http://websta.me/&response_type=code&scope=comments+relationships+likes";
            //    #region for Chk Authorization By Anil
            //    //  string Authorization_respo = httpHelper.getHtmlfromUrl(new Uri(firstUrl));

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

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

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

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



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


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


            //    string postdata_Login = string.Empty;
            //    string res_postdata_Login = string.Empty;
            //    try
            //    {
            //        postdata_Login = "******" + this.Token + "&username="******"&password="******"";
            //    }
            //    catch { };
            //    try
            //    {

            //        res_postdata_Login = httpHelper.postFormData(new Uri(login), postdata_Login, login, "");
            //        if(res_postdata_Login.Contains("value=\"Authorize\""))
            //    {
            //        string res_token= string.Empty;
            //        //string csrftoken = "https://instagram.com/oauth/authorize/?client_id=9d836570317f4c18bca0db6d2ac38e29&redirect_uri=http://websta.me/&response_type=code&scope=comments+relationships+likes";
            //        try
            //        {
            //             res_token = httpHelper.getHtmlfromUrl(new Uri("https://instagram.com/oauth/authorize/?client_id=9d836570317f4c18bca0db6d2ac38e29&redirect_uri=http://websta.me/&response_type=code&scope=comments+relationships+likes"), "https://instagram.com/accounts/login/?force_classic_login=&next=/oauth/authorize/%3Fclient_id%3D9d836570317f4c18bca0db6d2ac38e29%26redirect_uri%3Dhttp%3A//websta.me/%26response_type%3Dcode%26scope%3Dcomments%2Brelationships%2Blikes");
            //        }
            //        catch { };
            //        string csrftoken = Utils.getBetween(res_token, "\"csrfmiddlewaretoken\" value=\"", "\"/>");
            //        string login_Authorise="https://instagram.com/oauth/authorize/?client_id=9d836570317f4c18bca0db6d2ac38e29&redirect_uri=http://websta.me/&response_type=code&scope=comments+relationships+likes";
            //        string postAuthorise = "csrfmiddlewaretoken=" + csrftoken + "&allow=Authorize";
            //        try
            //        {
            //            string res_postAuthorise = httpHelper.postFormData(new Uri(login_Authorise), postAuthorise, login_Authorise, "");
            //        }
            //        catch { };
            //    }

            //        if (res_postdata_Login.Contains("Authorization Request &mdash; Instagram"))
            //        {
            //            Authorization = "No";
            //        }
            //        else
            //        {
            //            Authorization = "Yes";
            //        }
            //        if (res_postdata_Login.Contains("Please register your email address from") || res_postdata_Login.Contains("Please register your Phone Number from"))
            //        {
            //            if (res_postdata_Login.Contains("Please register your Phone Number from"))
            //            {
            //                acc_status = "Phone";
            //            }
            //            else
            //            {
            //                acc_status = "Email";
            //            }

            //        }
            //        else
            //        {
            //            acc_status = "Ok";
            //        }
            //    }
            //    catch { };

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

            //    if (res_postdata_Login.Contains("Please enter a correct username and password"))
            //    {
            //        Status = "Failed";
            //        this.LoggedIn = false;
            //    }
            //    else if (res_postdata_Login.Contains("requesting access to your Instagram account") || postdata_Login.Contains("is requesting to do the following"))
            //    {
            //        Status = "AccessIssue";
            //    }
            //    else if (res_postdata_Login.Contains("logout") || postdata_Login.Contains("LOG OUT"))
            //{
            //        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Logged in with Account Success :" + InstagramUser.username + " ]");
            //        Status = "Success";
            //        this.LoggedIn = true;
            //        string str = httpHelper.getHtmlfromUrl(new Uri("http://websta.me/n/" + InstagramUser.username));
            //        UpdateCampaign(InstagramUser.username, str, "Success");
            //        InstagramUser.isloggedin = true;
            //    }
            //    else if (string.IsNullOrEmpty(res_secondURL))
            //    {

            //        Status = "Failed";
            //        this.LoggedIn = false;
            //        InstagramUser.isloggedin = false;
            //    }

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

            //}

            #endregion

            try
            {
                string Status         = "Failed";
                string url            = IGGlobals.Instance.IGInstagramurl;
                string firstResoponse = InstagramUser.globusHttpHelper.GetData_LoginThroughInstagram(new Uri(url), InstagramUser.proxyip, InstagramUser.proxyport, InstagramUser.proxyusername, InstagramUser.proxyport);
                string poatData       = "username="******"&password="******"";
                string response        = InstagramUser.globusHttpHelper.PostData_LoginThroughInstagram(new Uri(url), poatData, "", token);
                string dataBeforelogin = InstagramUser.globusHttpHelper.getHtmlfromUrl(new Uri(IGGlobals.Instance.IGInstagramAuthorizeurl), IGGlobals.Instance.IGWEPME, "");



                if (dataBeforelogin.Contains("Was This You?"))
                {
                    string crs_token  = Utils.getBetween(response, "=\"csrfmiddlewaretoken\" value=\"", "\"/>");
                    string post_data  = "csrfmiddlewaretoken=" + crs_token + "&approve=It+Was+Me";
                    string next_hit   = InstagramUser.globusHttpHelper.PostData_LoginThroughInstagram(new Uri("https://www.instagram.com/integrity/checkpoint/?next=%2F"), post_data, "", crs_token);
                    string post_data2 = "csrfmiddlewaretoken=" + crs_token + "&OK=OK";
                    string finalhit   = InstagramUser.globusHttpHelper.PostData_LoginThroughInstagram(new Uri("https://www.instagram.com/integrity/checkpoint/?next=%2F"), post_data2, "", crs_token);
                    dataBeforelogin = InstagramUser.globusHttpHelper.getHtmlfromUrl(new Uri(IGGlobals.Instance.IGInstagramAuthorizeurl), IGGlobals.Instance.IGWEPME, "");
                }

                //#region For icono

                //string Home_icon_Url = InstagramUser.globusHttpHelper.getHtmlfromUrl(new Uri("http://iconosquare.com"), "");
                //string Icon_url = IGGlobals.Instance.IGiconosquareAuthorizeurl;
                //string PPagesource = InstagramUser.globusHttpHelper.getHtmlfromUrl(new Uri(Icon_url), "");
                //string responce_icon = InstagramUser.globusHttpHelper.getHtmlfromUrl(new Uri(IGGlobals.Instance.IGiconosquareviewUrl), "");

                //#endregion


                // dataBeforelogin = InstagramUser.globusHttpHelper.getHtmlfromUrl(new Uri(IGGlobals.Instance.IGInstagramAuthorizeurl), IGGlobals.Instance.IGWEPME, "");
                //   dataBeforelogin = InstagramUser.globusHttpHelper.getHtmlfromUrl(new Uri(IGGlobals.Instance.IGWebstaFeedUrl), IGGlobals.Instance.IGWEPME, "");
                // dataBeforelogin = InstagramUser.globusHttpHelper.getHtmlfromUrl(new Uri(IGGlobals.Instance.IGInstagramAuthorizeurl), IGGlobals.Instance.IGWEPME, "");
                //   dataBeforelogin = InstagramUser.globusHttpHelper.getHtmlfromUrl(new Uri(IGGlobals.Instance.IGWebstaFeedUrl), IGGlobals.Instance.IGWEPME, "");

                try
                {
                    if (dataBeforelogin.Contains("Authorization Request &mdash; Instagram"))
                    {
                        Authorization = "No";
                    }
                    else
                    {
                        Authorization = "Yes";
                    }
                    if (dataBeforelogin.Contains("Please register your email address from") || dataBeforelogin.Contains("Please register your Phone Number from"))
                    {
                        if (dataBeforelogin.Contains("Please register your Phone Number from"))
                        {
                            acc_status = "Phone";
                        }
                        else
                        {
                            acc_status = "Email";
                        }
                    }
                    else
                    {
                        acc_status = "Ok";
                    }
                }
                catch (Exception ex)
                {
                    GlobusLogHelper.log.Info("Error :" + ex.StackTrace);
                }


                if (dataBeforelogin.Contains(InstagramUser.username.ToLower()))//marieturnipseed55614
                {
                    if (value)
                    {
                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Logged in with Account Success :" + InstagramUser.username + " ]");
                    }
                    InstagramUser.isloggedin = true;
                    Status        = "Success";
                    this.LoggedIn = true;
                    string str = httpHelper.getHtmlfromUrl(new Uri("https://www.instagram.com/" + InstagramUser.username + "/"));
                    UpdateCampaign(InstagramUser.username, str, "Success");
                    value = false;
                }
                else
                {
                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Logged in with Account Fail :" + InstagramUser.username + " ]");
                }
                return(Status);
            }

            catch
            {
                return(null);
            };
        }
Пример #29
0
        /// <summary>
        /// Makes Http Request to Confirmation URL from Mail, also requests other JS, CSS URLs
        /// </summary>
        /// <param name="ConfirmationUrl"></param>
        /// <param name="gif"></param>
        /// <param name="logpic"></param>
        public void EmailVerificationMultithreaded(string ConfirmationUrl, string gif, string logpic, string email, string password, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, ref GlobusHttpHelper HttpHelper)
        {
            int intProxyPort = 80;
            Regex IdCheck = new Regex("^[0-9]*$");

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

            string pgSrc_ConfirmationUrl = HttpHelper.getHtmlfromUrlProxy(new Uri(ConfirmationUrl), proxyAddress, intProxyPort, proxyUsername, proxyPassword);

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

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

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

            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);

            pgSrc_ConfirmationUrl = HttpHelper.getHtmlfromUrl(new Uri(ConfirmationUrl));

            try
            {
                string pgSrc_Gif = HttpHelper.getHtmlfromUrl(new Uri(gif));
            }
            catch { }
            try
            {
                string pgSrc_Logpic = HttpHelper.getHtmlfromUrl(new Uri(logpic + "&s=a"));
            }
            catch { }
            try
            {
                string pgSrc_Logpic = HttpHelper.getHtmlfromUrl(new Uri(logpic));
            }
            catch { }

            //** User Id ***************//////////////////////////////////
            string UsreId = string.Empty;
            if (string.IsNullOrEmpty(UsreId))
            {
                UsreId = GlobusHttpHelper.ParseJson(ResponseLogin, "user");
            }

            //*** 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 pgSrc_email_confirmed = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/?email_confirmed=1"));

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


            #region Skipping Code

            ///Code for skipping additional optional Page
            try
            {
                string phstamp = "165816812085115" + RandomNumberGenerator.GenerateRandom(10848130, 10999999);

                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=" + phstamp;

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

            pgSrc_contact_importer = 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 (pgSrc_contact_importer.Contains("Are your friends already on Facebook?") && pgSrc_contact_importer.Contains("Skip this step"))
            if (true)
            {
                string phstamp = "16581677684757" + RandomNumberGenerator.GenerateRandom(5104244, 9999954);

                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=" + phstamp + "";
                string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData);

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

                Thread.Sleep(1000);

                //pgSrc_contact_importer = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted/?step=classmates_coworkers"));
            }
            //if ((pgSrc_contact_importer.Contains("Fill out your Profile Info") || pgSrc_contact_importer.Contains("Fill out your Profile info")) && pgSrc_contact_importer.Contains("Skip"))
            if (true)
            {
                string phstamp = "16581677684757" + RandomNumberGenerator.GenerateRandom(5104244, 9999954);

                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=" + phstamp + "";
                string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData);

                ///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 + "&";
                }

                phstamp = "16581677684757" + RandomNumberGenerator.GenerateRandom(5104244, 9999954);

                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=" + phstamp + "";//"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(1000);

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

                string image_Get = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/images/wizard/nuxwizard_profile_picture.gif"));

                try
                {
                    phstamp = "16581677684757" + RandomNumberGenerator.GenerateRandom(5104244, 9999954);
                    string newPostData2 = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step=upload_profile_pic&step_name=upload_profile_pic&previous_step_name=classmates_coworkers&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=" + phstamp + "";
                    string postRes2 = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData2);
                }
                catch { }
                try
                {
                    phstamp = "16581677684757" + RandomNumberGenerator.GenerateRandom(5104244, 9999954);
                    string newPostData3 = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step=upload_profile_pic&step_name=upload_profile_pic&previous_step_name=classmates_coworkers&submit=Save%20%26%20Continue&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=" + phstamp + "";
                    string postRes3 = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData3);
                }
                catch { }

            }
            if (pageSrc2.Contains("Set your profile picture") && pageSrc2.Contains("Skip"))
            {
                string phstamp = "16581677684757" + RandomNumberGenerator.GenerateRandom(5104244, 9999954);
                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=" + phstamp + "";
                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 { }

            }
            #endregion
            if (pageSrc3.Contains("complete the sign-up process"))
            {
            }
            if (pgSrc_contact_importer.Contains("complete the sign-up process"))
            {
            }
            #endregion

            ////**Post Message For User***********************/////////////////////////////////////////////////////

            try
            {

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

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

            AddToListBox("Email verification completed for : " + email);
            //LoggerVerify("Email verification completed for : " + Email);
        }
Пример #30
0
        public void PostFinalMsgGroupMember_1By1(ref GlobusHttpHelper HttpHelper, Dictionary <string, string> SlectedContacts, List <string> GrpMemSubjectlist, List <string> GrpMemMessagelist, string msg, string body, string UserName, string FromemailId, string FromEmailNam, string SelectedGrpName, string grpId, bool mesg_with_tag, bool msg_spintaxt, int mindelay, int maxdelay, bool preventMsgSameGroup, bool preventMsgWithoutGroup, bool preventMsgGlobal)
        {
            try
            {
                MsgGroupMemDbManager objMsgGroupMemDbMgr = new MsgGroupMemDbManager();

                string postdata       = string.Empty;
                string postUrl        = string.Empty;
                string ResLogin       = string.Empty;
                string csrfToken      = string.Empty;
                string sourceAlias    = string.Empty;
                string ReturnString   = string.Empty;
                string PostMsgSubject = string.Empty;
                string PostMsgBody    = string.Empty;
                string FString        = string.Empty;

                try
                {
                    string MessageText    = string.Empty;
                    string PostedMessage  = string.Empty;
                    string senderEmail    = string.Empty;
                    string getComposeData = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/inbox/compose"));
                    try
                    {
                        int startindex = getComposeData.IndexOf("\"senderEmail\" value=\"");
                        if (startindex < 0)
                        {
                            startindex = getComposeData.IndexOf("\"senderEmail\",\"value\":\"");
                        }
                        string start    = getComposeData.Substring(startindex).Replace("\"senderEmail\" value=\"", string.Empty).Replace("\"senderEmail\",\"value\":\"", string.Empty);
                        int    endindex = start.IndexOf("\"/>");
                        if (endindex < 0)
                        {
                            endindex = start.IndexOf("\",\"");
                        }
                        string end = start.Substring(0, endindex).Replace("\"/>", string.Empty).Replace("\",\"", string.Empty);
                        senderEmail = end.Trim();
                    }
                    catch
                    { }
                    string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));
                    if (pageSource.Contains("csrfToken"))
                    {
                        try
                        {
                            csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 50);
                            string[] Arr = csrfToken.Split('<');
                            csrfToken = Arr[0];
                            csrfToken = csrfToken.Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty).Replace("\n", string.Empty).Replace(">", string.Empty).Replace("<script typ", string.Empty);
                            csrfToken = csrfToken.Trim();
                        }
                        catch (Exception ex)
                        {
                        }
                    }

                    if (pageSource.Contains("sourceAlias"))
                    {
                        try
                        {
                            sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100);
                            string[] Arr = sourceAlias.Split('"');
                            sourceAlias = Arr[2];
                        }
                        catch (Exception ex)
                        {
                        }
                    }

                    if (pageSource.Contains("goback="))
                    {
                        try
                        {
                        }
                        catch (Exception ex)
                        {
                        }
                    }

                    foreach (KeyValuePair <string, string> itemChecked in SlectedContacts)
                    {
                        try
                        {
                            DataSet ds          = new DataSet();
                            DataSet ds_bList    = new DataSet();
                            string  ContactName = string.Empty;
                            string  Nstring     = string.Empty;
                            string  connId      = string.Empty;
                            string  FName       = string.Empty;
                            string  Lname       = string.Empty;
                            string  tempBody    = string.Empty;
                            string  tempsubject = string.Empty;
                            string  n_ame1      = string.Empty;

                            //grpId = itemChecked.Key.ToString();

                            try
                            {
                                // FName = itemChecked.Value.Split(' ')[0];
                                // Lname = itemChecked.Value.Split(' ')[1];
                                try
                                {
                                    n_ame1 = itemChecked.Value.Split(']')[1].Trim();;
                                }
                                catch
                                { }
                                if (string.IsNullOrEmpty(n_ame1))
                                {
                                    try
                                    {
                                        n_ame1 = itemChecked.Value;
                                    }
                                    catch
                                    { }
                                }
                                string[] n_ame = Regex.Split(n_ame1, " ");
                                FName = " " + n_ame[0];
                                Lname = n_ame[1];

                                if (!string.IsNullOrEmpty(n_ame[2]))
                                {
                                    Lname = Lname + n_ame[2];
                                }
                                if (!string.IsNullOrEmpty(n_ame[3]))
                                {
                                    Lname = Lname + n_ame[3];
                                }
                                if (!string.IsNullOrEmpty(n_ame[4]))
                                {
                                    Lname = Lname + n_ame[4];
                                }
                                if (!string.IsNullOrEmpty(n_ame[5]))
                                {
                                    Lname = Lname + n_ame[5];
                                }
                            }
                            catch (Exception ex)
                            {
                            }

                            try
                            {
                                ContactName = FName + " " + Lname;
                                ContactName = ContactName.Replace("%20", " ");
                            }
                            catch { }

                            Log("[ " + DateTime.Now + " ] => [ Adding Contact : " + ContactName + " ]");

                            string        ToCd         = itemChecked.Key;
                            List <string> AddAllString = new List <string>();

                            if (FString == string.Empty)
                            {
                                string CompString = "{" + "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}";
                                FString = CompString;
                            }
                            else
                            {
                                string CompString = "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}";
                                FString = CompString;
                            }

                            if (Nstring == string.Empty)
                            {
                                Nstring = FString;
                                connId  = ToCd;
                            }
                            else
                            {
                                Nstring += "," + FString;
                                connId  += " " + ToCd;
                            }

                            Nstring += "}";

                            try
                            {
                                string PostMessage       = string.Empty;
                                string ResponseStatusMsg = string.Empty;

                                Log("[ " + DateTime.Now + " ] => [ Message Sending Process Running.. ]");


                                if (msg_spintaxt == true)
                                {
                                    try
                                    {
                                        msg  = GrpMemSubjectlist[RandomNumberGenerator.GenerateRandom(0, GrpMemSubjectlist.Count - 1)];
                                        body = GrpMemMessagelist[RandomNumberGenerator.GenerateRandom(0, GrpMemMessagelist.Count - 1)];
                                    }
                                    catch
                                    {
                                    }
                                }
                                try
                                {
                                    tempsubject = msg;
                                    tempBody    = body;
                                }
                                catch
                                { }
                                if (mesg_with_tag == true)
                                {
                                    if (string.IsNullOrEmpty(FName))
                                    {
                                        tempBody = body.Replace("<Insert Name>", ContactName);
                                    }
                                    else
                                    {
                                        tempBody = GlobusSpinHelper.spinLargeText(new Random(), body);

                                        if (lstSubjectReuse.Count == GrpMemSubjectlist.Count)
                                        {
                                            lstSubjectReuse.Clear();
                                        }
                                        foreach (var itemSubject in GrpMemSubjectlist)
                                        {
                                            if (string.IsNullOrEmpty(TemporarySubject))
                                            {
                                                TemporarySubject = itemSubject;
                                                tempsubject      = itemSubject;
                                                lstSubjectReuse.Add(itemSubject);
                                                break;
                                            }
                                            else if (!lstSubjectReuse.Contains(itemSubject))
                                            {
                                                TemporarySubject = itemSubject;
                                                tempsubject      = itemSubject;
                                                lstSubjectReuse.Add(itemSubject);
                                                break;
                                            }
                                            else
                                            {
                                                continue;
                                            }
                                        }

                                        tempBody    = tempBody.Replace("<Insert Name>", FName);
                                        tempsubject = tempsubject.Replace("<Insert Name>", FName);
                                    }
                                }
                                else
                                {
                                    if (string.IsNullOrEmpty(FName))
                                    {
                                        tempBody = body.Replace("<Insert Name>", ContactName);
                                    }
                                    else
                                    {
                                        tempBody = body.Replace("<Insert Name>", FName);
                                    }
                                }

                                if (SelectedGrpName.Contains(":"))
                                {
                                    try
                                    {
                                        string[] arrSelectedGrpName = Regex.Split(SelectedGrpName, ":");
                                        if (arrSelectedGrpName.Length > 1)
                                        {
                                            SelectedGrpName = arrSelectedGrpName[1];
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                    }
                                }



                                if (mesg_with_tag == true)
                                {
                                    tempBody = tempBody.Replace("<Insert Group>", SelectedGrpName);
                                    tempBody = tempBody.Replace("<Insert From Email>", FromEmailNam);
                                    tempBody = tempBody.Replace("<Insert Name>", string.Empty).Replace("<Insert Group>", string.Empty).Replace("<Insert From Email>", string.Empty);
                                }
                                else
                                {
                                    tempBody = tempBody.Replace("<Insert Group>", SelectedGrpName);
                                    tempBody = tempBody.Replace("<Insert From Email>", FromEmailNam);
                                    tempBody = tempBody.Replace("<Insert Name>", string.Empty).Replace("<Insert Group>", string.Empty).Replace("<Insert From Email>", string.Empty);
                                }

                                //Check BlackListed Accounts
                                try
                                {
                                    string Querystring = "Select ProfileID From tb_BlackListAccount Where ProfileID ='" + itemChecked.Key + "'";
                                    ds_bList = DataBaseHandler.SelectQuery(Querystring, "tb_BlackListAccount");
                                }
                                catch { }


                                if (preventMsgSameGroup)
                                {
                                    try
                                    {
                                        string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgFrom ='" + UserName + "' and MsgGroupId = " + grpId + " and MsgToId = " + connId + "";
                                        ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                    }
                                    catch { }
                                }

                                if (preventMsgWithoutGroup)
                                {
                                    try
                                    {
                                        string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgFrom ='" + UserName + "' and MsgToId = " + connId + "";
                                        ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                    }
                                    catch { }
                                }
                                if (preventMsgGlobal)
                                {
                                    try
                                    {
                                        string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgToId = " + connId + "";
                                        ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                    }
                                    catch { }
                                }

                                try
                                {
                                    if (ds.Tables.Count > 0)
                                    {
                                        if (ds.Tables[0].Rows.Count > 0)
                                        {
                                            PostMessage       = "";
                                            ResponseStatusMsg = "Already Sent";
                                        }
                                        else
                                        {
                                            if (ds_bList.Tables.Count > 0 && ds_bList.Tables[0].Rows.Count > 0)
                                            {
                                                Log("[ " + DateTime.Now + " ] => [ User: "******" is Added BlackListed List For Send Messages Pls Check ]");
                                                ResponseStatusMsg = "BlackListed";
                                            }
                                            else
                                            {
                                                PostMessage       = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groupMsg"), PostMessage);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (ds_bList.Tables.Count > 0)
                                        {
                                            if (ds_bList.Tables[0].Rows.Count > 0)
                                            {
                                                Log("[ " + DateTime.Now + " ] => [ User: "******" is Added BlackListed List For Send Messages Pls Check ]");
                                                ResponseStatusMsg = "BlackListed";
                                            }
                                            else
                                            {
                                                PostMessage       = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(tempsubject.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groupMsg"), PostMessage);
                                            }
                                        }
                                    }
                                }
                                catch (Exception)
                                {
                                    //PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&showRecipeints=showRecipeintsfromName=" + Uri.EscapeDataString(FromEmailNam) + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                    //ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groupMsg"), PostMessage);
                                }

                                if ((!ResponseStatusMsg.Contains("Your message was successfully sent.") && !ResponseStatusMsg.Contains("Already Sent")) && (!ResponseStatusMsg.Contains("Se ha enviado tu mensaje satisfactoriamente") && !ResponseStatusMsg.Contains("Ya ha sido enviada") && !ResponseStatusMsg.Contains("Uw bericht is verzonden")))
                                {
                                    if (ResponseStatusMsg.Contains("Already Sent") || (ResponseStatusMsg.Contains("Ya ha sido enviada") || (ResponseStatusMsg.Contains("BlackListed"))))
                                    {
                                        continue;
                                    }

                                    try
                                    {
                                        pageSource = HttpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/groups?viewMembers=&gid=" + grpId));

                                        if (pageSource.Contains("contentType="))
                                        {
                                            try
                                            {
                                                string contentType = pageSource.Substring(pageSource.IndexOf("contentType="), pageSource.IndexOf("&", pageSource.IndexOf("contentType=")) - pageSource.IndexOf("contentType=")).Replace("contentType=", string.Empty).Replace("contentType=", string.Empty).Trim();

                                                string pageSource2 = HttpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/groupMsg?displayCreate=&contentType=" + contentType + "&connId=" + connId + "&groupID=" + grpId + ""));

                                                PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&showRecipeints=showRecipeints&fromName=" + FromEmailNam + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=" + Uri.EscapeUriString(Nstring) + "&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=" + contentType + "&groupID=" + grpId + "";
                                            }
                                            catch (Exception ex)
                                            {
                                            }
                                        }


                                        ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                    }
                                    catch (Exception ex)
                                    {
                                    }
                                }

                                if ((ResponseStatusMsg.Contains("Your message was successfully sent.")) || (ResponseStatusMsg.Contains("Se ha enviado tu mensaje satisfactoriamente") || (ResponseStatusMsg.Contains("Uw bericht is verzonden"))))
                                {
                                    Log("[ " + DateTime.Now + " ] => [ Subject Posted : " + tempsubject + " ]");
                                    Log("[ " + DateTime.Now + " ] => [ Body Text Posted : " + tempBody.ToString() + " ]");
                                    Log("[ " + DateTime.Now + " ] => [ Message Posted To Account: " + ContactName + " ]");
                                    ReturnString = "Your message was successfully sent.";

                                    #region CSV
                                    string bdy = string.Empty;
                                    try
                                    {
                                        bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                                    }
                                    catch { }
                                    if (string.IsNullOrEmpty(bdy))
                                    {
                                        bdy = tempBody.ToString().Replace(",", ":");
                                    }
                                    string CSVHeader   = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                    string CSV_Content = UserName + "," + tempsubject + "," + bdy.ToString() + "," + ContactName;
                                    CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_MessageSentGroupMember);

                                    try
                                    {
                                        objMsgGroupMemDbMgr.InsertMsgGroupMemData(UserName, Convert.ToInt32(connId), ContactName, Convert.ToInt32(grpId), SelectedGrpName, msg, tempBody);
                                    }
                                    catch { }

                                    #endregion
                                }
                                else if (ResponseStatusMsg.Contains("There was an unexpected problem that prevented us from completing your request"))
                                {
                                    Log("[ " + DateTime.Now + " ] => [ There was an unexpected problem that prevented us from completing your request ! ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", Globals.path_MessageGroupMember);
                                }
                                else if (ResponseStatusMsg.Contains("You are no longer authorized to message this"))
                                {
                                    Log("[ " + DateTime.Now + " ] => [ You are no longer authorized to message this ! ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", Globals.path_MessageGroupMember);
                                }
                                else if ((ResponseStatusMsg.Contains("Already Sent")) || (ResponseStatusMsg.Contains("Ya ha sido enviada")))
                                {
                                    string bdy = string.Empty;
                                    try
                                    {
                                        bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                                    }
                                    catch { }
                                    if (string.IsNullOrEmpty(bdy))
                                    {
                                        bdy = tempBody.ToString().Replace(",", ":");
                                    }
                                    string CSVHeader   = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                    string CSV_Content = UserName + "," + msg + "," + bdy.ToString() + "," + ContactName;
                                    CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_MessageAlreadySentGroupMember);

                                    Log("[ " + DateTime.Now + " ] => [ Message Not Posted To Account: " + ContactName + " because it has sent the same message]");
                                }
                                else
                                {
                                    Log("[ " + DateTime.Now + " ] => [ Error In Message Posting ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", Globals.path_MessageGroupMember);
                                }

                                int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                                Log("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                                Thread.Sleep(delay * 1000);
                            }
                            catch (Exception ex)
                            {
                                //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");
                                GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember);
                            }
                        }
                        catch (Exception ex)
                        {
                            //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace);
                            GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember);
                        }
                    }
                }
                catch (Exception ex)
                {
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error -->  PostFinalMsgGroupMember() --> 1 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> PostFinalMsgGroupMember() --> 1 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember);
                }
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error -->  PostFinalMsgGroupMember() --> 2 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> PostFinalMsgGroupMember() --> 2 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinComposeMessageErrorLogs);
            }
        }
Пример #31
0
        public List <string> GetMembers(string TweetUrl, ref GlobusHttpHelper HttpHelper, 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
            {
                //   string numResult = Regex.Match(TweetUrl, @"\d+").Value;
                TweetUrl = TweetUrl + "@@@";

                string numResult = getBetween(TweetUrl, "status/", "@@@");

StartAgain:

                String DataCursor = string.Empty;
                if (counter == 0)
                {
                    FollowingUrl = "https://twitter.com/i/katyperry/conversation/" + numResult + "?include_available_features=1&include_entities=1&max_position=0";//TweetUrl;
                    counter++;
                }
                else
                {
                    FollowingUrl = "https://twitter.com/i/katyperry/conversation/" + numResult + "?include_available_features=1&include_entities=1&max_position=" + cursor.Trim();
                }


                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 is 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-tweet js-actionable-tweet"))
                    {
                        DataDivArr = Regex.Split(Data, "js-stream-tweet js-actionable-tweet");
                    }
                    else
                    {
                        DataDivArr = Regex.Split(Data, "simple-tweet tweet");
                    }

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

                        if (DataDivArr_item.Contains("data-screen-name"))
                        {
                            int endIndex   = 0;
                            int startIndex = DataDivArr_item.IndexOf("data-screen-name");
                            try
                            {
                                endIndex = DataDivArr_item.IndexOf("data-name");
                            }
                            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 (_SCRName.Contains(" "))
                            {
                                _SCRName = _SCRName.Split(' ')[0];
                            }

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


                    if (noOfRecords != lstIds.Count)
                    {
                        if (Data.Contains("min_position"))
                        {
                            DataCursor1 = Data.Substring(Data.IndexOf("min_position\":"), Data.IndexOf(",")).Replace(">", string.Empty).Replace("\n", string.Empty).Replace("\"", string.Empty).Replace("min_position", string.Empty).Replace(":", string.Empty).Replace(",", string.Empty).Trim();
                            cursor      = DataCursor1;

                            if (cursor.Contains("null") || cursor.Contains("Null"))
                            {
                                ReturnStatus = "No Error";
                                return(lstIds);
                            }

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

                        if (Data.Contains("\"has_more_items\":true"))
                        {
                            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);
            }
        }
Пример #32
0
        private void StartScrapingImage()
        {
            lstThreadStopProcess.Add(Thread.CurrentThread);
            lstThreadStopProcess.Distinct();
            Thread.CurrentThread.IsBackground = true;
            try
            {
                foreach (string item in lstscrapeUserNameForImage)
                {
                    if (rad_UserName.Checked)
                    {
                        try
                        {
                            string url = "http://www.twitter.com/" + item;
                            AddtoLoggerscrapeUserNameorIDForImages("[ " + DateTime.Now + " ] => Scraping Image For @" + item + "  ]");
                            string pagesource = objGlobusHttpHelper.getHtmlfromUrl(new Uri(url), "", "");
                            if (string.IsNullOrEmpty(pagesource))
                            {
                                AddtoLoggerscrapeUserNameorIDForImages("[ " + DateTime.Now + " ] =>Please enter valid User Name  ]");
                            }


                            else
                            {
                                string profileImageUrl = objGlobusHttpHelper.getBetween(pagesource, "class=\"ProfileAvatar-image \"", "alt=").Replace("src", "").Replace("=", "").Replace("\"", "").Trim();

                                if (!string.IsNullOrEmpty(profileImageUrl))
                                {
                                    AddtoLoggerscrapeUserNameorIDForImages("[ " + DateTime.Now + " ] => Got Url :-" + profileImageUrl + "  ]");
                                    AddtoLoggerscrapeUserNameorIDForImages("[ " + DateTime.Now + " ] => Saving Image of " + item + " in " + Globals.path_ScrapedImageFolder + " ]");
                                    //List<string> lstStoreImagesurl = new List<string>();
                                    //lstStoreImagesurl.Add(str);
                                    //foreach (string item1 in lstStoreImagesurl)
                                    {
                                        SaveImageWithUrl(profileImageUrl, Globals.path_ScrapedImageFolder + "\\" + item + ".jpg");
                                    }
                                }
                                else
                                {
                                    AddtoLoggerscrapeUserNameorIDForImages("[ " + DateTime.Now + " ] => No image Url found for user :-" + item + "  ]");
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.Write(ex.Message);
                        }
                    }
                    else if (rad_UserID.Checked)
                    {
                        try
                        {
                            string url = "https://twitter.com/intent/user?user_id=" + item;
                            AddtoLoggerscrapeUserNameorIDForImages("[ " + DateTime.Now + " ] => Scraping Image For @" + item + "  ]");
                            string pagesource = objGlobusHttpHelper.getHtmlfromUrl(new Uri(url), "", "");

                            if (string.IsNullOrEmpty(pagesource))
                            {
                                pagesource = objGlobusHttpHelper.getHtmlfromUrl(new Uri(url), "", "");
                            }
                            if (pagesource == null)
                            {
                                AddtoLoggerscrapeUserNameorIDForImages("[ " + DateTime.Now + " ] =>Please enter valid User Id   ]");
                            }
                            else
                            {
                                string profileImageUrl = objGlobusHttpHelper.getBetween(pagesource, "class=\"photo", "alt=").Replace("src", "").Replace("=", "").Replace("\"", "").Trim();
                                AddtoLoggerscrapeUserNameorIDForImages("[ " + DateTime.Now + " ] => Got Url :-" + profileImageUrl + "  ]");
                                AddtoLoggerscrapeUserNameorIDForImages("[ " + DateTime.Now + " ] => Saving Image of " + item + " in C:\\Users\\GLB-264\\Desktop\\twtboardpro ]");
                                //List<string> lstStoreImagesurl = new List<string>();
                                //lstStoreImagesurl.Add(str);
                                //foreach (string item1 in lstStoreImagesurl)
                                {
                                    SaveImageWithUrl(profileImageUrl, Globals.path_ScrapedImageFolder + "\\" + item + ".jpg");
                                }
                            }
                        }
                        catch { }
                    }
                    else
                    {
                        MessageBox.Show("Please check Username or User Id Option");
                        try
                        {
                            btnStartScraping.Invoke(new MethodInvoker(delegate() { btnStartScraping.Enabled = true; }));
                        }
                        catch { }
                        return;
                    }
                }
                //  MessageBox.Show("Please check Username or User Id Option");
            }
            catch
            { };
            AddtoLoggerscrapeUserNameorIDForImages("[ " + DateTime.Now + " ] => Process completed  ]");
            AddtoLoggerscrapeUserNameorIDForImages("[ -----------------------------------------------------------------------------------------------------------------------]");
        }
Пример #33
0
        private void GettingData(object obj)
        {
            try
            {
                GlobusHttpHelper httpHelper = new GlobusHttpHelper();
                string           str        = (string)obj;
                string[]         RowData    = Regex.Split(str, ",");

                try
                {
                    string aa       = RowData[1].ToString().Replace("\"", string.Empty);
                    Uri    uri      = new Uri(aa);
                    string Response = httpHelper.getHtmlfromUrl(uri);

                    if (!string.IsNullOrEmpty(Response))
                    {
                        string Idetifier = string.Empty;
                        string Stock     = "ERR";
                        string Price     = "ERR";

                        try
                        {
                            //string aa = GetIdentifier(Response, RowData);
                            Idetifier = GetValues(Response, RowData[0], RowData[2], RowData[3]);
                            logger.LogStatus("RowNumber --" + RowData[0] + " -- Idetifier -- " + Idetifier);
                        }
                        catch (Exception ex)
                        {
                            logger.LogDebug("RowNumber --" + RowData[0] + "--" + ex.Message);
                        }
                        try
                        {
                            //string bb = GetStock(Response, RowData);
                            Stock = GetValues(Response, RowData[0], RowData[5], RowData[6]);
                            logger.LogStatus("RowNumber --" + RowData[0] + " -- Stock -- " + Stock);
                        }
                        catch (Exception ex)
                        {
                            logger.LogDebug("RowNumber --" + RowData[0] + "--" + ex.Message);
                        }
                        try
                        {
                            //string CC = GetPrice(Response, RowData);
                            Price = GetValues(Response, RowData[0], RowData[8], RowData[9]).Replace("&pound;", "Amount" + " ");
                            if (!Price.Contains("Amount") && !Price.Contains("ERR"))
                            {
                                Price = "Amout" + " " + Price;
                            }
                            logger.LogStatus("RowNumber --" + RowData[0] + " -- Price -- " + Price);
                        }
                        catch (Exception ex)
                        {
                            logger.LogDebug("RowNumber --" + RowData[0] + "--" + ex.Message);
                        }

                        string Data = RowData[0] + "," + "1" + "," + Stock + "," + Price;
                        logger.LogStatus("RowNumber --" + RowData[0] + " -- Data -- " + Data);
                        WriteData(Data);
                    }
                    else
                    {
                    }
                }
                catch (Exception ex)
                {
                    logger.LogError(ex.Message);

                    if (ex.Message.Contains("Invalid URI"))
                    {
                        string Data = RowData[0] + "," + "0" + "," + string.Empty + "," + string.Empty;
                        WriteData(Data);
                        logger.LogStatus("RowNumber --" + RowData[0] + "-- Invalid Url Setting Url Value 0");
                    }
                }
            }
            catch (Exception ex)
            {
                logger.LogDebug("Error --" + ex.Message);
            }
        }
        public Dictionary<string, string> AddSpecificGroupUser(ref GlobusHttpHelper HttpHelper, LinkedinUser objLinkedinUser, string gid)
        {
            string endName = string.Empty;
            string DeegreeConn = string.Empty;
            string endKey = string.Empty;
            string Locality = string.Empty;
            string Val_sourceAlias = string.Empty;
            string Val_key = string.Empty;
            string Val_defaultText = string.Empty;
            string Name = string.Empty;
            string Val_CsrToken = string.Empty;
            string Val_Subject = string.Empty;
            string Val_greeting = string.Empty;
            string Val_AuthToken = string.Empty;
            string Val_AuthType = string.Empty;
            string val_trk = string.Empty;
            string Val_lastName = string.Empty;
            string html = string.Empty;
            string Title = string.Empty;

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

            string titleCurrenttitle = string.Empty;
            string titleCurrenttitle2 = string.Empty;
            string titleCurrenttitle3 = string.Empty;
            string titleCurrenttitle4 = string.Empty;
            string Skill = string.Empty;
            string TypeOfProfile = "Public";
            List<string> EducationList = new List<string>();
            string Finaldata = string.Empty;
            string EducationCollection = string.Empty;
            List<string> checkerlst = new List<string>();
            List<string> checkgrplist = new List<string>();
            string groupscollectin = string.Empty;
            string strFamilyName = string.Empty;
            string LDS_LoginID = string.Empty;
            string LDS_Websites = string.Empty;
            string LDS_UserProfileLink = string.Empty;
            string LDS_CurrentTitle = string.Empty;
            string LDS_Experience = string.Empty;
            string LDS_UserContact = string.Empty;
            string LDS_PastTitles = string.Empty;
            string LDS_BackGround_Summary = string.Empty;
            string LDS_Desc_AllComp = string.Empty;
            string Company = string.Empty;
            List<string> lstpasttitle = new List<string>();
            List<string> checkpasttitle = new List<string>();
            string csrfToken = string.Empty;
            string pageSource = string.Empty;
            string[] RgxSikValue = new string[] { };
            string[] RgxPageNo = new string[] { };
            string sikvalue = string.Empty;
            int pageno = 25;
            int counter = 0;

            string group_Url = string.Empty;
            string pagination_url = string.Empty;

            string groupId = string.Empty;
            string UserID = string.Empty;

            #endregion


            try
            {
                HttpHelper = objLinkedinUser.globusHttpHelper;
                UserID = objLinkedinUser.username;
                GroupSpecMem.Clear();
                GroupName = gid.Split('^')[0];
                groupId = gid.Split(':')[1];
                string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/home?trk=hb_tab_home_top"));

                if (pageSource1.Contains("csrfToken"))
                {
                    csrfToken = pageSource1.Substring(pageSource1.IndexOf("csrfToken"), 50);
                    string[] Arr = csrfToken.Split('>');
                    csrfToken = Arr[0];
                    csrfToken = csrfToken.Replace(":", "%3A").Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty).Replace("\n", string.Empty).Replace(">", string.Empty).Replace("<script src", string.Empty);
                    csrfToken = csrfToken.Trim();
                }



                for (int i = 1; i <= pageno; i++)
                {
                    counter++;

                    string[] RgxGroupData = new string[] { };

                    #region with group search
                    if (WithGroupSearch == true)
                    {

                        string txid = (UnixTimestampFromDateTime(System.DateTime.Now) * 1000).ToString();

                        if (counter == 1)
                        {

                            //  pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[2]));

                            pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[1]));

                            string Gid = string.Empty;
                            try
                            {
                                Gid = gid.Split(':')[1];
                            }
                            catch (Exception ex)
                            {
                            }
                            string URL = "https://www.linkedin.com/groups?viewMembers=&gid=" + Gid;
                            pageSource = HttpHelper.getHtmlfromUrl(new Uri(URL));

                            RgxSikValue = System.Text.RegularExpressions.Regex.Split(pageSource, "sik");
                            try
                            {
                                sikvalue = RgxSikValue[1].Split('&')[0].Replace("=", string.Empty);
                            }
                            catch { }

                            try
                            {
                                if (NumberHelper.ValidateNumber(sikvalue))
                                {
                                    sikvalue = sikvalue.Split('\"')[0];
                                }
                                else
                                {
                                    sikvalue = sikvalue.Split('\"')[0];
                                }
                            }
                            catch
                            {
                                sikvalue = sikvalue.Split('\"')[0];
                            }

                            //if (pageSource.Contains("<p class=\"paginate\">"))
                            //{
                            //    pagination_url = Utils.getBetween(pageSource, "<p class=\"paginate\">", "</a>");
                            //    pagination_url = Utils.getBetween(pagination_url, "href=\"", "\">").Replace("amp;", "");
                            //    pagination_url = "https://www.linkedin.com" + pagination_url;
                            //}

                            if (!string.IsNullOrEmpty(sikvalue))
                            {

                                //string postdata = "csrfToken=" + csrfToken + "&searchField=" + SearchKeyword + "&searchMembers=submit&searchMembers=Search&gid=" + gid.Split(':')[2] + "&goback=.gna_" + gid.Split(':')[2] + "";
                                //pageSource = HttpHelper.postFormDataRef(new Uri("https://www.linkedin.com/groups"), postdata, "http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[2] + "&sik=" + txid + "&split_page=" + i + "&goback=%2Egna_" + gid.Split(':')[2] + "", "", "");
                                #region Commented by sharan
                                string postdata = "csrfToken=" + csrfToken + "&searchField=" + SearchKeyword + "&searchMembers=submit&searchMembers=Search&gid=" + gid.Split(':')[1] + "&goback=.gna_" + gid.Split(':')[1] + "";
                                pageSource = HttpHelper.postFormDataRef(new Uri("https://www.linkedin.com/groups"), postdata, "http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[1] + "&sik=" + txid + "&split_page=" + i + "&goback=%2Egna_" + gid.Split(':')[1] + "", "", "");
                                #endregion

                                #region written by sharan
                                pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/grp/members?csrfToken=" + csrfToken + "&search=" + SearchKeyword.Replace(" ", "+") + "&gid=" + gid.Split(':')[1]));
                                #endregion
                                //string postdata = "csrfToken=" + csrfToken + "&searchField=" + SearchKeyword + "&searchMembers=submit&searchMembers=Search&gid=" + gid.Split(':')[1] + "&goback=.gna_" + gid.Split(':')[1] + "";
                                //pageSource = HttpHelper.postFormDataRef(new Uri("http://www.linkedin.com/groups"), postdata, "http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[1] + "&sik=" + txid + "&split_page=" + i + "&goback=%2Egna_" + gid.Split(':')[1] + "", "", "");

                            }
                            else
                            {

                                pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/grp/members?csrfToken=" + csrfToken + "&search=" + SearchKeyword.Replace(" ", "+") + "&gid=" + gid.Split(':')[1]));

                                // pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/grp/members?csrfToken=" + csrfToken + "&search=" + SearchKeyword.Replace(" ", "+") + "&gid=" + gid.Split(':')[1]));

                            }
                        }

                        if (!string.IsNullOrEmpty(sikvalue))
                        {
                            if (counter > 1)
                            {


                                // string getdata = "http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[2] + "&sik=" + txid + "&split_page=" + i + "&goback=%2Egna_" + gid.Split(':')[2] + "";
                                string getdata = "http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[1] + "&sik=" + txid + "&split_page=" + i + "&goback=%2Egna_" + gid.Split(':')[1] + "";
                                string new_pagination_url = pagination_url;
                                new_pagination_url = Utils.getBetween("###" + new_pagination_url, "###", "page=");
                                new_pagination_url = new_pagination_url + "page=" + counter;
                                pageSource = HttpHelper.getHtmlfromUrl(new Uri(new_pagination_url));
                                //   pageSource = HttpHelper.getHtmlfromUrl(new Uri(getdata));


                                // string getdata = "http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[1] + "&sik=" + txid + "&split_page=" + i + "&goback=%2Egna_" + gid.Split(':')[1] + "";
                                //  pageSource = HttpHelper.getHtmlfromUrl(new Uri(getdata));

                            }



                            RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"member\">");


                            if (counter == 1)
                            {
                                try
                                {
                                    RgxPageNo = System.Text.RegularExpressions.Regex.Split(pageSource, "<h3 class=\"page-title\">Search Results: <span>");
                                    pageno = Convert.ToInt32(RgxPageNo[1].Split('<')[0].Replace("(", string.Empty).Replace(")", string.Empty).Replace("+", string.Empty).Trim());
                                    pageno = pageno / 20 + 1;
                                }
                                catch { }

                                if (pageno > 25)
                                {
                                    pageno = 25;
                                }

                                try
                                {
                                    if (pageSource.Contains("<p class=\"paginate\">"))
                                    {
                                        pagination_url = Utils.getBetween(pageSource, "<p class=\"paginate\">", "</a>");
                                        pagination_url = Utils.getBetween(pagination_url, "href=\"", "\">").Replace("amp;", "");
                                        pagination_url = "https://www.linkedin.com" + pagination_url;
                                        pagination_url = pagination_url.Replace("amp;", "");
                                    }
                                }
                                catch
                                { }
                            }
                        }
                        else
                        {
                            // RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"member\">");
                            if (counter > 1)
                            {


                                //string getdata = "https://www.linkedin.com/grp/members?csrfToken=" + csrfToken + "&search=" + SearchKeyword.Replace(" ", "+") + "&gid=" + gid.Split(':')[2] + "&page="+i;

                                //string getdata = "https://www.linkedin.com/grp/members?csrfToken=" + csrfToken + "&search=" + SearchKeyword.Replace(" ", "+") + "&gid=" + gid.Split(':')[2] + "&page=" + i;

                                string new_pagination_url = pagination_url;
                                new_pagination_url = Utils.getBetween("###" + new_pagination_url, "###", "page=");
                                new_pagination_url = new_pagination_url + "page=" + counter;
                                pageSource = HttpHelper.getHtmlfromUrl(new Uri(new_pagination_url));

                                // pageSource = HttpHelper.getHtmlfromUrl(new Uri(getdata));
                            }


                            if (string.IsNullOrEmpty(sikvalue) && counter == 1)
                            {
                                try
                                {
                                    if (pageSource.Contains("<p class=\"paginate\">"))
                                    {
                                        pagination_url = Utils.getBetween(pageSource, "<p class=\"paginate\">", "</a>");
                                        pagination_url = Utils.getBetween(pagination_url, "href=\"", "\">").Replace("amp;", "");
                                        pagination_url = "https://www.linkedin.com" + pagination_url;
                                        pagination_url = pagination_url.Replace("amp;", "");
                                    }
                                }
                                catch
                                { }
                            }



                            RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"member\">");

                            if (counter == 1)
                            {
                                try
                                {
                                    RgxPageNo = System.Text.RegularExpressions.Regex.Split(pageSource, "<h3 class=\"page-title\">Search Results <span>");
                                    pageno = Convert.ToInt32(RgxPageNo[1].Split('<')[0].Replace("(", string.Empty).Replace(")", string.Empty).Replace("+", string.Empty).Trim());
                                    pageno = pageno / 20 + 1;
                                }
                                catch { }

                                if (pageno > 25)
                                {
                                    pageno = 25;
                                }
                            }
                        }
                    }

                    #endregion

                    else
                    {
                        //pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/groups?viewMembers=&gid=" + gid.Split(':')[2] + "&split_page=" + i + ""));
                        pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/grp/members?gid=" + gid.Split(':')[1] + "&page=" + i));

                        group_Url = "https://www.linkedin.com/grp/members?gid=" + gid.Split(':')[1];


                        RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"member\" id=\"");
                        if (RgxGroupData.Length == 1)
                        {
                            RgxGroupData = Regex.Split(pageSource, "<span class=\"new-miniprofile-container\"");
                            if (RgxGroupData.Length == 1)
                            {
                                break;
                            }
                        }
                    }

                    #region for csv
                    if (WithCsvinAddFriend == true)
                    {
                        List<string> PageSerchUrl = ChilkatBasedRegex.GettingAllUrls(pageSource, "profile/view?id");
                        string FrnAcceptUrL = string.Empty;
                        foreach (string item in PageSerchUrl)
                        {
                            try
                            {
                                if (item.Contains("/profile/view?id"))
                                {
                                    FrnAcceptUrL = "http://www.linkedin.com" + item;
                                    string[] urll = Regex.Split(FrnAcceptUrL, "&authType");
                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ " + FrnAcceptUrL + " ]");

                                    string stringSource = HttpHelper.getHtmlfromUrl(new Uri(FrnAcceptUrL));

                                    #region GroupMemId
                                    try
                                    {
                                        string[] gid1 = FrnAcceptUrL.Split('&');
                                        GroupMemId = gid1[0].Replace("http://www.linkedin.com/profile/view?id=", string.Empty);
                                    }
                                    catch { }
                                    #endregion

                                    #region Name
                                    try
                                    {
                                        try
                                        {
                                            strFamilyName = stringSource.Substring(stringSource.IndexOf("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\""), (stringSource.IndexOf("i18n__expand_your_network_to_see_more", stringSource.IndexOf("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\"")) - stringSource.IndexOf("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\""))).Replace("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\"", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim();
                                        }
                                        catch
                                        {
                                            try
                                            {
                                                strFamilyName = stringSource.Substring(stringSource.IndexOf("i18n__Overview_for_X"), (stringSource.IndexOf(",", stringSource.IndexOf("i18n__Overview_for_X")) - stringSource.IndexOf("i18n__Overview_for_X"))).Replace("i18n__Overview_for_X", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":Overview for", "").Trim();

                                            }
                                            catch { }
                                        }
                                    }
                                    catch { }

                                    #endregion

                                    #region Namesplitation
                                    string[] NameArr = new string[5];
                                    if (strFamilyName.Contains(" "))
                                    {
                                        try
                                        {
                                            NameArr = Regex.Split(strFamilyName, " ");
                                        }
                                        catch { }
                                    }
                                    #endregion

                                    #region FirstName
                                    try
                                    {
                                        firstname = NameArr[0];
                                    }
                                    catch { }
                                    #endregion

                                    #region LastName



                                    try
                                    {
                                        lastname = NameArr[1];

                                        if (NameArr.Count() == 3)
                                        {
                                            lastname = NameArr[1] + " " + NameArr[2];
                                        }

                                        if (lastname.Contains("}]"))
                                        {

                                            #region Name
                                            try
                                            {
                                                try
                                                {
                                                    strFamilyName = stringSource.Substring(stringSource.IndexOf("<span class=\"n fn\">")).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim();
                                                }
                                                catch
                                                {
                                                    try
                                                    {
                                                        strFamilyName = stringSource.Substring(stringSource.IndexOf("fmt__full_name\":"), (stringSource.IndexOf(",", stringSource.IndexOf("fmt__full_name\":")) - stringSource.IndexOf("fmt__full_name\":"))).Replace("fmt__full_name\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim();

                                                    }
                                                    catch { }
                                                }
                                            }
                                            catch { }
                                            #endregion
                                        }
                                    }
                                    catch { }
                                    #endregion

                                    #region Company
                                    Company = string.Empty;
                                    try
                                    {
                                        try
                                        {
                                            try
                                            {
                                                //Company = stringSource.Substring(stringSource.IndexOf("visible\":true,\"memberHeadline"), (stringSource.IndexOf("memberID", stringSource.IndexOf("visible\":true,\"memberHeadline")) - stringSource.IndexOf("visible\":true,\"memberHeadline"))).Replace("visible\":true,\"memberHeadline", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("   ", string.Empty).Trim();
                                                Company = stringSource.Substring(stringSource.IndexOf("\"memberHeadline"), (stringSource.IndexOf("memberID", stringSource.IndexOf("\"memberHeadline")) - stringSource.IndexOf("\"memberHeadline"))).Replace("\"memberHeadline", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("i18n__LocationLocationcompletenessLevel4", string.Empty).Replace("visibletrue", "").Replace("isPortfoliofalse", string.Empty).Replace("isLNLedtrue", string.Empty).Trim();
                                            }
                                            catch
                                            {
                                            }

                                            if (string.IsNullOrEmpty(Company))
                                            {
                                                try
                                                {
                                                    //memberHeadline
                                                    Company = stringSource.Substring(stringSource.IndexOf("memberHeadline\":"), (stringSource.IndexOf(",", stringSource.IndexOf("memberHeadline\":")) - stringSource.IndexOf("memberHeadline\":"))).Replace("memberHeadline\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("   ", string.Empty).Replace(":", "").Replace("&dsh;", "").Replace("&amp", "").Replace(";", "").Replace("isPortfoliofalse", string.Empty).Replace("isLNLedtrue", string.Empty).Trim();
                                                }
                                                catch
                                                {
                                                }

                                            }

                                            titlecurrent = string.Empty;
                                            companycurrent = string.Empty;
                                            string[] strdesigandcompany = new string[4];
                                            if (Company.Contains(" at ") || Company.Contains(" of "))
                                            {
                                                try
                                                {
                                                    strdesigandcompany = Regex.Split(Company, " at ");

                                                    if (strdesigandcompany.Count() == 1)
                                                    {
                                                        strdesigandcompany = Regex.Split(Company, " of ");
                                                    }
                                                }
                                                catch { }

                                                #region Title
                                                try
                                                {
                                                    titlecurrent = strdesigandcompany[0];
                                                }
                                                catch { }
                                                #endregion

                                                #region Current Company
                                                try
                                                {
                                                    companycurrent = strdesigandcompany[1];
                                                }
                                                catch { }
                                                #endregion
                                            }

                                            if (titlecurrent == string.Empty)
                                            {
                                                titlecurrent = Company;
                                            }
                                        }
                                        catch { }

                                        #region PastCompany
                                        string[] companylist = Regex.Split(stringSource, "companyName\"");
                                        string AllComapny = string.Empty;

                                        string Companyname = string.Empty;
                                        checkerlst.Clear();
                                        foreach (string item1 in companylist)
                                        {
                                            try
                                            {
                                                if (!item1.Contains("<!DOCTYPE html>"))
                                                {
                                                    Companyname = item1.Substring(item1.IndexOf(":"), (item1.IndexOf(",", item1.IndexOf(":")) - item1.IndexOf(":"))).Replace(":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("]", string.Empty).Replace("}", string.Empty).Trim();
                                                    //Checklist.Add(item);
                                                    string items = item1;
                                                    checkerlst.Add(Companyname);
                                                    checkerlst = checkerlst.Distinct().ToList();
                                                }
                                            }
                                            catch { }
                                        }
                                        AllComapny = string.Empty;
                                        foreach (string item1 in checkerlst)
                                        {
                                            if (string.IsNullOrEmpty(AllComapny))
                                            {
                                                AllComapny = item1.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                                            }
                                            else
                                            {
                                                AllComapny = AllComapny + " : " + item1.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                                            }
                                        }

                                        if (companycurrent == string.Empty)
                                        {
                                            companycurrent = checkerlst[0].ToString();
                                        }
                                        #endregion

                                    #endregion Company

                                        #region Company Descripription

                                        try
                                        {
                                            string[] str_CompanyDesc = Regex.Split(stringSource, "showSummarySection");

                                            foreach (string item2 in str_CompanyDesc)
                                            {
                                                try
                                                {
                                                    string Current_Company = string.Empty;
                                                    if (!item2.Contains("<!DOCTYPE html>"))
                                                    {
                                                        int startindex = item2.IndexOf("specialties\":\"");

                                                        if (startindex > 0)
                                                        {
                                                            try
                                                            {
                                                                string start = item2.Substring(startindex).Replace("specialties\":", "");
                                                                int endindex = start.IndexOf("\",\"associatedWith\"");
                                                                string end = start.Substring(0, endindex);
                                                                Current_Company = end.Replace(",\"specialties_lb\":", string.Empty).Replace("\"", string.Empty).Replace("summary_lb", "Summary").Replace(",", ";").Replace("\"u002", "-");
                                                                LDS_BackGround_Summary = Current_Company;
                                                            }
                                                            catch { }
                                                        }

                                                    }

                                                    if (!item2.Contains("<!DOCTYPE html>"))
                                                    {
                                                        int startindex = item2.IndexOf("\"summary_lb\"");

                                                        if (startindex > 0)
                                                        {
                                                            try
                                                            {
                                                                string start = item2.Substring(startindex).Replace("\"summary_lb\"", "");
                                                                int endindex = start.IndexOf("\",\"associatedWith\"");
                                                                string end = start.Substring(0, endindex);
                                                                Current_Company = end.Replace(",\"specialties_lb\":", string.Empty).Replace("<br>", string.Empty).Replace("\n\"", string.Empty).Replace("\"", string.Empty).Replace("summary_lb", "Summary").Replace(",", ";").Replace("u002", "-").Replace(":", string.Empty);
                                                                LDS_BackGround_Summary = Current_Company;
                                                            }
                                                            catch { }
                                                        }

                                                    }

                                                }
                                                catch { }
                                            }
                                        }
                                        catch { }

                                        #endregion

                                        #region Education
                                        EducationCollection = string.Empty;
                                        try
                                        {
                                            try
                                            {
                                                EducationCollection = stringSource.Substring(stringSource.IndexOf("\"schoolName\":"), (stringSource.IndexOf(",", stringSource.IndexOf("\"schoolName\":")) - stringSource.IndexOf("\"schoolName\":"))).Replace("\"schoolName\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim();
                                            }
                                            catch
                                            {
                                                try
                                                {
                                                    //  education1 = stringSource.Substring(stringSource.IndexOf("i18n__Overview_for_X"), (stringSource.IndexOf(",", stringSource.IndexOf("i18n__Overview_for_X")) - stringSource.IndexOf("i18n__Overview_for_X"))).Replace("i18n__Overview_for_X", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":Overview for", "").Trim();

                                                }
                                                catch { }
                                            }
                                        }
                                        catch { }

                                        #endregion

                                        #region Email
                                        try
                                        {
                                            string[] str_Email = Regex.Split(stringSource, "email\"");
                                            USERemail = stringSource.Substring(stringSource.IndexOf("[{\"email\":"), (stringSource.IndexOf("}]", stringSource.IndexOf("[{\"email\":")) - stringSource.IndexOf("[{\"email\":"))).Replace("[{\"email\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                                        }
                                        catch (Exception ex)
                                        {

                                        }
                                        #endregion Email

                                        #region Website
                                        Website = string.Empty;
                                        try
                                        {
                                            Website = stringSource.Substring(stringSource.IndexOf("[{\"URL\":"), (stringSource.IndexOf(",", stringSource.IndexOf("[{\"URL\":")) - stringSource.IndexOf("[{\"URL\":"))).Replace("[{\"URL\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace("}]", string.Empty).Trim();
                                        }
                                        catch { }
                                        #endregion Website

                                        #region location
                                        location = string.Empty;
                                        try
                                        {
                                            location = stringSource.Substring(stringSource.IndexOf("Country\",\"fmt__location\":"), (stringSource.IndexOf("i18n_no_location_matches", stringSource.IndexOf("Country\",\"fmt__location\":")) - stringSource.IndexOf("Country\",\"fmt__location\":"))).Replace("Country\",\"fmt__location\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(":", string.Empty).Replace(",", string.Empty).Trim();
                                        }
                                        catch (Exception ex)
                                        {
                                            try
                                            {
                                                if (string.IsNullOrEmpty(location))
                                                {
                                                    int startindex = stringSource.IndexOf("\"fmt_location\":\"");
                                                    if (startindex > 0)
                                                    {
                                                        string start = stringSource.Substring(startindex).Replace("\"fmt_location\":\"", "");
                                                        int endindex = start.IndexOf("\",");
                                                        string end = start.Substring(0, endindex);
                                                        country = end;
                                                    }
                                                }
                                            }
                                            catch (Exception ex1)
                                            {

                                            }
                                        }

                                        #endregion location

                                        #region Country
                                        try
                                        {
                                            int startindex = stringSource.IndexOf("\"locationName\":\"");
                                            if (startindex > 0)
                                            {
                                                string start = stringSource.Substring(startindex).Replace("\"locationName\":\"", "");
                                                int endindex = start.IndexOf("\",");
                                                string end = start.Substring(0, endindex);
                                                location = end;
                                            }
                                        }
                                        catch (Exception ex)
                                        {

                                        }
                                        #endregion

                                        #region Industry
                                        Industry = string.Empty;
                                        try
                                        {
                                            //Industry = stringSource.Substring(stringSource.IndexOf("fmt__industry_highlight\":"), (stringSource.IndexOf(",", stringSource.IndexOf("fmt__industry_highlight\":")) - stringSource.IndexOf("fmt__industry_highlight\":"))).Replace("fmt__industry_highlight\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                                            int startindex = stringSource.IndexOf("\"industry_highlight\":\"");
                                            if (startindex > 0)
                                            {
                                                string start = stringSource.Substring(startindex).Replace("\"industry_highlight\":\"", "");
                                                int endindex = start.IndexOf("\",");
                                                string end = start.Substring(0, endindex).Replace("&amp;", "&");
                                                Industry = end;
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                        }
                                        #endregion Industry

                                        #region Connection
                                        Connection = string.Empty;
                                        try
                                        {
                                            //Connection = stringSource.Substring(stringSource.IndexOf("_count_string\":"), (stringSource.IndexOf(",", stringSource.IndexOf("_count_string\":")) - stringSource.IndexOf("_count_string\":"))).Replace("_count_string\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                                            int startindex = stringSource.IndexOf("\"numberOfConnections\":");
                                            if (startindex > 0)
                                            {
                                                string start = stringSource.Substring(startindex).Replace("\"numberOfConnections\":", "");
                                                int endindex = start.IndexOf(",");
                                                string end = start.Substring(0, endindex).Replace("&amp;", "&").Replace("}", string.Empty);
                                                Connection = end;
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                        }
                                        #endregion Connection

                                        #region Recommendation
                                        try
                                        {
                                            //recomandation = stringSource.Substring(stringSource.IndexOf("i18n__Recommend_Query\":"), (stringSource.IndexOf(",", stringSource.IndexOf("i18n__Recommend_Query\":")) - stringSource.IndexOf("i18n__Recommend_Query\":"))).Replace("i18n__Recommend_Query\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();         
                                            string PageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/profile/profile-v2-endorsements?id=" + GroupMemId + "&authType=OUT_OF_NETWORK&authToken=rXRG&goback=%2Efps_PBCK_*1_*1_*1_*1_*1_*1_tcs_*2_CP_I_us_*1_*1_false_1_R_*1_*51_*1_*51_true_*1_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2"));
                                            string[] arrayRecommendedName = Regex.Split(PageSource, "headline");
                                            List<string> ListRecommendationName = new List<string>();
                                            recomandation = string.Empty;
                                            foreach (var itemRecomName in arrayRecommendedName)
                                            {
                                                try
                                                {
                                                    if (!itemRecomName.Contains("Endorsements"))
                                                    {
                                                        try
                                                        {

                                                            int startindex = itemRecomName.IndexOf(":");
                                                            string start = itemRecomName.Substring(startindex);
                                                            int endIndex = start.IndexOf("\",");
                                                            string Heading = (start.Substring(0, endIndex).Replace("\"", string.Empty).Replace(":", string.Empty));

                                                            int startindex1 = itemRecomName.IndexOf("fmt__referrerfullName");
                                                            string start1 = itemRecomName.Substring(startindex1);
                                                            int endIndex1 = start1.IndexOf("\",");
                                                            Name = (start1.Substring(0, endIndex1).Replace("\"", string.Empty).Replace("fmt__referrerfullName", string.Empty).Replace(":", string.Empty));

                                                            ListRecommendationName.Add(Name + " : " + Heading);
                                                        }
                                                        catch { }
                                                    }
                                                }
                                                catch { }

                                            }

                                            foreach (var item5 in ListRecommendationName)
                                            {
                                                if (recomandation == string.Empty)
                                                {
                                                    recomandation = item5;
                                                }
                                                else
                                                {
                                                    recomandation += "  -  " + item5;
                                                }
                                            }

                                        }
                                        catch { }
                                        #endregion

                                        #region Experience
                                        LDS_Experience = string.Empty;
                                        if (LDS_Experience == string.Empty)
                                        {
                                            try
                                            {
                                                string[] array = Regex.Split(stringSource, "title_highlight");
                                                string exp = string.Empty;
                                                string comp = string.Empty;
                                                List<string> ListExperince = new List<string>();
                                                string SelItem = string.Empty;

                                                foreach (var itemGrps in array)
                                                {
                                                    try
                                                    {
                                                        if (itemGrps.Contains("title_pivot") && !itemGrps.Contains("<!DOCTYPE html")) //">Join
                                                        {
                                                            try
                                                            {

                                                                int startindex = itemGrps.IndexOf("\":\"");
                                                                string start = itemGrps.Substring(startindex);
                                                                int endIndex = start.IndexOf(",");
                                                                exp = (start.Substring(0, endIndex).Replace("\"", string.Empty).Replace(":", string.Empty).Replace("&amp", "&").Replace(";", string.Empty).Replace("\\u002d", "-").Replace("name:", string.Empty));

                                                            }
                                                            catch { }

                                                            try
                                                            {

                                                                int startindex1 = itemGrps.IndexOf("companyName");
                                                                string start1 = itemGrps.Substring(startindex1);
                                                                int endIndex1 = start1.IndexOf(",");
                                                                comp = (start1.Substring(0, endIndex1).Replace("\"", string.Empty).Replace("companyName", string.Empty).Replace(":", string.Empty).Replace(";", string.Empty).Replace("\\u002d", "-").Replace("name:", string.Empty));

                                                            }
                                                            catch { }

                                                            if (titlecurrent == string.Empty)
                                                            {
                                                                titlecurrent = exp;
                                                            }

                                                            if (companycurrent == string.Empty)
                                                            {
                                                                companycurrent = comp;
                                                            }

                                                            ListExperince.Add(exp + ":" + comp);

                                                        }
                                                    }
                                                    catch { }
                                                }

                                                foreach (var itemExp in ListExperince)
                                                {
                                                    if (LDS_Experience == string.Empty)
                                                    {
                                                        LDS_Experience = itemExp;
                                                    }
                                                    else
                                                    {
                                                        LDS_Experience += "  -  " + itemExp;
                                                    }
                                                }

                                            }
                                            catch { }
                                        }

                                        #endregion

                                        #region Group
                                        try
                                        {
                                            string PageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/profile/mappers?x-a=profile_v2_groups%2Cprofile_v2_follow%2Cprofile_v2_connections&x-p=profile_v2_discovery%2Erecords%3A4%2Ctop_card%2EprofileContactsIntegrationStatus%3A0%2Cprofile_v2_comparison_insight%2Edistance%3A1%2Cprofile_v2_right_fixed_discovery%2Eoffset%3A0%2Cprofile_v2_connections%2Edistance%3A1%2Cprofile_v2_right_fixed_discovery%2Erecords%3A4%2Cprofile_v2_network_overview_insight%2Edistance%3A1%2Cprofile_v2_right_top_discovery_teamlinkv2%2Eoffset%3A0%2Cprofile_v2_right_top_discovery_teamlinkv2%2Erecords%3A4%2Cprofile_v2_discovery%2Eoffset%3A0%2Cprofile_v2_summary_upsell%2EsummaryUpsell%3Atrue%2Cprofile_v2_network_overview_insight%2EnumConn%3A1668%2Ctop_card%2Etc%3Atrue&x-oa=bottomAliases&id=" + GroupMemId + "&locale=&snapshotID=&authToken=&authType=name&invAcpt=&notContactable=&primaryAction=&isPublic=false&sfd=true&_=1366115853014"));

                                            string[] array = Regex.Split(PageSource, "href=\"/groupRegistration?");
                                            string[] array1 = Regex.Split(PageSource, "groupRegistration?");
                                            List<string> ListGroupName = new List<string>();
                                            string SelItem = string.Empty;

                                            foreach (var itemGrps in array1)
                                            {
                                                try
                                                {
                                                    if (itemGrps.Contains("?gid=") && !itemGrps.Contains("<!DOCTYPE html")) //">Join
                                                    {
                                                        if (itemGrps.IndexOf("?gid=") == 0)
                                                        {
                                                            try
                                                            {
                                                                int startindex = itemGrps.IndexOf("\"name\":");
                                                                string start = itemGrps.Substring(startindex);
                                                                int endIndex = start.IndexOf(",");
                                                                ListGroupName.Add(start.Substring(0, endIndex).Replace("\"", string.Empty).Replace("amp", string.Empty).Replace("&", string.Empty).Replace(";", string.Empty).Replace("csrfToken", string.Empty).Replace("name:", string.Empty));
                                                            }
                                                            catch { }
                                                        }
                                                    }
                                                }
                                                catch { }
                                            }

                                            foreach (var item6 in ListGroupName)
                                            {
                                                if (groupscollectin == string.Empty)
                                                {
                                                    groupscollectin = item6;
                                                }
                                                else
                                                {
                                                    groupscollectin += "  -  " + item6;

                                                }
                                            }

                                        }
                                        catch { }

                                        #endregion

                                        #region skill and Expertise
                                        try
                                        {
                                            string[] strarr_skill = Regex.Split(stringSource, "endorse-item-name-text\"");
                                            string[] strarr_skill1 = Regex.Split(stringSource, "fmt__skill_name\"");
                                            if (strarr_skill.Count() >= 2)
                                            {
                                                foreach (string item7 in strarr_skill)
                                                {
                                                    try
                                                    {
                                                        if (!item7.Contains("!DOCTYPE html"))
                                                        {
                                                            try
                                                            {
                                                                string Grp = item7.Substring(item7.IndexOf("<"), (item7.IndexOf(">", item7.IndexOf("<")) - item7.IndexOf("<"))).Replace("<", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                                                                checkgrplist.Add(Grp);
                                                                checkgrplist.Distinct().ToList();
                                                            }
                                                            catch { }
                                                        }

                                                    }
                                                    catch { }
                                                }

                                                foreach (string item8 in checkgrplist)
                                                {
                                                    if (string.IsNullOrEmpty(Skill))
                                                    {
                                                        Skill = item8;
                                                    }
                                                    else
                                                    {
                                                        Skill = Skill + "  -  " + item8;
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                if (strarr_skill1.Count() >= 2)
                                                {
                                                    try
                                                    {
                                                        foreach (string skillitem in strarr_skill1)
                                                        {
                                                            if (!skillitem.Contains("!DOCTYPE html"))
                                                            {
                                                                try
                                                                {
                                                                    string Grp = skillitem.Substring(skillitem.IndexOf(":"), (skillitem.IndexOf("}", skillitem.IndexOf(":")) - skillitem.IndexOf(":"))).Replace(":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                                                                    checkgrplist.Add(Grp);
                                                                    checkgrplist.Distinct().ToList();
                                                                }
                                                                catch { }
                                                            }
                                                        }

                                                        foreach (string item9 in checkgrplist)
                                                        {
                                                            if (string.IsNullOrEmpty(Skill))
                                                            {
                                                                Skill = item9;
                                                            }
                                                            else
                                                            {
                                                                Skill = Skill + "  -  " + item9;
                                                            }
                                                        }
                                                    }
                                                    catch (Exception ex)
                                                    {

                                                    }
                                                }
                                            }
                                        }
                                        catch (Exception ex)
                                        {

                                        }

                                        #endregion

                                        #region Pasttitle and All Company Summary
                                        string[] pasttitles = Regex.Split(stringSource, "company_name");
                                        string pstTitlesitem = string.Empty;
                                        string pstDescCompitem = string.Empty;
                                        LDS_PastTitles = string.Empty;
                                        pasttitles = pasttitles.Skip(1).ToArray();
                                        foreach (string item10 in pasttitles)
                                        {
                                            if (item10.Contains("positionId"))
                                            {
                                                try
                                                {
                                                    int startindex = item10.IndexOf(":");
                                                    if (startindex > 0)
                                                    {
                                                        string start = item10.Substring(startindex).Replace(":\"", "");
                                                        int endindex = start.IndexOf("\",");
                                                        string end = start.Substring(0, endindex);
                                                        pstTitlesitem = end.Replace(",", ";");
                                                    }

                                                    if (string.IsNullOrEmpty(LDS_PastTitles))
                                                    {
                                                        LDS_PastTitles = pstTitlesitem;
                                                    }
                                                    else
                                                    {
                                                        LDS_PastTitles = LDS_PastTitles + "  :  " + pstTitlesitem;
                                                    }


                                                    int startindex1 = item10.IndexOf("summary_lb\":\"");
                                                    if (startindex > 0)
                                                    {
                                                        string start1 = item10.Substring(startindex1).Replace("summary_lb\":\"", "");
                                                        int endindex1 = 0;

                                                        if (start1.Contains("associatedWith"))
                                                        {
                                                            endindex1 = start1.IndexOf("\",\"associatedWith\"");

                                                            if (start1.Contains("\"}"))
                                                            {
                                                                endindex1 = start1.IndexOf("\"}");
                                                            }

                                                        }
                                                        else if (start1.Contains("\"}"))
                                                        {
                                                            endindex1 = start1.IndexOf("\"}");
                                                        }


                                                        string end1 = start1.Substring(0, endindex1);
                                                        pstDescCompitem = end1.Replace(",", ";").Replace("u002d", "-").Replace("<br>", string.Empty).Replace("\n\"", string.Empty);

                                                        if (pstDescCompitem.Contains("\";\"associatedWith"))
                                                        {
                                                            pstDescCompitem = Regex.Split(pstDescCompitem, "\";\"associatedWith")[0];
                                                        }
                                                    }

                                                    if (string.IsNullOrEmpty(LDS_Desc_AllComp))
                                                    {
                                                        LDS_Desc_AllComp = pstTitlesitem + "-" + pstDescCompitem + " ++ ";
                                                    }
                                                    else
                                                    {
                                                        LDS_Desc_AllComp = LDS_Desc_AllComp + pstTitlesitem + "-" + pstDescCompitem + " ++ ";
                                                    }
                                                }
                                                catch
                                                {
                                                }
                                            }

                                        }
                                        #endregion

                                        #region FullUrl
                                        try
                                        {
                                            string[] UrlFull = System.Text.RegularExpressions.Regex.Split(FrnAcceptUrL, "&authType");
                                            LDS_UserProfileLink = UrlFull[0];

                                            LDS_UserProfileLink = UrlFull[0];
                                            //  LDS_UserProfileLink = stringSource.Substring(stringSource.IndexOf("canonicalUrl\":"), (stringSource.IndexOf(",", stringSource.IndexOf("canonicalUrl\":")) - stringSource.IndexOf("canonicalUrl\":"))).Replace("canonicalUrl\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                                        }
                                        catch { }
                                        #endregion

                                        LDS_LoginID = objLinkedinUser.username;

                                        if (string.IsNullOrEmpty(firstname))
                                        {
                                            firstname = "Linkedin Member";
                                        }

                                        LDS_BackGround_Summary = LDS_BackGround_Summary.Replace("\n", "").Replace("-", "").Replace("d", "").Replace("&#x2022", "").Replace(";", "").Replace("\n", "").Replace(",", "").Replace("&#x201", "").Trim();

                                        LDS_Desc_AllComp = "NA";
                                        Skill = "NA";

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

                                    }
                                    catch { }
                                }

                            }
                            catch { }
                        }
                    }
                    #endregion

                    foreach (var GrpUser in RgxGroupData)
                    {
                        try
                        {
                            if (GrpUser.Contains("member"))
                            {
                                if (GrpUser.Contains("title=\"YOU") || GrpUser.Contains("<!DOCTYPE html>"))
                                {
                                    if (GrpUser.Contains("title=\"YOU"))
                                    {

                                    }
                                    continue;
                                }
                                string profileUrl = string.Empty;
                                try
                                {
                                    profileUrl = Utils.getBetween(GrpUser, "<a href=\"", "\">");
                                }
                                catch
                                {
                                }
                                try
                                {
                                    //data-li-fullName="Kashish Arora">Send message</a>

                                    int startindex = GrpUser.IndexOf("fullName=");
                                    if (startindex > 0)
                                    {
                                        endName = string.Empty;
                                        string start = GrpUser.Substring(startindex);
                                        int endIndex = start.IndexOf(">Send message<");
                                        if (endIndex == -1)
                                        {
                                            endIndex = start.IndexOf(">");
                                        }
                                        endName = start.Substring(0, endIndex).Replace("fullName=", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Replace("&amp;", "&").Replace("&quot;", "'").Replace("tracking=anetppl_sendmsg", string.Empty).Replace("tracking=anetppl_invite", string.Empty).Replace("\\u00e9", "é").Trim();
                                    }
                                    else
                                    {
                                        endName = string.Empty;
                                        int startindex1 = GrpUser.IndexOf("alt=");
                                        string start = GrpUser.Substring(startindex1).Replace("alt=\"", "");
                                        int endIndex = start.IndexOf("\"");
                                        try
                                        {
                                            endName = start.Substring(0, endIndex).Replace("alt=", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Replace(">", string.Empty).Replace("\"", string.Empty).Replace("&amp;", "&").Replace("&quot;", "'").Replace("tracking=anetppl_sendmsg", string.Empty).Replace("tracking=anetppl_invite", string.Empty).Replace("\\u00e9", "é").Trim();
                                        }
                                        catch { }
                                        try
                                        {
                                            if (string.IsNullOrEmpty(endName))
                                            {
                                                endName = start.Substring(start.IndexOf("alt="), start.IndexOf("class=", start.IndexOf("alt=")) - start.IndexOf("alt=")).Replace("alt=", string.Empty).Replace("alt=", string.Empty).Replace("\"", string.Empty).Replace("&quot;", "'").Replace("tracking=anetppl_sendmsg", string.Empty).Replace("tracking=anetppl_invite", string.Empty).Replace("\\u00e9", "é").Trim();
                                            }

                                        }
                                        catch { }
                                    }
                                }
                                catch
                                {

                                }

                                //Deegree connection
                                try
                                {
                                    int startindex = GrpUser.IndexOf("<span class=\"degree-icon\">");
                                    if (startindex > 0)
                                    {
                                        DeegreeConn = string.Empty;
                                        string start = GrpUser.Substring(startindex);
                                        int endIndex = start.IndexOf("<sup>");
                                        DeegreeConn = start.Substring(0, endIndex).Replace("<span class=\"degree-icon\">", string.Empty);

                                        if (DeegreeConn == "1")
                                        {
                                            DeegreeConn = DeegreeConn + "st";
                                        }
                                        else if (DeegreeConn == "2")
                                        {
                                            DeegreeConn = DeegreeConn + "nd";
                                        }
                                        else if (DeegreeConn == "3")
                                        {
                                            DeegreeConn = DeegreeConn + "rd";
                                        }
                                    }
                                    else
                                    {
                                        startindex = GrpUser.IndexOf("span class=\"degree-icon group\">");
                                        DeegreeConn = string.Empty;

                                        if (startindex > 0)
                                        {
                                            DeegreeConn = string.Empty;
                                            string start = GrpUser.Substring(startindex);
                                            int endIndex = start.IndexOf("</span>");
                                            DeegreeConn = start.Substring(0, endIndex).Replace("span class=\"degree-icon group\">", string.Empty);

                                        }

                                        if (DeegreeConn == string.Empty)
                                        {

                                            DeegreeConn = "3rd";
                                        }
                                    }

                                }

                                catch { }

                                try
                                {
                                    int startindex2 = GrpUser.IndexOf("memberId=");
                                    if (startindex2 > 0)
                                    {
                                        endKey = string.Empty;
                                        string start1 = GrpUser.Substring(startindex2);
                                        int endIndex1 = start1.IndexOf("data-li-fullName=");
                                        endKey = start1.Substring(0, endIndex1).Replace("memberId=", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Trim();
                                    }
                                    else
                                    {
                                        endKey = string.Empty;
                                        int startindex3 = GrpUser.IndexOf("member-");
                                        string start1 = GrpUser.Substring(startindex3);
                                        int endIndex1 = start1.IndexOf(">");
                                        endKey = start1.Substring(0, endIndex1).Replace("member-", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Replace(">", string.Empty).Replace("\"", string.Empty).Trim();
                                    }
                                }
                                catch
                                {

                                }

                                try
                                {
                                    GroupSpecMem.Add(endKey, " [" + GroupName.Replace(",", string.Empty) + " ] " + endName + " (" + DeegreeConn.Replace(",", string.Empty) + ")");
                                    string item = UserID + "," + GroupName.Replace(",", string.Empty) + "," + group_Url.Replace("'", "").Replace("\r", "").Replace(" ", "").Replace("\n", " ") + "," + endName + "," + profileUrl.Replace("'", "").Replace("\r", "").Replace(" ", "").Replace("\n", " ") + "," + DeegreeConn.Replace(",", string.Empty);
                                   // AddingLinkedInDataToCSVFile1(item);
                                    if (WithGroupSearch == true)
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Added Group Member : " + endName + " (" + DeegreeConn + ") with Search keyword : " + SearchKeyword + " ]");
                                        //  objfrmMain.AddLoggerLoggerForGroupScraper("[ " + DateTime.Now + " ] => [ Added Group Member : " + endName + " (" + DeegreeConn + ") with Search keyword : " + SearchKeyword + " ]");
                                    }
                                    else
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Added Group Member : " + endName + " ]");
                                    }
                                }
                                catch { }
                            }
                            else
                            {

                            }
                        }
                        catch { }
                    }



                    return GroupSpecMem;
                }

                #region new code_11_26

                if (GroupSpecMem.Count <= 0)
                {
                    List<string> lstNewMembers = new List<string>();
                    bool gotScrapeUrl = false;
                    int startPage = 10;

                  string  url = "https://www.linkedin.com/communities-api/v1/memberships/community/" + groupId + "?projection=MINI&count=20&start=0";
                GetItemToScrapeUrls:
                    List<string> lstitemForScrap = new List<string>();
             //   pageSource = HttpHelper.getHtmlfromUrl(new Uri(url), "https://www.linkedin.com/groups/" + groupId + "", "", "");


                #region Cookie settings
              //  string CookieDaata = "bcookie=\"v=2&e456608f-798a-4a30-8111-4abf66a2a2d2\"; bscookie=\"v=1&201504281150112c2cb966-888b-44d4-8fe3-2bed850fc88eAQH5LeTYIub6nyWgnwTdMWl9XSSvnwsJ\"; visit=\"v=1&M\"; _chartbeat2=vnNg6xd-hkBwUPD5.1439389439450.1439994463832.10000001; VID=V_2015_08_19_07_4913; ELOQUA=GUID=28AF04F863BF45A78F3AA16B2C88EFBC; BKUT=1439994600; sessionid=\"eyJkamFuZ29fdGltZXpvbmUiOiJBc2lhL0tvbGthdGEifQ:1a1DwL:Z1TtuNNPyqGqvT1Pix66crqU9RA\"; csrftoken=fGdgb242nAkaqdDI0T72TptnHK9Fq9MM; _ga=GA1.2.1307723840.1448360766; L1c=5eba1285; oz_props_fetch_size1_125011638=9; wutan=YjukjFsDQIHEoN/VG0Nwwa8w7dzs308V6oAfSeVHCY8=; L1e=4a2dae59; oz_props_fetch_size1_394473043=5; oz_props_fetch_size1_394482147=1; sl=\"v=1&y7Ik2\"; li_at=AQEDAReDUeMB8eJnAAABUXFNV2wAAAFRcbs0bEsAw1uzWq20X7lGOtdsUgxs31vuFr1q74cnHL82GBdRUIVjbPbKccr0gJVqHj9mqczMKjWVA417H7gRrQeFQARUNssZqNTx0aZZR1hyEmdxvf4iYbF1; liap=true; JSESSIONID=\"ajax:7383772031323678847\"; share_setting=PUBLIC; sdsc=1%3A1SZM1shxDNbLt36wZwCgPgvN58iw%3D; _lipt=0_0MPCZKVCxoBpoHR17D_hDUfM2NiX0FG-oN1B8U9sDtgK_Ydwh1Gw2TGDG8LSwwC-BWGgocnwaixcQM_gvLFHZRCDaMOR9vUNoFFU7Pv4sekUOXFI9ys8jl6QfmKapvABKOlY89bVv5mqx58JvuF7NyP6lyWIckctWO6k6UG0iu1y6ABeq4BLdi4Hx_r4fhtEsbUgeBtzZHE00OAoBcpWzyBorypcrsvu10vjpfQ4JrlkZcgesHUL0zqxRmg6dwbDlfWnQT0C4hwhjEdaTEVNTp; lidc=\"b=LB47:g=319:u=13:i=1449305064:t=1449390866:s=AQG1xLWNXv_mwQpQa_XpXXydwVB0xggq\"; lang=\"v=2&lang=en-us\"; RT=s=1449305300845&r=https%3A%2F%2Fwww.linkedin.com%2Fgroups%2F47307%2Fmembers";


              //  string[] CookieDaatalst = Regex.Split(CookieDaata, ";");
              //  HttpHelper.gCookies = new System.Net.CookieCollection();
              //  System.Net.CookieCollection CookieCollection =   new System.Net.CookieCollection();
                
              //  foreach (string itemlst in CookieDaatalst)
              //  {

              //      try
              //      {
                        
              //          string[] namevalue = Regex.Split(itemlst, "=");

              //          string name = namevalue[0].Replace(" ","");
              //          string value = namevalue[1].Replace(" ", "");

              //          string Domain = "linkedin.com";

              //          System.Net.Cookie cookie = new System.Net.Cookie();
              //          cookie.Name = name;
              //          cookie.Value = value;
              //          cookie.Domain = Domain;
              //          bool IsFound = false;
              //          try
              //          {
                         
              //              foreach (System.Net.Cookie cokieitem in HttpHelper.gCookies)
              //              {

              //                  if (cookie == cokieitem)
              //                  {
              //                      IsFound = true;
              //                      break;
              //                  }
              //              }
              //              if (!IsFound)
              //              {
              //                  HttpHelper.gCookies.Add(cookie);
              //              }
              //          }
              //          catch { };
              //      }
              //      catch { };
              //  }

                #endregion


                pageSource = HttpHelper.getHtmlfromUrl(new Uri(url), "https://www.linkedin.com/groups/" + groupId + "", "", "");
                    string[] arr = Regex.Split(pageSource, ".jpg\",\"name\":");
                    foreach (var itemArr in arr)
                    {
                        if (itemArr.Contains("{\"data\":[{\"profileUrl\""))
                        {
                            continue;
                        }

                        string memberName = string.Empty;
                        string memberId = string.Empty;

                        memberName = Utils.getBetween(itemArr, "\"", "\",\"");
                        memberId = Utils.getBetween(itemArr, "id\":\"", "\",\"");
                        GroupName = GroupName.Replace(",", string.Empty);
                        try
                        {
                            if (!memberName.Contains("data\":[{\""))
                            {
                                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Added Group Member : " + memberName + " ]");
                                GroupSpecMem.Add(memberId, " [" + GroupName + " ] " + memberName);
                            }

                        }
                        catch (Exception ex)
                        {
                            Console.Write(ex);
                        }


                        //string name = Utils.getBetween(itemArr, "\"", ",").Replace("\"", "");
                        //string memberId = Utils.getBetween(itemArr, "nonIterableMemberId\":", ",").Replace("\"", "");
                        string itemToScrapUrl = "https://www.linkedin.com/profile/view?id=" + memberId + "&authType=name&authToken=2ZLd";
                        if (!lstitemForScrap.Contains(itemToScrapUrl))
                        {
                            gotScrapeUrl = true;
                            lstitemForScrap.Add(itemToScrapUrl);
                        }
                    }
                    if (gotScrapeUrl)
                    {
                        //foreach (var itemForScrap in lstitemForScrap)
                        //{
                        //    if (!lstNewMembers.Contains(itemForScrap))
                        //    {
                        //        if (!obj_ClsScrapGroupMember.CrawlingLinkedInPage(itemForScrap, ref HttpHelper))
                        //        {
                        //            obj_ClsScrapGroupMember.CrawlingPageDataSource(itemForScrap, ref HttpHelper);
                        //        }
                        //        lstNewMembers.Add(itemForScrap);
                        //    }
                        //}

                        startPage = startPage + 10;
                        url = "https://www.linkedin.com/communities-api/v1/memberships/community/" + groupId + "?membershipStatus=MEMBER&start=" + startPage + "&projection=FULL";
                        gotScrapeUrl = false;
                        if (startPage <= 500)
                        {
                            goto GetItemToScrapeUrls;
                        }

                    }



                }
                #endregion
            }
            catch (Exception ex)
            {
            }
            return GroupSpecMem;
        }
Пример #35
0
        public void ExtractGroupsdetailsSearchScraper(ref FacebookUser fbUser)
        {
            try
            {
                GlobusHttpHelper objHelper = fbUser.globusHttpHelper;
                string           url       = string.Empty;

                if (SearchGroup_Membership == "all" && SearchGroup_Privacy == "all" && SearchGroup_Name == "all" && SearchGroup_About == "all")
                {
                    url = "https://www.facebook.com/search/groups/all";

                    string Response = objHelper.getHtmlfromUrl(new Uri(url));
                    string User     = string.Empty;


                    DataParser(Response, ref fbUser);

                    string AjaxResponse = AjaxPostForSearch(Response, Response, ref fbUser);


                    // string AjaxResponse = AjaxPostForSearch("", Response, ref FBuser);

                    while (!string.IsNullOrEmpty(AjaxResponse))
                    {
                        //if (Pagecounter < MaxItreation)
                        //{
                        string[] SerachList2 = System.Text.RegularExpressions.Regex.Split(AjaxResponse, "clearfix _zw");
                        if (GlobalExistCounter > 99)
                        {
                            Console.WriteLine("Page response not give the data for more time,so we skip the scraping process");
                            break;
                        }

                        foreach (string item in SerachList2)
                        {
                            try
                            {
                                if (!item.Contains("<!DOCTYPE html>"))
                                {
                                    if (GlobalExistCounter < 100)
                                    {
                                        DataParserAjax(AjaxResponse, ref fbUser);
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }
                            }
                            catch { };
                        }

                        AjaxResponse = AjaxPostForSearch(AjaxResponse, Response, ref fbUser);
                        Pagecounter  = Pagecounter + 1;
                    }
                }
                else
                {
                    url = "https://www.facebook.com/search/groups/all";

                    string Response = objHelper.getHtmlfromUrl(new Uri(url));

                    string AjaxUrl = "https://www.facebook.com/ajax/browse/null_state.php?grammar_version=ff07ed4d3774c70937c166803513a3957dc91241&__user=100003654049360&__a=1&__dyn=7n8ahyj35zoSt2u5KKAHyG85oCi8wIw&__req=1";

                    string AjaxResponce = AjaxPostForSearch(Response, Response, ref fbUser);
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }
        public Dictionary<string, string> GetGroupNames(ref GlobusHttpHelper HttpHelper, string user)
        {
            try
            {
              //  string url = "https://www.linkedin.com/profile/mappers?x-a=my_profile_follow%2Cmy_profile_groups&x-p=my_profile_summary_upsell%2EsummaryUpsell%3Atrue%2Cmy_profile_top_card%2Etc%3Atrue%2Cmy_profile_top_card%2EprofileContactsIntegrationStatus%3A0&x-oa=bottomAliases&id=327385798&locale=&snapshotID=&authToken=&authType=&invAcpt=&promoId=&notContactable=&primaryAction=&isPublic=false&sfd=false&_=1448346384101";
                string url = "https://www.linkedin.com";

                string pageSource = HttpHelper.getHtmlfromUrl(new Uri(url));

                string[] arr = Regex.Split(pageSource, "<h3>");
                string profId = Utils.getBetween(arr[2], "<a href=\"", "\"");
                pageSource = HttpHelper.getHtmlfromUrl(new Uri(profId));


                if (pageSource == "" || pageSource.Contains("Make sure you have cookies and Javascript enabled in your browser before signing in") || pageSource.Contains("manual_redirect_link"))
                {
                    Thread.Sleep(2000);
                    pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/myGroups?trk=nav_responsive_sub_nav_groups"));
                }

                if (pageSource == "" || pageSource.Contains("Make sure you have cookies and Javascript enabled in your browser before signing in") || pageSource.Contains("manual_redirect_link"))
                {
                    Thread.Sleep(2000);
                    pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/grp/"));
                }

                if (pageSource == "" || pageSource.Contains("Make sure you have cookies and Javascript enabled in your browser before signing in") || pageSource.Contains("manual_redirect_link"))
                {
                    Thread.Sleep(2000);
                    pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/myGroups?trk=nav_responsive_sub_nav_groups"));
                }

                if (pageSource.Contains("Your Groups") && pageSource.Contains("You may be interested in"))
                {
                    string[] RgxGroupData = Regex.Split(pageSource, "h3 class=\"title\"");
                    foreach (var GrpName in RgxGroupData)
                    {
                        string groupName = Utils.getBetween(GrpName, ">", "</h3>");
                        groupName = groupName + ":" + user;
                    }
                }
                if (pageSource.Contains("media-block has-activity"))
                {
                    string[] RgxGroupData = Regex.Split(pageSource, "media-content");

                    foreach (var GrpName in RgxGroupData)
                    {
                        string endName = string.Empty;
                        string endKey = string.Empty;

                        try
                        {
                            if (GrpName.Contains("<!DOCTYPE html>") || GrpName.Contains("Membership Pending"))
                            {
                                continue;
                            }

                            if (GrpName.Contains("<a href=\"/groups/") || (GrpName.Contains("<a href=\"/groups?")))
                            {
                                if ((GrpName.Contains("public")))
                                {
                                    try
                                    {
                                        int startindex = GrpName.IndexOf("class=\"public\"");
                                        string start = GrpName.Substring(startindex);
                                        int endIndex = start.IndexOf("</a>");
                                        endName = start.Substring(0, endIndex).Replace("title", string.Empty).Replace("=", string.Empty).Replace(">", string.Empty).Replace("groups", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Replace("&amp;", "&").Replace("classpublic", string.Empty).Replace("&quot;", "'").Replace(":", ";").Replace("This is an open group", string.Empty);
                                        endName = endName.Replace("&amp;", "&") + "^" + user;
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Info("Exception: " + ex);
                                    }

                                    try
                                    {
                                        endKey = "";
                                        int startindex1 = GrpName.IndexOf("group");
                                        string start1 = GrpName.Substring(startindex1);
                                        int endIndex1 = start1.IndexOf("?");
                                        endKey = start1.Substring(0, endIndex1).Replace("groups", string.Empty).Replace("/", string.Empty).Replace("<a href=", string.Empty).Replace("\"", string.Empty);

                                        if (endKey == string.Empty)
                                        {
                                            startindex1 = GrpName.IndexOf("gid=");
                                            start1 = GrpName.Substring(startindex1);
                                            endIndex1 = start1.IndexOf("&");
                                            endKey = start1.Substring(0, endIndex1).Replace("gid=", string.Empty).Trim();

                                            if (!NumberHelper.ValidateNumber(endKey))
                                            {
                                                try
                                                {
                                                    endKey = endKey.Split('\"')[0];
                                                }
                                                catch { }
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Info("Exception : " + ex);
                                    }

                                    if (endKey.Contains("analyticsURL"))
                                    {
                                        continue;
                                    }

                                    if (endKey == string.Empty)
                                    {
                                        try
                                        {
                                            int startindex2 = GrpName.IndexOf("gid=");
                                            string start2 = GrpName.Substring(startindex2);
                                            int endIndex2 = start2.IndexOf("&");
                                            endKey = start2.Substring(0, endIndex2).Replace("gid", string.Empty).Replace("=", string.Empty);
                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusLogHelper.log.Info("Exc");
                                        }
                                    }
                                    else
                                    {
                                        string[] endKeyLast = endKey.Split('-');
                                        try
                                        {
                                            if (NumberHelper.ValidateNumber(endKeyLast[1]))
                                            {
                                                endKey = endKeyLast[1];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[2]))
                                            {
                                                endKey = endKeyLast[2];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[3]))
                                            {
                                                endKey = endKeyLast[3];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[4]))
                                            {
                                                endKey = endKeyLast[4];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[5]))
                                            {
                                                endKey = endKeyLast[5];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[6]))
                                            {
                                                endKey = endKeyLast[6];
                                            }
                                        }
                                        catch { }
                                    }

                                    try
                                    {
                                        if (NumberHelper.ValidateNumber(endKey))
                                        {
                                            GroupName.Add(endName, endKey);
                                            GlobusLogHelper.log.Info("Group Name: " + endName);
                                        }
                                    }
                                    catch { }
                                }

                            }

                            if (GrpName.Contains("<a href=\"/groups/") || (GrpName.Contains("<a href=\"/groups?")))
                            {
                                if ((GrpName.Contains("private")))
                                {
                                    try
                                    {
                                        int startindex = GrpName.IndexOf("class=\"private\"");
                                        string start = GrpName.Substring(startindex);
                                        int endIndex = start.IndexOf("</a>");
                                        endName = start.Substring(0, endIndex).Replace("=", string.Empty).Replace(">", string.Empty).Replace("groups", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Replace("&amp;", "&").Replace("&quot;", "'").Replace(":", ";").Replace("classprivate", string.Empty);
                                        endName = endName.Replace("&amp;", "&") + "^" + user;
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Info("Exception : "+ex);
                                    }

                                    try
                                    {
                                        int startindex1 = GrpName.IndexOf("gid=");
                                        string start1 = GrpName.Substring(startindex1);
                                        int endIndex1 = start1.IndexOf("&");
                                        endKey = start1.Substring(0, endIndex1).Replace("gid=", string.Empty).Replace("/", string.Empty).Replace("<a href=", string.Empty).Replace("\"", string.Empty).Replace("class=blanket-target><a>groups?home=", string.Empty).Trim();

                                        if (endKey == string.Empty)
                                        {
                                            try
                                            {
                                                endKey = endKey.Split(' ')[0].Trim();
                                            }
                                            catch { }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                       GlobusLogHelper.log.Info("Exception : "+ex);
                                    }

                                    if (endKey.Contains("analyticsURL"))
                                    {
                                        continue;
                                    }

                                    if (endKey == string.Empty)
                                    {
                                        try
                                        {
                                            int startindex2 = GrpName.IndexOf("gid=");
                                            string start2 = GrpName.Substring(startindex2);
                                            int endIndex2 = start2.IndexOf("&");
                                            endKey = start2.Substring(0, endIndex2).Replace("gid", string.Empty).Replace("=", string.Empty);

                                            if (!NumberHelper.ValidateNumber(endKey))
                                            {
                                                try
                                                {
                                                    endKey = endKey.Split('\"')[0];
                                                }
                                                catch { }
                                            }

                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusLogHelper.log.Info("Exception : "+ex);
                                        }
                                    }
                                    else
                                    {
                                        string[] endKeyLast = endKey.Split('-');
                                        try
                                        {
                                            if (NumberHelper.ValidateNumber(endKeyLast[1]))
                                            {
                                                endKey = endKeyLast[1];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[2]))
                                            {
                                                endKey = endKeyLast[2];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[3]))
                                            {
                                                endKey = endKeyLast[3];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[4]))
                                            {
                                                endKey = endKeyLast[4];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[5]))
                                            {
                                                endKey = endKeyLast[5];
                                            }
                                            else if (NumberHelper.ValidateNumber(endKeyLast[6]))
                                            {
                                                endKey = endKeyLast[6];
                                            }
                                        }
                                        catch { }
                                    }

                                    try
                                    {
                                        if (NumberHelper.ValidateNumber(endKey))
                                        {
                                            GroupName.Add(endName, endKey);
                                        }
                                    }
                                    catch { }
                                }

                            }
                        }
                        catch { }
                    }

                }
                else if(pageSource.Contains("{\"content\":{\"Following\":"))
                {
                    string[] RgxGroupData = Regex.Split(pageSource, "groupID");
                    RgxGroupData = RgxGroupData.Skip(1).ToArray();
                    foreach(string item in RgxGroupData)
                    {
                        try
                        {
                            string grpName = string.Empty;
                            string grpId = string.Empty;

                            grpName = Utils.getBetween(item, "name\":\"", "\",\"");
                            grpId = Utils.getBetween(item, "\":", ",\"");

                            grpName = grpName + "^" + user;
                            if (NumberHelper.ValidateNumber(grpId))
                            {
                                GroupName.Add(grpName, grpId);
                                GlobusLogHelper.log.Info("Group Name : " + grpName);
                            }
                        }
                        catch (Exception ex)
                        { 

                        }

                    }

                }
                else if (pageSource.Contains("link_groups_settings") || GroupName.Count==0)
                {
                    try
                    {
                        //string[] arr1 = Regex.Split(pageSource, "<h3>");
                        //string profileId = Utils.getBetween(arr1[2], "<a href=\"", "\"");
                        //pageSource = HttpHelper.getHtmlfromUrl(new Uri(profileId));

                        string[] arr1_groups = Regex.Split(pageSource, "link_groups_settings");
                        arr1_groups = arr1_groups.Skip(1).ToArray();

                        foreach (string item in arr1_groups)
                        {
                            try
                            {
                                string grpName = string.Empty;
                                string grpId = string.Empty;

                                grpName = Utils.getBetween(item, "name\":\"", "\",\"");
                                grpId = Utils.getBetween(item, "&gid=", "&");
                                grpName = grpName + "^" + user;
                                if (NumberHelper.ValidateNumber(grpId))
                                {
                                    GroupName.Add(grpName, grpId);
                                    GlobusLogHelper.log.Info("Group Name : " + grpName);
                                }
                            }
                            catch (Exception ex)
                            { }

                        }


                    }
                    catch
                    { }


                    if (GroupName.Count == 0)
                    {
                        try
                        {
                            string url_to_get_Groups = string.Empty;
                            url_to_get_Groups = Utils.getBetween(pageSource, "<div id=\"groups-container", "</div>");
                            url_to_get_Groups = Utils.getBetween(url_to_get_Groups, "url\":\"", "\"})");

                            pageSource = HttpHelper.getHtmlfromUrl(new Uri(url_to_get_Groups));

                            string[] arr1_groups = Regex.Split(pageSource, "link_groups_settings");
                            arr1_groups = arr1_groups.Skip(1).ToArray();

                            foreach (string item in arr1_groups)
                            {
                                try
                                {
                                    string grpName = string.Empty;
                                    string grpId = string.Empty;

                                    grpName = Utils.getBetween(item, "name\":\"", "\",\"");
                                    grpName = grpName.Replace(":", "");
                                    grpId = Utils.getBetween(item, "&gid=", "&");

                                    grpName = grpName + "^" + user;
                                    if (NumberHelper.ValidateNumber(grpId))
                                    {
                                        GroupName.Add(grpName, grpId);
                                        GlobusLogHelper.log.Info("Group Name : " + grpName.Split('^')[0]);
                                    }
                                }
                                catch
                                { }
                            }


                        }
                        catch
                        { }
                    }
                }

                else
                {
                    if (pageSource.Contains("View More</span>"))
                    {
                        pageSource = Utils.getBetween(pageSource, "<ul class=\"group-list\">", "View More</span>");
                    }
                    else
                    {
                        string pageSource1 = Utils.getBetween(pageSource, "<ul class=\"group-list\">", "<li class=\"find-more\">");
                    }
                    string[] RgxGroupData = Regex.Split(pageSource, "h3 class=\"title\"");//"<li class=");
                    RgxGroupData = RgxGroupData.Skip(1).ToArray();
                    foreach (var GrpName in RgxGroupData)
                    {
                        string endName = string.Empty;
                        string endKey = string.Empty;

                        try
                        {
                            if (GrpName.Contains("<!DOCTYPE html>") || GrpName.Contains("Pending"))
                            {
                                continue;
                            }

                            //if (GrpName.Contains("<a href=\"/groups/") || (GrpName.Contains("<a href=\"/groups?")))
                            //{
                            //if ((GrpName.Contains("title")))
                            //{
                            try
                            {
                                int startindex = GrpName.IndexOf("class=\"title\"");
                                string start = GrpName.Substring(startindex).Replace("class=\"title\"", string.Empty);
                                int endIndex = start.IndexOf("<span");
                                endName = start.Substring(0, endIndex).Replace("title", string.Empty).Replace("=", string.Empty).Replace(">", string.Empty).Replace("groups", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Replace("&amp;", "&").Replace("classpublic", string.Empty).Replace("&quot;", "'").Replace(":", ";").Replace("This is an open group", string.Empty).Replace("class", "").Replace("&#39;", "'");
                                endName = Utils.getBetween(GrpName, ">", "</h3>");

                                if (endName.Contains("<span"))
                                {
                                    string[] RegexSpan = Regex.Split(endName, "<span");
                                    endName = RegexSpan[0];
                                    endName = endName.Replace(":", "").Replace("&amp;", "");
                                }
                                if (endName.Contains("<div group-activity"))
                                {
                                    endIndex = endName.IndexOf("<h3");
                                    endName = endName.Substring(0, endIndex).Replace("<h3", "").Replace("<div group-activity", "");
                                }
                                endName = endName.Replace("&amp;", "&") + "^" + user;
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Info("Exception : " + ex);
                            }

                            try
                            {
                                endKey = "";
                                //int startindex1 = GrpName.IndexOf("group");
                                //string start1 = GrpName.Substring(startindex1);
                                //int endIndex1 = start1.IndexOf("?");
                                //endKey = start1.Substring(0, endIndex1).Replace("groups", string.Empty).Replace("/", string.Empty).Replace("<a href=", string.Empty).Replace("\"", string.Empty);

                                if (endKey == string.Empty)
                                {
                                    int startindex1 = GrpName.IndexOf("gid=");
                                    string start1 = GrpName.Substring(startindex1);
                                    int endIndex1 = start1.IndexOf("&");
                                    endKey = start1.Substring(0, endIndex1).Replace("gid=", string.Empty).Trim();

                                    if (!NumberHelper.ValidateNumber(endKey))
                                    {
                                        try
                                        {
                                            endKey = endKey.Split('\"')[0];
                                        }
                                        catch { }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Info("Exception : " + ex);
                            }

                            if (endKey.Contains("analyticsURL"))
                            {
                                continue;
                            }

                            if (endKey == string.Empty)
                            {
                                try
                                {
                                    int startindex2 = GrpName.IndexOf("gid=");
                                    string start2 = GrpName.Substring(startindex2);
                                    int endIndex2 = start2.IndexOf("&");
                                    endKey = start2.Substring(0, endIndex2).Replace("gid", string.Empty).Replace("=", string.Empty);
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Info("Exception : " + ex);
                                }
                            }
                            else
                            {
                                string[] endKeyLast = endKey.Split('-');
                                try
                                {
                                    if (NumberHelper.ValidateNumber(endKeyLast[1]))
                                    {
                                        endKey = endKeyLast[1];
                                    }
                                    else if (NumberHelper.ValidateNumber(endKeyLast[2]))
                                    {
                                        endKey = endKeyLast[2];
                                    }
                                    else if (NumberHelper.ValidateNumber(endKeyLast[3]))
                                    {
                                        endKey = endKeyLast[3];
                                    }
                                    else if (NumberHelper.ValidateNumber(endKeyLast[4]))
                                    {
                                        endKey = endKeyLast[4];
                                    }
                                    else if (NumberHelper.ValidateNumber(endKeyLast[5]))
                                    {
                                        endKey = endKeyLast[5];
                                    }
                                    else if (NumberHelper.ValidateNumber(endKeyLast[6]))
                                    {
                                        endKey = endKeyLast[6];
                                    }
                                }
                                catch { }
                            }

                            try
                            {
                                if (NumberHelper.ValidateNumber(endKey))
                                {
                                    GroupName.Add(endName, endKey);
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Info("Exception : " + ex);
                            }
                            //}

                            //}
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Info("Exception : " + ex);
                        }
                    }
                }

                return GroupName;
            }
            catch (Exception ex)
            {
                return GroupName;
            }

        }
Пример #37
0
        public List<string> GetFollowings_NewForMobileVersion(string userID, out string ReturnStatus)
        {
            GlobusHttpHelper HttpHelper = new GlobusHttpHelper();
            //Log("[ " + DateTime.Now + " ] => [ Searching For Followers For " + userID + " ]");
            string cursor = "0";
            int counter = 0;
            string FollowingUrl = string.Empty;
            List<string> lstIds = new List<string>();
            string Data = string.Empty;
            string FindCursor = string.Empty;

            try
            {

            StartAgain:
                //Thread.Sleep(1000);
                string[] splitRes = new string[] { };
                if (counter == 0)
                {
                    string aa = "https://mobile.twitter.com/" + userID + "/following";
                    Data = HttpHelper.getHtmlfromUrl(new Uri(aa), "", "");
                    if (Data.Contains("class=\"w-button-more\""))
                    {
                        int startindex = Data.IndexOf("cursor=");
                        string start = Data.Substring(startindex).Replace("cursor=", "");
                        int lastindex = start.IndexOf(">");
                        if (lastindex < 0)
                        {
                            lastindex = start.IndexOf(">");
                        }
                        string end = start.Substring(0, lastindex).Replace("\"", "");
                        cursor = end;
                    }
                    else
                    {
                        //splitRes = Regex.Split(Data, "<div class=\"GridTimeline-items");
                    }

                    counter++;

                    //Data = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/" + userID + "/followers"), "", "");
                }
                else
                {
                    Data = HttpHelper.getHtmlfromUrl(new Uri("https://mobile.twitter.com/" + userID + "/following?cursor=" + cursor), "", "");
                    if (string.IsNullOrEmpty(Data))
                    {

                        for (int i = 1; i <= 3; i++)
                        {
                            Thread.Sleep(3000);
                            Data = HttpHelper.getHtmlfromUrl(new Uri("https://mobile.twitter.com/" + userID + "/following?cursor=" + cursor), "", "");
                            if (!string.IsNullOrEmpty(Data))
                            {
                                break;
                            }
                        }
                        //if (string.IsNullOrEmpty(Data))
                        //{
                        //    Log(" pagesource not found ");
                        //}
                    }
                    if (Data == "Too Many Requestes")
                    {
                        //Log("[ " + DateTime.Now + " ] => [ Wait for 15 minutes For furthur Scraping because Twitter banned for scraping. its already too many requestes. ]");
                        Thread.Sleep(15 * 60 * 1000);
                        Data = HttpHelper.getHtmlfromUrl(new Uri("https://mobile.twitter.com/" + userID + "/following?cursor=" + cursor), "", "");
                        if (string.IsNullOrEmpty(Data) || Data == "Too Many Requestes")
                        {
                            //Log("[ " + DateTime.Now + " ] => [ Wait for 5 minutes more For furthur Scraping. ]");
                            Thread.Sleep(5 * 60 * 1000);
                            for (int i = 1; i <= 3; i++)
                            {
                                Thread.Sleep(3000);
                                Data = HttpHelper.getHtmlfromUrl(new Uri("https://mobile.twitter.com/" + userID + "/following?cursor=" + cursor), "", "");
                                if (!string.IsNullOrEmpty(Data))
                                {
                                    break;
                                }
                            }
                            //if (string.IsNullOrEmpty(Data))
                            //{
                            //    Log(" pagesource not found ");
                            //}
                        }
                    }

                    //var avc = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(Data);
                    //cursor = string.Empty;
                    //string DataHtml = (string)avc["items_html"];
                    //cursor = (string)avc["cursor"];
                }

                if (cursor == "0")
                {
                    Thread.Sleep(2000);
                    Data = HttpHelper.getHtmlfromUrl(new Uri("https://mobile.twitter.com/" + userID + "/following?cursor=" + cursor), "", "");
                }

                if (Data.Contains("401 Unauthorized"))
                {
                    ReturnStatus = "Account is Suspended. ";
                    return lstIds;
                }
                else if (!Data.Contains("Rate limit exceeded") && !Data.Contains("{\"errors\":[{\"message\":\"Sorry, that page does not exist\",\"code\":34}]}") && !string.IsNullOrEmpty(Data))
                {
                    string[] arraydata = null;
                    string startWith = string.Empty;
                    if (Data.Contains("<strong class=\"fullname\">"))
                    {
                        arraydata = Regex.Split(Data, "<strong class=\"fullname\">");
                        //startWith = "";
                    }
                    else
                    {
                        //arraydata = Regex.Split(Data, "js-stream-item");
                        //startWith = "\\\" role=\\\"listitem\\\"";

                    }
                    arraydata = arraydata.Skip(1).ToArray();

                    foreach (string id in arraydata)
                    {

                        string userid = string.Empty;
                        string username = string.Empty;
                        if (cursor == "0")
                        {
                            try
                            {

                                int startindex = id.IndexOf("id=");
                                string start = id.Substring(startindex).Replace("id=", string.Empty);
                                int endindex = start.IndexOf("&amp;");
                                string end = start.Substring(0, endindex);
                                userid = end;

                            }
                            catch { }

                        }
                        else
                        {
                            try
                            {
                                int startindex = id.IndexOf("id=");
                                string start = id.Substring(startindex).Replace("id=", string.Empty);
                                int endindex = start.IndexOf("&amp;");
                                string end = start.Substring(0, endindex);
                                userid = end;
                            }
                            catch (Exception ex)
                            {
                                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetFollowers_New() -- " + userid + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetFollowers_New() -- " + userid + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
                            }
                        }

                        if (cursor == "0")
                        {

                            try
                            {

                                int startindex = id.IndexOf("@</span>");
                                string start = id.Substring(startindex).Replace("@</span>", string.Empty);
                                int endindex = start.IndexOf("</span></a>");
                                string end = start.Substring(0, endindex);
                                username = end;

                            }
                            catch { }
                        }
                        else
                        {

                            try
                            {

                                int startindex = id.IndexOf("@</span>");
                                string start = id.Substring(startindex).Replace("@</span>", string.Empty);
                                int endindex = start.IndexOf("</span></a>");
                                string end = start.Substring(0, endindex);
                                username = end;
                            }
                            catch (Exception ex)
                            {
                                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetFollowers_New() -- " + username + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetFollowers_New() -- " + username + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
                            }
                        }

                        if (CounterDataNo > 0)
                        {
                            if (lstIds.Count == CounterDataNo)
                            {
                                ReturnStatus = "No Error";
                                lstIds = lstIds.Distinct().ToList();
                                return lstIds;
                            }
                            else
                            {
                                Globals.lstScrapedUserIDs.Add(userid);
                                lstIds.Add(userid + ":" + username);
                                lstIds = lstIds.Distinct().ToList();

                                if (username.Contains("/span") || userid.Contains("/span"))
                                {

                                }

                                //Log("[ " + DateTime.Now + " ] => [ " + userid + ":" + username + " ]");
                                //write to csv
                                GlobusFileHelper.AppendStringToTextfileNewLine(userID + "," + userid + "," + username, Globals.Path_ScrapedFollowingsList + "_" + userID + ".csv");
                            }
                        }

                        try
                        {

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

                    if (Data.Contains("Show more people"))
                    {
                        int startindex = Data.IndexOf("cursor=");
                        string start = Data.Substring(startindex).Replace("cursor=", "");
                        int lastindex = start.IndexOf(">");
                        if (lastindex < 0)
                        {
                            lastindex = start.IndexOf(">");
                        }
                        string end = start.Substring(0, lastindex).Replace("\"", "");
                        cursor = end;
                        if (cursor != "0")
                        {
                            goto StartAgain;
                        }
                    }

                    ReturnStatus = "No Error";
                    lstIds = lstIds.Distinct().ToList();
                    return lstIds;
                }
                else if (!Data.Contains("Show more people"))
                {
                    ReturnStatus = "Sorry, that page does not exist :" + userID;
                    lstIds = lstIds.Distinct().ToList();
                    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;
                    lstIds = lstIds.Distinct().ToList();
                    return lstIds;
                }
                else
                {
                    ReturnStatus = "Error";
                    lstIds = lstIds.Distinct().ToList();
                    return lstIds;
                }
            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetFollowers_New() -- " + userID + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetFollowers_New() -- " + userID + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
                ReturnStatus = "Error";
                lstIds = lstIds.Distinct().ToList();
                return lstIds;
            }
        }
        public void PostFinalMsgGroupMember_1By1(ref GlobusHttpHelper HttpHelper, Dictionary<string, string> SlectedContacts, List<string> GrpMemSubjectlist, List<string> GrpMemMessagelist, string msg, string body, string UserName, string FromemailId, string FromEmailNam, string SelectedGrpName, string grpId, bool mesg_with_tag, bool msg_spintaxt, int mindelay, int maxdelay, bool preventMsgSameGroup, bool preventMsgWithoutGroup, bool preventMsgGlobal)
        {
            try
            {
               // MsgGroupMemDbManager objMsgGroupMemDbMgr = new MsgGroupMemDbManager();

                string postdata = string.Empty;
                string postUrl = string.Empty;
                string ResLogin = string.Empty;
                string csrfToken = string.Empty;
                string sourceAlias = string.Empty;
                string ReturnString = string.Empty;
                string PostMsgSubject = string.Empty;
                string PostMsgBody = string.Empty;
                string FString = string.Empty;

                try
                {


                    string MessageText = string.Empty;
                    string PostedMessage = string.Empty;
                    string senderEmail = string.Empty;
                    string getComposeData = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/inbox/compose"));


                    if (!getComposeData.Contains("There was an error with the file upload. Please try again later."))
                    {
                        #region MyRegion
                        try
                        {
                            int startindex = getComposeData.IndexOf("\"senderEmail\" value=\"");
                            if (startindex < 0)
                            {
                                startindex = getComposeData.IndexOf("\"senderEmail\",\"value\":\"");
                            }
                            string start = getComposeData.Substring(startindex).Replace("\"senderEmail\" value=\"", string.Empty).Replace("\"senderEmail\",\"value\":\"", string.Empty);
                            int endindex = start.IndexOf("\"/>");
                            if (endindex < 0)
                            {
                                endindex = start.IndexOf("\",\"");
                            }
                            string end = start.Substring(0, endindex).Replace("\"/>", string.Empty).Replace("\",\"", string.Empty);
                            senderEmail = end.Trim();
                        }
                        catch (Exception ex)
                        {
                            senderEmail = Utils.getBetween(getComposeData, "<", ">");
                        }
                        string pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/home?trk=hb_tab_home_top"));
                        if (pageSource.Contains("csrfToken"))
                        {
                            try
                            {
                                csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 50);
                                string[] Arr = csrfToken.Split('<');
                                csrfToken = Arr[0];
                                csrfToken = csrfToken.Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty).Replace("\n", string.Empty).Replace(">", string.Empty).Replace("<script typ", string.Empty);
                                csrfToken = csrfToken.Trim();
                            }
                            catch (Exception ex)
                            {

                            }

                        }

                        if (pageSource.Contains("sourceAlias"))
                        {
                            try
                            {
                                sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100);
                                string[] Arr = sourceAlias.Split('"');
                                sourceAlias = Arr[2];
                            }
                            catch (Exception ex)
                            {

                            }
                        }

                        if (pageSource.Contains("goback="))
                        {
                            try
                            {
                            }
                            catch (Exception ex)
                            {

                            }
                        }

                        foreach (KeyValuePair<string, string> itemChecked in SlectedContacts)
                        {
                            try
                            {
                                DataSet ds = new DataSet();
                                DataSet ds_bList = new DataSet();
                                string ContactName = string.Empty;
                                string Nstring = string.Empty;
                                string connId = string.Empty;
                                string FName = string.Empty;
                                string Lname = string.Empty;
                                string tempBody = string.Empty;
                                string tempsubject = string.Empty;
                                string n_ame1 = string.Empty;

                                //grpId = itemChecked.Key.ToString();

                                try
                                {
                                    // FName = itemChecked.Value.Split(' ')[0];
                                    // Lname = itemChecked.Value.Split(' ')[1];
                                    try
                                    {
                                        n_ame1 = itemChecked.Value.Split(']')[1].Trim(); ;
                                    }
                                    catch
                                    { }
                                    if (string.IsNullOrEmpty(n_ame1))
                                    {
                                        try
                                        {
                                            n_ame1 = itemChecked.Value;
                                        }
                                        catch
                                        { }
                                    }
                                    string[] n_ame = Regex.Split(n_ame1, " ");
                                    FName = " " + n_ame[0];
                                    Lname = n_ame[1];

                                    if (!string.IsNullOrEmpty(n_ame[2]))
                                    {
                                        Lname = Lname + n_ame[2];
                                    }
                                    if (!string.IsNullOrEmpty(n_ame[3]))
                                    {
                                        Lname = Lname + n_ame[3];
                                    }
                                    if (!string.IsNullOrEmpty(n_ame[4]))
                                    {
                                        Lname = Lname + n_ame[4];
                                    }
                                    if (!string.IsNullOrEmpty(n_ame[5]))
                                    {
                                        Lname = Lname + n_ame[5];
                                    }
                                }
                                catch (Exception ex)
                                {
                                }

                                try
                                {
                                    ContactName = FName + " " + Lname;
                                    ContactName = ContactName.Replace("%20", " ");
                                }
                                catch { }

                                
                                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Adding Contact : " + ContactName + " ]");

                                string ToCd = itemChecked.Key;
                                List<string> AddAllString = new List<string>();

                                if (FString == string.Empty)
                                {
                                    string CompString = "{" + "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}";
                                    FString = CompString;
                                }
                                else
                                {
                                    string CompString = "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}";
                                    FString = CompString;
                                }

                                if (Nstring == string.Empty)
                                {
                                    Nstring = FString;
                                    connId = ToCd;
                                }
                                else
                                {
                                    Nstring += "," + FString;
                                    connId += " " + ToCd;
                                }

                                Nstring += "}";
                                tempsubject = msg;
                                try
                                {
                                    string PostMessage = string.Empty;
                                    string ResponseStatusMsg = string.Empty;

                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message Sending Process Running.. ]");
                                    if (mesg_with_tag == true)
                                    {
                                        tempsubject = msg;
                                    }
                                    if (msg_spintaxt == true)
                                    {
                                        try
                                        {
                                            msg = GrpMemSubjectlist[RandomNumberGenerator.GenerateRandom(0, GrpMemSubjectlist.Count - 1)];
                                            body = GrpMemMessagelist[RandomNumberGenerator.GenerateRandom(0, GrpMemMessagelist.Count - 1)];
                                        }
                                        catch
                                        {
                                        }
                                    }

                                    if (mesg_with_tag == true)
                                    {
                                        if (string.IsNullOrEmpty(FName))
                                        {
                                            tempBody = body.Replace("<Insert Name>", ContactName);
                                        }
                                        else
                                        {
                                          //  tempBody = GlobusSpinHelper.spinLargeText(new Random(), body);

                                           // if (lstSubjectReuse.Count == GrpMemSubjectlist.Count)
                                           // {
                                          //      lstSubjectReuse.Clear();
                                           // }
                                            //foreach (var itemSubject in GrpMemSubjectlist)
                                            //{
                                            //    if (string.IsNullOrEmpty(TemporarySubject))
                                            //    {
                                            //        TemporarySubject = itemSubject;
                                            //        tempsubject = itemSubject;
                                            //        lstSubjectReuse.Add(itemSubject);
                                            //        break;
                                            //    }
                                            //    else if (!lstSubjectReuse.Contains(itemSubject))
                                            //    {
                                            //        TemporarySubject = itemSubject;
                                            //        tempsubject = itemSubject;
                                            //        lstSubjectReuse.Add(itemSubject);
                                            //        break;
                                            //    }
                                            //    else
                                            //    {
                                            //        continue;
                                            //    }
                                            //}

                                            tempBody = tempBody.Replace("<Insert Name>", FName);

                                            tempsubject = tempsubject.Replace("<Insert Name>", FName);
                                        }
                                    }
                                    else
                                    {
                                        if (string.IsNullOrEmpty(FName))
                                        {
                                            tempBody = body.Replace("<Insert Name>", ContactName);
                                        }
                                        else
                                        {
                                            tempBody = body.Replace("<Insert Name>", FName);
                                        }
                                    }

                                    if (SelectedGrpName.Contains(":"))
                                    {
                                        try
                                        {
                                            string[] arrSelectedGrpName = Regex.Split(SelectedGrpName, ":");
                                            if (arrSelectedGrpName.Length > 1)
                                            {
                                                SelectedGrpName = arrSelectedGrpName[1];
                                            }
                                        }
                                        catch (Exception ex)
                                        {

                                        }
                                    }




                                    if (mesg_with_tag == true)
                                    {
                                        tempBody = tempBody.Replace("<Insert Group>", SelectedGrpName);
                                        tempBody = tempBody.Replace("<Insert From Email>", FromEmailNam);
                                        tempBody = tempBody.Replace("<Insert Name>", string.Empty).Replace("<Insert Group>", string.Empty).Replace("<Insert From Email>", string.Empty);
                                    }
                                    else
                                    {
                                        tempBody = tempBody.Replace("<Insert Group>", SelectedGrpName);
                                        tempBody = tempBody.Replace("<Insert From Email>", FromEmailNam);
                                        tempBody = tempBody.Replace("<Insert Name>", string.Empty).Replace("<Insert Group>", string.Empty).Replace("<Insert From Email>", string.Empty);
                                    }

                                    //Check BlackListed Accounts
                                    try
                                    {
                                        string Querystring = "Select ProfileID From tb_BlackListAccount Where ProfileID ='" + itemChecked.Key + "'";
                                        ds_bList = DataBaseHandler.SelectQuery(Querystring, "tb_BlackListAccount");
                                    }
                                    catch { }


                                    if (preventMsgSameGroup)
                                    {
                                        try
                                        {
                                            string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgFrom ='" + UserName + "' and MsgGroupId = " + grpId + " and MsgToId = " + connId + "";
                                            ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                        }
                                        catch { }
                                    }

                                    if (preventMsgWithoutGroup)
                                    {
                                        try
                                        {
                                            string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgFrom ='" + UserName + "' and MsgToId = " + connId + "";
                                            ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                        }
                                        catch { }
                                    }
                                    if (preventMsgGlobal)
                                    {
                                        try
                                        {
                                            string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgToId = " + connId + "";
                                            ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                        }
                                        catch { }
                                    }

                                    try
                                    {

                                        if (ds.Tables.Count > 0)
                                        {
                                            if (ds.Tables[0].Rows.Count > 0)
                                            {

                                                PostMessage = "";
                                                ResponseStatusMsg = "Already Sent";

                                            }
                                            else
                                            {
                                                if (ds_bList.Tables.Count > 0 && ds_bList.Tables[0].Rows.Count > 0)
                                                {
                                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ User: "******" is Added BlackListed List For Send Messages Pls Check ]");
                                                    ResponseStatusMsg = "BlackListed";
                                                }
                                                else
                                                {

                                                    try
                                                    {
                                                        string Url_compose = "https://www.linkedin.com/inbox/#compose?connId=" + ToCd + "&groupId=" + grpId;
                                                        string Responce = HttpHelper.getHtmlfromUrl(new Uri(Url_compose));
                                                        {

                                                            string PostUrlsssss = "https://www.linkedin.com/inbox/mailbox/message/send";


                                                            string PostDataFinal1 = "senderEmail=645883950&ccInput=&subject=" + Uri.EscapeDataString(tempsubject.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&persist=true&showRecipients=showRecipients&isReply=&isForward=&itemId=&recipients=" + ToCd + "&recipientNames=%5B%7B%22memberId%22%3A" + ToCd + "%2C%22fullName%22%3A%22" + ContactName + "%22%7D%5D&groupId=" + grpId + "&csrfToken=" + csrfToken + "&sourceAlias=0_3mbGc9okCQbybxvc2A5Vz5&submit=Envoyer";
                                                            ResponseStatusMsg = HttpHelper.postFormData(new Uri(PostUrlsssss), PostDataFinal1);
                                                        }


                                                    }
                                                    catch (Exception ex)
                                                    {
                                                    }
                                                    if (ResponseStatusMsg.Contains("upload_error") && ResponseStatusMsg.Contains("There was an error with the file upload. Please try again later"))
                                                    {
                                                        PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                        ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                                    }


                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (ds_bList.Tables.Count > 0)
                                            {
                                                if (ds_bList.Tables[0].Rows.Count > 0)
                                                {

                                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ User: "******" is Added BlackListed List For Send Messages Pls Check ]");
                                                    ResponseStatusMsg = "BlackListed";
                                                }
                                                else
                                                {
                                                    try
                                                    {
                                                        string Url_compose = "https://www.linkedin.com/inbox/#compose?connId=" + ToCd + "&groupId=" + grpId;
                                                        string Responce = HttpHelper.getHtmlfromUrl(new Uri(Url_compose));
                                                        {

                                                            string PostUrlsssss = "https://www.linkedin.com/inbox/mailbox/message/send";


                                                            string PostDataFinal1 = "senderEmail=645883950&ccInput=&subject=" + Uri.EscapeDataString(tempsubject.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&persist=true&showRecipients=showRecipients&isReply=&isForward=&itemId=&recipients=" + ToCd + "&recipientNames=%5B%7B%22memberId%22%3A" + ToCd + "%2C%22fullName%22%3A%22" + ContactName + "%22%7D%5D&groupId=" + grpId + "&csrfToken=" + csrfToken + "&sourceAlias=0_3mbGc9okCQbybxvc2A5Vz5&submit=Envoyer";
                                                            ResponseStatusMsg = HttpHelper.postFormData(new Uri(PostUrlsssss), PostDataFinal1);
                                                        }


                                                    }
                                                    catch (Exception ex)
                                                    {
                                                    }
                                                    if (ResponseStatusMsg.Contains("upload_error") && ResponseStatusMsg.Contains("There was an error with the file upload. Please try again later"))
                                                    {
                                                        PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                        ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                                    }


                                                    //  PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(tempsubject.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                    // ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                                }
                                            }
                                        }
                                    }
                                    catch (Exception)
                                    {
                                        // if (ResponseStatusMsg.Contains("upload_error") && ResponseStatusMsg.Contains("There was an error with the file upload. Please try again later"))
                                        {
                                            PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                            ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                        }

                                        //PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&showRecipeints=showRecipeintsfromName=" + Uri.EscapeDataString(FromEmailNam) + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                        //ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groupMsg"), PostMessage);
                                    }

                                    if ((!ResponseStatusMsg.Contains("Your message was successfully sent.") && !ResponseStatusMsg.Contains("Already Sent")) && (!ResponseStatusMsg.Contains("Se ha enviado tu mensaje satisfactoriamente") && !ResponseStatusMsg.Contains("Ya ha sido enviada") && !ResponseStatusMsg.Contains("Uw bericht is verzonden")))
                                    {

                                        if (ResponseStatusMsg.Contains("Already Sent") || (ResponseStatusMsg.Contains("Ya ha sido enviada") || (ResponseStatusMsg.Contains("BlackListed"))))
                                        {
                                            continue;
                                        }

                                        try
                                        {
                                            pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/groups?viewMembers=&gid=" + grpId));

                                            if (pageSource.Contains("contentType="))
                                            {
                                                try
                                                {
                                                    string Url_compose = "https://www.linkedin.com/inbox/#compose?connId=" + ToCd + "&groupId=" + grpId;
                                                    string Responce = HttpHelper.getHtmlfromUrl(new Uri(Url_compose));
                                                    {

                                                        string PostUrlsssss = "https://www.linkedin.com/inbox/mailbox/message/send";


                                                        string PostDataFinal1 = "senderEmail=645883950&ccInput=&subject=" + Uri.EscapeDataString(tempsubject.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&persist=true&showRecipients=showRecipients&isReply=&isForward=&itemId=&recipients=" + ToCd + "&recipientNames=%5B%7B%22memberId%22%3A" + ToCd + "%2C%22fullName%22%3A%22" + ContactName + "%22%7D%5D&groupId=" + grpId + "&csrfToken=" + csrfToken + "&sourceAlias=0_3mbGc9okCQbybxvc2A5Vz5&submit=Envoyer";
                                                        ResponseStatusMsg = HttpHelper.postFormData(new Uri(PostUrlsssss), PostDataFinal1);
                                                    }
                                                    if (ResponseStatusMsg.Contains("upload_error") && ResponseStatusMsg.Contains("There was an error with the file upload. Please try again later"))
                                                    {
                                                        PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                        ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                                    }


                                                }
                                                catch (Exception ex)
                                                {
                                                }

                                                //try
                                                //{
                                                //    string contentType = pageSource.Substring(pageSource.IndexOf("contentType="), pageSource.IndexOf("&", pageSource.IndexOf("contentType=")) - pageSource.IndexOf("contentType=")).Replace("contentType=", string.Empty).Replace("contentType=", string.Empty).Trim();

                                                //    string pageSource2 = HttpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/groupMsg?displayCreate=&contentType=" + contentType + "&connId=" + connId + "&groupID=" + grpId + ""));

                                                //    //  PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&showRecipeints=showRecipeints&fromName=" + FromEmailNam + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=" + Uri.EscapeUriString(Nstring) + "&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=" + contentType + "&groupID=" + grpId + "";

                                                //    string postData_Message_posting = "senderEmail=914640570&ccInput=&subject=hi&body=hello&persist=true&showRecipients=showRecipients&isReply=&isForward=&itemId=&recipients=313092875&recipientNames=%5B%7B%22memberId%22%3A313092875%2C%22fullName%22%3A%22SibghatUllah+K.+Khan%22%7D%5D&groupId=" + grpId + "&csrfToken=" + csrfToken + "&sourceAlias=0_3mbGc9okCQbybxvc2A5Vz5&submit=Send+Message";
                                                //    string postUrlll = "https://www.linkedin.com/inbox/mailbox/message/send";
                                                //    ResponseStatusMsg = HttpHelper.postFormData(new Uri(postUrlll), postData_Message_posting);
                                                //}
                                                //catch (Exception ex)
                                                //{
                                                //}
                                            }


                                            // ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                        }
                                        catch (Exception ex)
                                        {

                                        }
                                    }

                                    if ((ResponseStatusMsg.Contains("Your message was successfully sent.")) || (ResponseStatusMsg.Contains("Se ha enviado tu mensaje satisfactoriamente") || (ResponseStatusMsg.Contains("Uw bericht is verzonden"))))
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Subject Posted : " + tempsubject + " ]");
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Body Text Posted : " + tempBody.ToString() + " ]");
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message Posted To Account: " + ContactName + " ]");
                                        ReturnString = "Your message was successfully sent.";

                                        #region CSV
                                        string bdy = string.Empty;
                                        try
                                        {
                                            bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                                        }
                                        catch { }
                                        if (string.IsNullOrEmpty(bdy))
                                        {
                                            bdy = tempBody.ToString().Replace(",", ":");
                                        }
                                        string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                        string CSV_Content = UserName + "," + tempsubject + "," + bdy.ToString() + "," + ContactName;
                                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, FilePath.path_MessageSentGroupMember);

                                        try
                                        {
                                            InsertMsgGroupMemData(UserName, Convert.ToInt32(connId), ContactName, Convert.ToInt32(grpId), SelectedGrpName, msg, tempBody);
                                        }
                                        catch { }

                                        #endregion

                                    }
                                    else if (ResponseStatusMsg.Contains("There was an unexpected problem that prevented us from completing your request"))
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ There was an unexpected problem that prevented us from completing your request ! ]");
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", FilePath.path_MessageGroupMember);
                                    }
                                    else if (ResponseStatusMsg.Contains("You are no longer authorized to message this"))
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ You are no longer authorized to message this ! ]");
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", FilePath.path_MessageGroupMember);
                                    }
                                    else if ((ResponseStatusMsg.Contains("Already Sent")) || (ResponseStatusMsg.Contains("Ya ha sido enviada")))
                                    {
                                        string bdy = string.Empty;
                                        try
                                        {
                                            bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                                        }
                                        catch { }
                                        if (string.IsNullOrEmpty(bdy))
                                        {
                                            bdy = tempBody.ToString().Replace(",", ":");
                                        }
                                        string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                        string CSV_Content = UserName + "," + msg + "," + bdy.ToString() + "," + ContactName;
                                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, FilePath.path_MessageAlreadySentGroupMember);

                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message Not Posted To Account: " + ContactName + " because it has sent the same message]");
                                    }
                                    else if ((ResponseStatusMsg.Contains("Votre message a bien")) || ResponseStatusMsg.Contains("class=\"alert success") || (ResponseStatusMsg.Contains("Ya ha sido enviada")))
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Subject Posted : " + tempsubject + " ]");
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Body Text Posted : " + tempBody.ToString() + " ]");
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message Posted To Account: " + ContactName + " ]");
                                        ReturnString = "Your message was successfully sent.";


                                        string bdy = string.Empty;
                                        try
                                        {
                                            bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                                        }
                                        catch { }
                                        if (string.IsNullOrEmpty(bdy))
                                        {
                                            bdy = tempBody.ToString().Replace(",", ":");
                                        }
                                        string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                        string CSV_Content = UserName + "," + tempsubject + "," + bdy.ToString() + "," + ContactName;
                                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, FilePath.path_MessageSentGroupMember);

                                        try
                                        {
                                            InsertMsgGroupMemData(UserName, Convert.ToInt32(connId), ContactName, Convert.ToInt32(grpId), SelectedGrpName, msg, tempBody);
                                        }
                                        catch { }
                                    }
                                    else
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Error In Message Posting ]");
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", FilePath.path_MessageGroupMember);
                                    }

                                    int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                                    Thread.Sleep(delay * 1000);

                                }
                                catch (Exception ex)
                                {
                                    //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, FilePath.path_MessageGroupMember);
                                }
                            }
                            catch (Exception ex)
                            {
                                //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace);
                                GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, FilePath.path_MessageGroupMember);
                            }
                        }
                        #endregion
                    }
                    else
                    {

                        try
                        {
                            int startindex = getComposeData.IndexOf("\"senderEmail\" value=\"");
                            if (startindex < 0)
                            {
                                startindex = getComposeData.IndexOf("\"senderEmail\",\"value\":\"");
                            }
                            string start = getComposeData.Substring(startindex).Replace("\"senderEmail\" value=\"", string.Empty).Replace("\"senderEmail\",\"value\":\"", string.Empty);
                            int endindex = start.IndexOf("\"/>");
                            if (endindex < 0)
                            {
                                endindex = start.IndexOf("\",\"");
                            }
                            string end = start.Substring(0, endindex).Replace("\"/>", string.Empty).Replace("\",\"", string.Empty);
                            senderEmail = end.Trim();
                        }
                        catch (Exception ex)
                        {
                            senderEmail = Utils.getBetween(getComposeData, "<", ">");
                        }





                        string pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/home?trk=hb_tab_home_top"));
                        if (pageSource.Contains("csrfToken"))
                        {
                            try
                            {
                                csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 50);
                                string[] Arr = csrfToken.Split('<');
                                csrfToken = Arr[0];
                                csrfToken = csrfToken.Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty).Replace("\n", string.Empty).Replace(">", string.Empty).Replace("<script typ", string.Empty);
                                csrfToken = csrfToken.Trim();
                            }
                            catch (Exception ex)
                            {

                            }

                        }

                        if (pageSource.Contains("sourceAlias"))
                        {
                            try
                            {
                                sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100);
                                string[] Arr = sourceAlias.Split('"');
                                sourceAlias = Arr[2];
                            }
                            catch (Exception ex)
                            {

                            }
                        }

                        if (pageSource.Contains("goback="))
                        {
                            try
                            {
                            }
                            catch (Exception ex)
                            {

                            }
                        }

                        foreach (KeyValuePair<string, string> itemChecked in SlectedContacts)
                        {
                            try
                            {
                                DataSet ds = new DataSet();
                                DataSet ds_bList = new DataSet();
                                string ContactName = string.Empty;
                                string Nstring = string.Empty;
                                string connId = string.Empty;
                                string FName = string.Empty;
                                string Lname = string.Empty;
                                string tempBody = string.Empty;
                                string tempsubject = string.Empty;
                                string n_ame1 = string.Empty;

                                //grpId = itemChecked.Key.ToString();



                                try
                                {
                                    // FName = itemChecked.Value.Split(' ')[0];
                                    // Lname = itemChecked.Value.Split(' ')[1];
                                    try
                                    {
                                        n_ame1 = itemChecked.Value.Split(']')[1].Trim(); ;
                                    }
                                    catch
                                    { }
                                    if (string.IsNullOrEmpty(n_ame1))
                                    {
                                        try
                                        {
                                            n_ame1 = itemChecked.Value;
                                        }
                                        catch
                                        { }
                                    }
                                    string[] n_ame = Regex.Split(n_ame1, " ");
                                    FName = " " + n_ame[0];
                                    Lname = n_ame[1];

                                    if (!string.IsNullOrEmpty(n_ame[2]))
                                    {
                                        Lname = Lname + n_ame[2];
                                    }
                                    if (!string.IsNullOrEmpty(n_ame[3]))
                                    {
                                        Lname = Lname + n_ame[3];
                                    }
                                    if (!string.IsNullOrEmpty(n_ame[4]))
                                    {
                                        Lname = Lname + n_ame[4];
                                    }
                                    if (!string.IsNullOrEmpty(n_ame[5]))
                                    {
                                        Lname = Lname + n_ame[5];
                                    }
                                }
                                catch (Exception ex)
                                {
                                }

                                try
                                {
                                    ContactName = FName + " " + Lname;
                                    ContactName = ContactName.Replace("%20", " ");
                                }
                                catch { }

                                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Adding Contact : " + ContactName + " ]");

                                string ToCd = itemChecked.Key;
                                List<string> AddAllString = new List<string>();

                                if (FString == string.Empty)
                                {
                                    string CompString = "{" + "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}";
                                    FString = CompString;
                                }
                                else
                                {
                                    string CompString = "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}";
                                    FString = CompString;
                                }

                                if (Nstring == string.Empty)
                                {
                                    Nstring = FString;
                                    connId = ToCd;
                                }
                                else
                                {
                                    Nstring += "," + FString;
                                    connId += " " + ToCd;
                                }

                                Nstring += "}";
                                tempsubject = msg;
                                string full_name = string.Empty;
                                try
                                {
                                    string PostMessage = string.Empty;
                                    string ResponseStatusMsg = string.Empty;

                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message Sending Process Running.. ]");
                                    if (mesg_with_tag == true)
                                    {
                                        tempsubject = msg;
                                    }
                                    if (msg_spintaxt == true)
                                    {
                                        try
                                        {
                                            msg = GrpMemSubjectlist[RandomNumberGenerator.GenerateRandom(0, GrpMemSubjectlist.Count - 1)];
                                            body = GrpMemMessagelist[RandomNumberGenerator.GenerateRandom(0, GrpMemMessagelist.Count - 1)];
                                        }
                                        catch
                                        {
                                        }
                                    }

                                    if (mesg_with_tag == true)
                                    {
                                        if (string.IsNullOrEmpty(FName))
                                        {
                                            tempBody = body.Replace("<Insert Name>", ContactName);
                                        }
                                        else
                                        {
                                            //tempBody = GlobusSpinHelper.spinLargeText(new Random(), body);

                                            //if (lstSubjectReuse.Count == GrpMemSubjectlist.Count)
                                            //{
                                            //    lstSubjectReuse.Clear();
                                            //}
                                            //foreach (var itemSubject in GrpMemSubjectlist)
                                            //{
                                            //    if (string.IsNullOrEmpty(TemporarySubject))
                                            //    {
                                            //        TemporarySubject = itemSubject;
                                            //        tempsubject = itemSubject;
                                            //        lstSubjectReuse.Add(itemSubject);
                                            //        break;
                                            //    }
                                            //    else if (!lstSubjectReuse.Contains(itemSubject))
                                            //    {
                                            //        TemporarySubject = itemSubject;
                                            //        tempsubject = itemSubject;
                                            //        lstSubjectReuse.Add(itemSubject);
                                            //        break;
                                            //    }
                                            //    else
                                            //    {
                                            //        continue;
                                            //    }
                                            //}

                                            tempBody = tempBody.Replace("<Insert Name>", FName);

                                            tempsubject = tempsubject.Replace("<Insert Name>", FName);
                                        }
                                    }
                                    else
                                    {
                                        if (string.IsNullOrEmpty(FName))
                                        {
                                            tempBody = body.Replace("<Insert Name>", ContactName);
                                        }
                                        else
                                        {
                                            tempBody = body.Replace("<Insert Name>", FName);
                                        }
                                    }

                                    if (SelectedGrpName.Contains(":"))
                                    {
                                        try
                                        {
                                            string[] arrSelectedGrpName = Regex.Split(SelectedGrpName, ":");
                                            if (arrSelectedGrpName.Length > 1)
                                            {
                                                SelectedGrpName = arrSelectedGrpName[1];
                                            }
                                        }
                                        catch (Exception ex)
                                        {

                                        }
                                    }
                                    try
                                    {
                                        full_name = Utils.getBetween("####" + ContactName, "####", "(");
                                    }
                                    catch
                                    { }
                                    #region To insert Full Name

                                    if (mesg_with_tag == true)
                                    {
                                        try
                                        {
                                            if (tempsubject.Contains("<Insert Full Name>"))
                                            {
                                                tempsubject = tempsubject.Replace("<Insert Full Name>", full_name);
                                            }
                                            if (tempBody.Contains("<Insert Full Name>"))
                                            {
                                                tempBody = tempBody.Replace("<Insert Full Name>", full_name);
                                            }

                                        }
                                        catch { }

                                    }


                                    #endregion

                                    if (mesg_with_tag == true)
                                    {
                                        tempBody = tempBody.Replace("<Insert Group>", SelectedGrpName);
                                        tempBody = tempBody.Replace("<Insert From Email>", senderEmail);
                                        tempBody = tempBody.Replace("<Insert Name>", string.Empty).Replace("<Insert Group>", string.Empty).Replace("<Insert From Email>", string.Empty);

                                        tempsubject = tempsubject.Replace("<Insert Group>", SelectedGrpName);
                                        tempsubject = tempsubject.Replace("<Insert From Email>", senderEmail);
                                        tempsubject = tempsubject.Replace("<Insert Name>", string.Empty).Replace("<Insert Group>", string.Empty).Replace("<Insert From Email>", string.Empty);
                                    }
                                    else
                                    {
                                        tempBody = tempBody.Replace("<Insert Group>", SelectedGrpName);
                                        tempBody = tempBody.Replace("<Insert From Email>", FromEmailNam);
                                        tempBody = tempBody.Replace("<Insert Name>", string.Empty).Replace("<Insert Group>", string.Empty).Replace("<Insert From Email>", string.Empty);
                                    }

                                    //Check BlackListed Accounts
                                    try
                                    {
                                        string Querystring = "Select ProfileID From tb_BlackListAccount Where ProfileID ='" + itemChecked.Key + "'";
                                        ds_bList = DataBaseHandler.SelectQuery(Querystring, "tb_BlackListAccount");
                                    }
                                    catch { }


                                    if (preventMsgSameGroup)
                                    {
                                        try
                                        {
                                            string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgFrom ='" + UserName + "' and MsgGroupId = " + grpId + " and MsgToId = " + connId + "";
                                            ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                        }
                                        catch { }
                                    }

                                    if (preventMsgWithoutGroup)
                                    {
                                        try
                                        {
                                            string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgFrom ='" + UserName + "' and MsgToId = " + connId + "";
                                            ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                        }
                                        catch { }
                                    }
                                    if (preventMsgGlobal)
                                    {
                                        try
                                        {
                                            string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgToId = " + connId + "";
                                            ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                        }
                                        catch { }
                                    }

                                    try
                                    {

                                        if (ds.Tables.Count > 0)
                                        {
                                            if (ds.Tables[0].Rows.Count > 0)
                                            {

                                                PostMessage = "";
                                                ResponseStatusMsg = "Already Sent";

                                            }
                                            else
                                            {
                                                if (ds_bList.Tables.Count > 0 && ds_bList.Tables[0].Rows.Count > 0)
                                                {
                                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ User: "******" is Added BlackListed List For Send Messages Pls Check ]");
                                                    ResponseStatusMsg = "BlackListed";
                                                }
                                                else
                                                {
                                                    #region send InMail
                                                    if (IssendInMail)
                                                    {
                                                        try
                                                        {
                                                            string csrfToken_inmail = string.Empty;
                                                            string Referer_InMail = string.Empty;
                                                            string authToken = string.Empty;

                                                            string url = "https://www.linkedin.com/premium/inmail/compose?destID=" + ToCd;
                                                            string responce_Inmail = HttpHelper.getHtmlfromUrl(new Uri(url));
                                                            if (!string.IsNullOrEmpty(responce_Inmail))
                                                            {
                                                                try
                                                                {
                                                                    csrfToken_inmail = Utils.getBetween(responce_Inmail, "csrfToken=", "\">");
                                                                }
                                                                catch { }
                                                            }

                                                            string subject_InMail = tempsubject.Replace(" ", "+");
                                                            string body_InMail = tempBody.Replace(" ", "+");
                                                            Referer_InMail = "https://www.linkedin.com/premium/inmail/compose?destID=" + ToCd;
                                                            string Action_url_InMail = "https://www.linkedin.com/premium/inmail/send?csrfToken=" + csrfToken_inmail;
                                                            // Referer_InMail = "https://www.linkedin.com/premium/inmail/compose?destID=" + ToCd + "&creationType=DC&authToken=" + authToken + "&authType=name&utm_source=Profile_inmail&utm_medium=onsite&utm_campaign=Subs";
                                                            string postData_InMail = "title=" + subject_InMail + "&document=" + body_InMail + "&destID=" + ToCd + "&creationType=DC&proposalType=" + category_to_send_inmail + "&authType=&authToken=";
                                                            ResponseStatusMsg = HttpHelper.postDataFormessagePosting(new Uri(Action_url_InMail), postData_InMail, Referer_InMail);


                                                        }
                                                        catch
                                                        { }



                                                    }
                                                    #endregion

                                                    #region direct message
                                                    else
                                                    {
                                                        try
                                                        {
                                                            string Url_compose = "https://www.linkedin.com/inbox/#compose?connId=" + ToCd + "&groupId=" + grpId;
                                                            string Responce = HttpHelper.getHtmlfromUrl(new Uri(Url_compose));

                                                            string url = "https://www.linkedin.com/inbox/compose?connId=" + ToCd + "&groupId=" + grpId;
                                                            string emailSender = string.Empty;
                                                            string resp = HttpHelper.getHtmlfromUrl(new Uri(url));
                                                            try
                                                            {
                                                                emailSender = Utils.getBetween(resp, "senderEmail-composeForm", "recipientNames");
                                                                emailSender = Utils.getBetween(emailSender, "value\":\"", "\"}");
                                                                if (string.IsNullOrEmpty(emailSender))
                                                                {
                                                                    try
                                                                    {
                                                                        emailSender = Utils.getBetween(resp, "senderEmail", "selected\":true");
                                                                        emailSender = Utils.getBetween(emailSender, "\"value\":\"", "\",");
                                                                    }
                                                                    catch
                                                                    { }
                                                                }

                                                            }
                                                            catch
                                                            { }

                                                            try
                                                            {
                                                                ContactName = ContactName.Trim();
                                                                ContactName = Utils.getBetween("###" + ContactName, "###", "(");
                                                                ContactName = ContactName.Replace(" ", "+");
                                                            }
                                                            catch
                                                            { }

                                                            string postUrlFinal = "https://www.linkedin.com/inbox/mailbox/message/send";
                                                            string PostDataFinal = "senderEmail=" + emailSender + "&ccInput=&subject=" + tempsubject.Replace(" ", "+") + "&body=" + tempBody.Replace(" ", "+") + "&persist=true&showRecipients=showRecipients&isReply=&isForward=&itemId=&recipients=" + ToCd + "&recipientNames=%5B%7B%22memberId%22%3A" + ToCd + "%2C%22fullName%22%3A%22" + ContactName + "%22%7D%5D&groupId=" + grpId + "&csrfToken=" + csrfToken + "&sourceAlias=0_3mbGc9okCQbybxvc2A5Vz5&submit=Send+Message";


                                                            ResponseStatusMsg = HttpHelper.postFormData(new Uri(postUrlFinal), PostDataFinal);
                                                        }
                                                        catch
                                                        {
                                                        }
                                                    }
                                                    #endregion
                                                    if (!ResponseStatusMsg.Contains("Your message was successfully sent"))
                                                    {
                                                        //string Url_compose1 = "https://www.linkedin.com/inbox/#compose?connId=" + ToCd + "&groupId=" + grpId;
                                                        //string Responce1 = HttpHelper.getHtmlfromUrl(new Uri(Url_compose1));

                                                        //string postUrlFinal1 = "https://www.linkedin.com/inbox/mailbox/message/send";
                                                        //string PostDataFinal1 = "senderEmail=914640570&ccInput=&subject=" + Uri.EscapeDataString(tempsubject.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&persist=true&showRecipients=showRecipients&isReply=&isForward=&itemId=&recipients=" + ToCd + "&recipientNames=%5B%7B%22memberId%22%3A" + ToCd + "%2C%22fullName%22%3A%22" + ContactName + "%22%7D%5D&groupId=" + grpId + "&csrfToken=" + csrfToken + "&sourceAlias=0_3mbGc9okCQbybxvc2A5Vz5&submit=Send+Message";


                                                        //ResponseStatusMsg = HttpHelper.postFormData(new Uri(postUrlFinal1), PostDataFinal1);

                                                        //if (ResponseStatusMsg.Contains("upload_error") && ResponseStatusMsg.Contains("There was an error with the file upload. Please try again later"))
                                                        //{
                                                        //    PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                        //    ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                                        //}
                                                    }
                                                    //Comment By ajay 
                                                    //PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                    //ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (ds_bList.Tables.Count > 0)
                                            {
                                                if (ds_bList.Tables[0].Rows.Count > 0)
                                                {

                                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ User: "******" is Added BlackListed List For Send Messages Pls Check ]");
                                                    ResponseStatusMsg = "BlackListed";
                                                }
                                                else
                                                {

                                                    #region  wriiten by sharan

                                                    #region Send InMail
                                                    if (IssendInMail)
                                                    {
                                                        try
                                                        {
                                                            string csrfToken_inmail = string.Empty;
                                                            string Referer_InMail = string.Empty;
                                                            string authToken = string.Empty;

                                                            string url = "https://www.linkedin.com/premium/inmail/compose?destID=" + ToCd;
                                                            string responce_Inmail = HttpHelper.getHtmlfromUrl(new Uri(url));
                                                            if (!string.IsNullOrEmpty(responce_Inmail))
                                                            {
                                                                csrfToken_inmail = Utils.getBetween(responce_Inmail, "csrfToken=", "\">");
                                                                // Referer_InMail = Utils.getBetween(responce_Inmail, "X-FS-Origin-Request\":\"", "\"");



                                                            }

                                                            string subject_InMail = tempsubject.Replace(" ", "+");
                                                            string body_InMail = tempBody.Replace(" ", "+");
                                                            Referer_InMail = "https://www.linkedin.com/premium/inmail/compose?destID=" + ToCd;
                                                            string Action_url_InMail = "https://www.linkedin.com/premium/inmail/send?csrfToken=" + csrfToken_inmail;
                                                            // Referer_InMail = "https://www.linkedin.com/premium/inmail/compose?destID=" + ToCd + "&creationType=DC&authToken=" + authToken + "&authType=name&utm_source=Profile_inmail&utm_medium=onsite&utm_campaign=Subs";
                                                            string postData_InMail = "title=" + subject_InMail + "&document=" + body_InMail + "&destID=" + ToCd + "&creationType=DC&proposalType=" + category_to_send_inmail + "&authType=&authToken=";
                                                            ResponseStatusMsg = HttpHelper.postDataFormessagePosting(new Uri(Action_url_InMail), postData_InMail, Referer_InMail);


                                                        }
                                                        catch
                                                        { }


                                                    }
                                                    #endregion

                                                    #region directMessage
                                                    else
                                                    {
                                                        try
                                                        {
                                                            string Url_compose = "https://www.linkedin.com/inbox/#compose?connId=" + ToCd + "&groupId=" + grpId;
                                                            string Responce = HttpHelper.getHtmlfromUrl(new Uri(Url_compose));

                                                            string url = "https://www.linkedin.com/inbox/compose?connId=" + ToCd + "&groupId=" + grpId;
                                                            string emailSender = string.Empty;
                                                            string resp = HttpHelper.getHtmlfromUrl(new Uri(url));
                                                            try
                                                            {
                                                                emailSender = Utils.getBetween(resp, "senderEmail-composeForm", "recipientNames");
                                                                emailSender = Utils.getBetween(emailSender, "value\":\"", "\"}");
                                                                if (string.IsNullOrEmpty(emailSender))
                                                                {
                                                                    try
                                                                    {
                                                                        emailSender = Utils.getBetween(resp, "senderEmail", "selected\":true");
                                                                        emailSender = Utils.getBetween(emailSender, "\"value\":\"", "\",");
                                                                    }
                                                                    catch
                                                                    { }
                                                                }
                                                            }
                                                            catch
                                                            { }

                                                            try
                                                            {
                                                                ContactName = ContactName.Trim();
                                                                ContactName = Utils.getBetween("###" + ContactName, "###", "(");
                                                                ContactName = ContactName.Replace(" ", "+");
                                                            }
                                                            catch
                                                            { }

                                                            string postUrlFinal = "https://www.linkedin.com/inbox/mailbox/message/send";
                                                            string PostDataFinal = "senderEmail=" + emailSender + "&ccInput=&subject=" + tempsubject.Replace(" ", "+") + "&body=" + tempBody.Replace(" ", "+") + "&persist=true&showRecipients=showRecipients&isReply=&isForward=&itemId=&recipients=" + ToCd + "&recipientNames=%5B%7B%22memberId%22%3A" + ToCd + "%2C%22fullName%22%3A%22" + ContactName + "%22%7D%5D&groupId=" + grpId + "&csrfToken=" + csrfToken + "&sourceAlias=0_3mbGc9okCQbybxvc2A5Vz5&submit=Send+Message";


                                                            ResponseStatusMsg = HttpHelper.postFormData(new Uri(postUrlFinal), PostDataFinal);
                                                        }
                                                        catch
                                                        {
                                                        }
                                                    }

                                                    #endregion

                                                    if (ResponseStatusMsg.Contains("Sorry, you have reached a limit for directly messaging group members"))
                                                    {
                                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Sorry, you have reached a limit for directly messaging group members]");
                                                        return;
                                                    }

                                                    if (!ResponseStatusMsg.Contains("Your message was successfully sent"))
                                                    {
                                                        try
                                                        {
                                                            //string action_url = "https://www.linkedin.com/premium/inmail/send?csrfToken=" + csrfToken;
                                                            //string referer = "https://www.linkedin.com/premium/inmail/compose?destID=" + ToCd + "&creationType=OPEN_LINK&authToken=mdaI&authType=name&utm_source=Profile_inmail&utm_medium=onsite&utm_campaign=Subs";
                                                            //string pd = "title=" + tempsubject.Replace(" ", "+") + "&document=" + tempBody.Replace(" ", "+") + "&destID=" + ToCd + "&creationType=OPEN_LINK&proposalType=JOB_OFFER&senderEmail=&authType=name&authToken=llYo";
                                                            //ResponseStatusMsg = HttpHelper.postDataFormessagePosting(new Uri(action_url), pd, referer);
                                                        }
                                                        catch
                                                        { }
                                                    }
                                                    #endregion


                                                    //string Url_compose = "https://www.linkedin.com/inbox/#compose?connId=" + ToCd + "&groupId=" + grpId;
                                                    //string Responce = HttpHelper.getHtmlfromUrl(new Uri(Url_compose));

                                                    //string postUrlFinal = "https://www.linkedin.com/inbox/mailbox/message/send";
                                                    //string PostDataFinal = "senderEmail=913067065&ccInput=&subject=" + Uri.EscapeDataString(tempsubject) + "+&body=" + Uri.EscapeDataString(tempBody) + "&persist=true&showRecipients=showRecipients&isReply=&isForward=&itemId=&recipients=" + ToCd + "&recipientNames=%5B%7B%22memberId%22%3A" + ToCd + "%2C%22fullName%22%3A%22" + ContactName.Replace(" ", "+") + "%22%7D%5D&groupId=" + grpId + "&csrfToken=" + csrfToken + "&sourceAlias=0_3mbGc9okCQbybxvc2A5Vz5&submit=Send+Message";

                                                    //ResponseStatusMsg = HttpHelper.postFormData(new Uri(postUrlFinal), PostDataFinal);

                                                    //if (ResponseStatusMsg.Contains("upload_error") && ResponseStatusMsg.Contains("There was an error with the file upload. Please try again later"))
                                                    //{
                                                    //    PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(tempsubject.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                    //    ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                                    //}






                                                }
                                            }
                                        }
                                    }
                                    catch (Exception)
                                    {
                                        //PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&showRecipeints=showRecipeintsfromName=" + Uri.EscapeDataString(FromEmailNam) + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                        //ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groupMsg"), PostMessage);
                                    }
                                    #region commented for null response
                                    //if (string.IsNullOrEmpty(ResponseStatusMsg))
                                    //{
                                    //    try
                                    //    {
                                    //        string action_url = "https://www.linkedin.com/messaging/compose?connId="+ToCd+"&groupId="+grpId;
                                    //        string referer = "https://www.linkedin.com/grp/members?gid="+grpId;
                                    //        string get_response = HttpHelper.getHtmlfromUrl(new Uri(action_url));

                                    //        if (get_response.Contains("memberProfile"))
                                    //        {
                                    //            string all_details = Utils.getBetween(get_response, "<code id", "<script>");
                                    //            string[] arr = Regex.Split(all_details, "recipients");
                                    //            string recipient_details = string.Empty;
                                    //            string authToken = string.Empty;

                                    //            foreach (string item in arr)
                                    //            {
                                    //                if (item.Contains(ToCd))
                                    //                {
                                    //                    recipient_details = item;
                                    //                    break;
                                    //                }
                                    //            }

                                    //            authToken = Utils.getBetween(recipient_details, "authToken", "\"}");



                                    //            string s1 = Utils.getBetween("###" + authToken, "###", "profileId");
                                    //            string first_last_name = Utils.getBetween("###" + s1, "", "profileId");
                                    //            first_last_name = first_last_name + "profileId\":\"";


                                    //        }

                                    //    }
                                    //    catch
                                    //    { }
                                    //}
                                    #endregion

                                    #region commented by sharan after LI update

                                    //if ((!ResponseStatusMsg.Contains("Your message was successfully sent.") && !ResponseStatusMsg.Contains("Already Sent")) && (!ResponseStatusMsg.Contains("Se ha enviado tu mensaje satisfactoriamente") && !ResponseStatusMsg.Contains("Ya ha sido enviada") && !ResponseStatusMsg.Contains("Uw bericht is verzonden")))
                                    //{

                                    //    if (ResponseStatusMsg.Contains("Already Sent") || (ResponseStatusMsg.Contains("Ya ha sido enviada") || (ResponseStatusMsg.Contains("BlackListed"))))
                                    //    {
                                    //        continue;
                                    //    }

                                    //    try
                                    //    {
                                    //        pageSource = HttpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/groups?viewMembers=&gid=" + grpId));

                                    //        if (pageSource.Contains("contentType="))
                                    //        {
                                    //            try
                                    //            {
                                    //                string Url_compose = "https://www.linkedin.com/inbox/#compose?connId=" + ToCd + "&groupId=" + grpId;
                                    //                string Responce = HttpHelper.getHtmlfromUrl(new Uri(Url_compose));

                                    //                string postUrlFinal = "https://www.linkedin.com/inbox/mailbox/message/send";
                                    //                string PostDataFinal = "senderEmail=914640570&ccInput=&subject=" + Uri.EscapeDataString(tempsubject.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&persist=true&showRecipients=showRecipients&isReply=&isForward=&itemId=&recipients=" + ToCd + "&recipientNames=%5B%7B%22memberId%22%3A" + ToCd + "%2C%22fullName%22%3A%22" + ContactName + "%22%7D%5D&groupId=" + grpId + "&csrfToken=" + csrfToken + "&sourceAlias=0_3mbGc9okCQbybxvc2A5Vz5&submit=Send+Message";


                                    //                ResponseStatusMsg = HttpHelper.postFormData(new Uri(postUrlFinal), PostDataFinal);

                                    //                if (ResponseStatusMsg.Contains("upload_error") && ResponseStatusMsg.Contains("There was an error with the file upload. Please try again later"))
                                    //                {
                                    //                    PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(tempsubject.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                    //                    ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                    //                }

                                    //                #region MyRegion

                                    //                #endregion
                                    //            }
                                    //            catch (Exception ex)
                                    //            {
                                    //            }
                                    //        }


                                    //        ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                    //    }
                                    //    catch (Exception ex)
                                    //    {

                                    //    }
                                    //}

                                    #endregion

                                    if ((ResponseStatusMsg.Contains("Your message was successfully sent.")) || (ResponseStatusMsg.Contains("Se ha enviado tu mensaje satisfactoriamente") || (ResponseStatusMsg.Contains("Uw bericht is verzonden")) || ResponseStatusMsg.Contains("success")) || ResponseStatusMsg.Contains("inmCategory"))
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Subject Posted : " + tempsubject + " ]");
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Body Text Posted : " + tempBody.ToString() + " ]");
                                        if (IssendInMail)
                                        {
                                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ InMail  Posted To Account: " + ContactName + " ]");
                                        }
                                        else
                                        {
                                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message Posted To Account: " + ContactName + " ]");
                                        }

                                        ReturnString = "Your message was successfully sent.";

                                        #region CSV
                                        string bdy = string.Empty;
                                        try
                                        {
                                            bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                                        }
                                        catch { }
                                        if (string.IsNullOrEmpty(bdy))
                                        {
                                            bdy = tempBody.ToString().Replace(",", ":");
                                        }
                                        string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                        string CSV_Content = UserName + "," + tempsubject + "," + bdy.ToString() + "," + ContactName;
                                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, FilePath.path_MessageSentGroupMember);

                                        try
                                        {
                                            InsertMsgGroupMemData(UserName, Convert.ToInt32(connId), ContactName, Convert.ToInt32(grpId), SelectedGrpName, msg, tempBody);
                                        }
                                        catch { }

                                        #endregion

                                    }
                                    else if (ResponseStatusMsg.Contains("There was an unexpected problem that prevented us from completing your request"))
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ There was an unexpected problem that prevented us from completing your request ! ]");
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", FilePath.path_MessageGroupMember);
                                    }
                                    else if (ResponseStatusMsg.Contains("You are no longer authorized to message this"))
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ You are no longer authorized to message this ! ]");
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", FilePath.path_MessageGroupMember);
                                    }
                                    else if ((ResponseStatusMsg.Contains("Already Sent")) || (ResponseStatusMsg.Contains("Ya ha sido enviada")))
                                    {
                                        string bdy = string.Empty;
                                        try
                                        {
                                            bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                                        }
                                        catch { }
                                        if (string.IsNullOrEmpty(bdy))
                                        {
                                            bdy = tempBody.ToString().Replace(",", ":");
                                        }
                                        string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                        string CSV_Content = UserName + "," + msg + "," + bdy.ToString() + "," + ContactName;
                                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, FilePath.path_MessageAlreadySentGroupMember);

                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message Not Posted To Account: " + ContactName + " because it has sent the same message]");
                                    }
                                    else
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Error In Message Posting ]");
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", FilePath.path_MessageGroupMember);
                                    }

                                    int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                                    Thread.Sleep(delay * 1000);

                                }
                                catch (Exception ex)
                                {
                                    //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, FilePath.path_MessageGroupMember);
                                }
                            }
                            catch (Exception ex)
                            {
                                //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace);
                                GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, FilePath.path_MessageGroupMember);
                            }
                        }

                    }

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



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

        }
        public void StartActionMultithreadRePin(ref PinInterestUser objPinUserRepin, List<string> Usercount)
        {
 
            try
            {
                try
                {
                    lstThreadsRePin.Add(Thread.CurrentThread);
                    lstThreadsRePin.Distinct().ToList();
                    Thread.CurrentThread.IsBackground = true;
                }
                catch (Exception ex)
                { };
                PinInterestUser objPinUser = (PinInterestUser)objPinUserRepin;
                string screen_Name = objPinUser.ScreenName;
                clsSettingDB db = new clsSettingDB();
                if (ObjAccountManager.Boards.Count <= 0)
                {
                    try
                    {
                        GetBoardsForRepinUpdated(ref objPinUser, screen_Name);
                        //new Thread(() => GetBoardsForRepinUpdated(ref objPinUser, screen_Name)).Start(); // Not returning only Board but Pics also
                        //GetBoardsForRepinUpdated(ref objPinUser, screen_Name);
                    }
                    catch (Exception Ex)
                    {

                    }
                }
                if (objPinUser.Boards.Count > 0 || objPinUser.Boards.Count == 0) 
                {
                    Random Boardrnd = new Random();
                    int BoardNum = 0;

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

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

                    int RepinCount = 0;

                    if (!rdbUsePinNo)
                    {
                        try
                        {
                            if (rdbRepinNormalType == true)
                            {
								GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Getting Normal Pins From Account ]");
                                lstAllPins = objLikeManager.GetPins(ref objPinUser, maxNoOfRePinCount);
                                Random Pinrnd = new Random();
                                ClGlobul.lstPins = lstAllPins.OrderBy(x => Pinrnd.Next()).ToList();
                            }
                            else
                            {
                                try
                                {
									GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Getting Random Users Pins From Account ]");

                                    string userName = objPinUser.ScreenName;
                                    userName = screen_Name;

                                    //lstFollowings = objScrape.GetUserFollowing_new(userName, 1, maxNoOfRePinCount);//GetUserFollowing
                                    lstFollowings = GetUserFollowing(userName, 1, maxNoOfRePinCount);
                                    foreach (string FollowName in lstFollowings)
                                    {
                                            try
                                            {
                                                Random rnd = new Random();
                                                int FollowingNum = rnd.Next(0, lstFollowings.Count - 1);
                                                FollowingName = lstFollowings[FollowingNum];
                                                ClGlobul.lstPins.Clear();
                                                List<string> lstRepinPin = UserPins_Repin(FollowingName, ref objPinUser);
                                                ClGlobul.lstPins.AddRange(lstRepinPin);
                                                ClGlobul.lstPins = ClGlobul.lstPins.Distinct().ToList();
                                                if (maxNoOfRePinCount < ClGlobul.lstPins.Count)
                                                {
                                                    break;
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                                            }                                        
                                    }

                                    // ClGlobul.lstPins = UserPins_Repin(FollowingName, ref objPinUser);
                                    //ClGlobul.lstPins = objLikeManager.GetPins(ref objPinUser, maxNoOfRePinCount);
                                    //checklogin = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com"));
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                                }
                            }

                            string Message = string.Empty;
                            string[] lstPinsArray = ClGlobul.lstPins.ToArray();

                            foreach (string Pin in lstPinsArray)
                            {
                                try
                                {
                                    if (NumberHelper.ValidateNumber(Pin))
                                    {
                                        try
                                        {
                                            if (maxNoOfRePinCount == RepinCount)
                                            {
                                                break;
                                            }
                                            if (maxNoOfRePinCount >= RepinCount)
                                            {
                                                Random Messagernd = new Random();
                                                int MessageNum = 0;

                                                if (ClGlobul.RepinMessagesList.Count == 2)
                                                {
                                                    try
                                                    {
                                                        foreach (var itemMsg in ClGlobul.RepinMessagesList)
                                                        {
                                                            if (Message == itemMsg)
                                                            {
                                                                continue;
                                                            }
                                                            else
                                                            {
                                                                Message = itemMsg;
                                                                break;
                                                            }
                                                        }
														GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Message :" + Message + " ]");
                                                    }
                                                    catch (Exception ex)
                                                    {

                                                    }
                                                }
                                                else if (ClGlobul.RepinMessagesList.Count > 0)
                                                {
                                                    try
                                                    {
                                                        MessageNum = Messagernd.Next(0, ClGlobul.RepinMessagesList.Count - 1);
                                                        Message = ClGlobul.RepinMessagesList[MessageNum].Trim();
														GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Message :" + Message + " ]");
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        //GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartRepinMultiThreaded() 2--> " + ex.Message, ApplicationData.ErrorLogFile);
                                                    }
                                                }

                                                try
                                                {
                                                    string NoOfPages = "0";//No use as far as I know
                                                    try
                                                    {
                                                        int index = ClGlobul.lstPins.Where(x => x == Pin).Select(x => ClGlobul.lstPins.IndexOf(x)).Single<int>();
                                                        NoOfPages = Convert.ToString(index / 25);
                                                    }
                                                    catch { }

                                                    try
                                                    {
                                                        Random rndBoard = new Random();
                                                        int NumBoard = rndBoard.Next(0, objPinUser.Boards.Count - 1);
                                                        BoardNumber = objPinUser.Boards[NumBoard];
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                    }

                                                    string Url = "https://www.pinterest.com/" + objPinUser.ScreenName;
                                                    if (string.IsNullOrEmpty(oneTimePagesource))
                                                    {
                                                        try
                                                        {
                                                            GlobusHttpHelper objHttp = new GlobusHttpHelper();
                                                            oneTimePagesource = objHttp.getHtmlfromUrl(new Uri(Url), "", "", "");
                                                        }
                                                        catch { };
                                                    }
                                                    if (arrBoardName == null)
                                                    {
                                                        try
                                                        {
                                                            arrBoardName = Regex.Split(oneTimePagesource, "board\", \"id\"");
                                                        }
                                                        catch { };
                                                    }
                                                    foreach (var itemBoardName in arrBoardName)
                                                    {
                                                        try
                                                        {
                                                            if (itemBoardName.Contains(BoardNumber))//&&itemBoardName.Contains("board\", \"id\""))
                                                            {
                                                                BoardName = Utils.Utils.getBetween(itemBoardName, "name", "}").Replace(":", "").Replace("\"", "").Trim();
                                                            }
                                                        }
                                                        catch (Exception ex)
                                                        {

                                                        }
                                                    }

                                                    BoardName = BoardName.Replace(" ", "-").ToLower().Replace("(", "").Replace(")", "").Replace("!", "").Trim();

                                                    bool IsRePined = RepinwithMessage(Pin, Message, BoardNumber, NoOfPages, ref objPinUser);
                                                    if (IsRePined)
                                                    {
                                                        #region AccountReport

//                                                        string module = "RePin";
//                                                        string status = "Repined";
//                                                        Qm.insertAccRePort(objPinUser.Username, module, "https://www.pinterest.com/pin/" + Pin, "", "", Message, "", "", status, "", "", DateTime.Now);
//                                                        objRepinDelegate();

                                                        #endregion

                                                        db.insertRePinRecord(objPinUser.Username, objPinUser.Niches, Pin);
                                                        RepinCount++;

                                                        try
                                                        {
                                                            string CSV_Header = "UserName" + "," + "Pin" + "," + "Message" + "," + "Board Number" + "," + "BoardUrl" + "," + "Date";
                                                            string CSV_Data = objPinUser.Username + "," + "https://www.pinterest.com/pin/" + Pin + "," + Message + "," + "Board No. : " + BoardNumber + "," + Url + "/" + BoardName + "," + System.DateTime.Now.ToString();
                                                            string path = PDGlobals.FolderCreation(PDGlobals.Pindominator_Folder_Path, "Repin");
                                                            PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, path + "\\Repin.csv");
                                                        }
                                                        catch (Exception ex)
                                                        {

                                                        }
                                                    }
                                                    else
                                                    {
                                                        RepinCount++;

                                                    }
                                                    if (rdbDivideGivenByUser_RePin == true)
                                                    {
                                                        CountGivenByUser_RePin--;
                                                        if (CountGivenByUser_RePin < 0)
                                                        {
                                                            break;
                                                        }
                                                    }

                                                    int delay = RandomNumberGenerator.GenerateRandom(minDelayRePin, maxDelayRePin);
													GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Delay For " + delay + " Seconds ]");
                                                    Thread.Sleep(delay * 1000);
                                                }
                                                catch (Exception ex)
                                                {
                                                    //GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartRepinMultiThreaded() 3--> " + ex.Message, ApplicationData.ErrorLogFile);
                                                }
                                            }

                                           
                                        }
                                        catch (Exception ex)
                                        {
                                            // GlobusFileHelper.AppendStringToTextfileNewLine("Error --> StartRepinMultiThreaded() 4--> " + ex.Message, ApplicationData.ErrorLogFile);
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {

                                }
                            }                          
                        }
                        catch (Exception ex)
                        {

                        }
                    }
                    else if (rdbUsePinNo == true)
                    {
                        try
                        {

                            if (ClGlobul.lstRepinUrl.Count < maxNoOfRePinCount)
                            {
								GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [Repin Count can't be greater than uploaded Pins.]");
                                return;
                            }
							GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repining Uploaded Pins ]");
                            int RepinCount_ListRepin_New = maxNoOfRePinCount;

                            foreach (string RepinUrl in Usercount)
                            {
                                try
                                {                              
                                        if (RepinCount_ListRepin_New <= 0)
                                        {
                                            break;
                                        }
                                    //}
                                }
                                catch { };
                              
                                string NoOfPages = "0";

                                try
                                {

                                    int index = ClGlobul.lstRepinUrl.Where(x => x == RepinUrl).Select(x => ClGlobul.lstRepinUrl.IndexOf(x)).Single<int>();
                                    NoOfPages = Convert.ToString(index / 25);
                                }
                                catch { };


                                string Message = string.Empty;
                                if (ClGlobul.RepinMessagesList.Count > 1)
                                {
                                    Message = ClGlobul.RepinMessagesList[RandomNumberGenerator.GenerateRandom(0, ClGlobul.RepinMessagesList.Count - 1)];
                                }
                                else if (ClGlobul.RepinMessagesList.Count == 1)
                                {
                                    Message = ClGlobul.RepinMessagesList[0];
                                }
                                else
                                {
                                    Message = "";
                                }

                                Thread.Sleep(1000);
                                bool IsRepinned = RepinwithMessage(RepinUrl.Replace(" ", ""), Message, BoardNumber, NoOfPages, ref objPinUser);

                                if (IsRepinned)
                                {
                                    #region AccountReport

//                                    string module = "RePin";
//                                    string status = "Repined";
//                                    Qm.insertAccRePort(objPinUser.Username, module, "https://www.pinterest.com/pin/" + RepinUrl, "", "", Message, "", "", status, "", "", DateTime.Now);
//                                    objRepinDelegate();

                                    #endregion

									GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Repin Pin : " + RepinUrl + " ]");
                                    db.insertRePinRecord(objPinUser.Username, objPinUser.Niches, RepinUrl);
                                    RepinCount++;
                                    RepinCount_ListRepin_New--;
                                    try
                                    {
                                        string CSV_Header = "UserName" + "," + "RepinUrl" + "," + "Message" + "," + "Board Number" + "," + "Date";
                                        string CSV_Data = objPinUser.Username + "," + "https://www.pinterest.com/pin/" + RepinUrl + "," + Message + "," + "Board No. : " + BoardNumber + "," + System.DateTime.Now.ToString();
                                        string path = PDGlobals.FolderCreation(PDGlobals.Pindominator_Folder_Path, "Repin");
                                        PDGlobals.ExportDataCSVFile(CSV_Header, CSV_Data, path + "\\UsePin.csv");
                                    }
                                    catch (Exception ex)
                                    {

                                    }
                                }
                                else
                                {
									GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Not Repin Pin : " + RepinUrl + " ]");
                                }
                                int Delay = RandomNumberGenerator.GenerateRandom(minDelayRePin, maxDelayRePin);
								GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Delay for " + Delay + " Seconds ]");
                                Thread.Sleep(Delay * 1000);

                            }
                        }

                        catch (Exception ex)
                        { };

                    }
                    else
                    {
						GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ No Boards Found in Account :" + objPinUser.Username + " ]");
                    }
                }

            }
            catch(Exception ex)
            {
                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
            }
            finally
            {
                RePindata_count--;              
                try
                {
                    if (countThreadControllerRePin >= NoOfThreadsRePin)
                    {
                        lock (RePinObjThread)
                        {
                            Monitor.Pulse(RePinObjThread);
                        }
                    }
                }
                catch (Exception Ex)
                {

                }
                countThreadControllerRePin--;

                if (RePindata_count == 0 || CountGivenByUser_RePin < 0)
                {                  
					GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ PROCESS COMPLETED ]");
                GlobusLogHelper.log.Info("-------------------------------------------------------------------------------------");
                }
            }
        }
        public string FromEmailCodeMsgGroupMem(ref GlobusHttpHelper HttpHelper, string gid)
        {
            string FromId = string.Empty;
            string pageSource = string.Empty;
            string[] RgxGroupData = new string[] { };
            List<string> lstpasttitle = new List<string>();
            List<string> checkpasttitle = new List<string>();
            string GroupName = string.Empty;
            string csrfToken = string.Empty;
            string[] RgxSikValue = new string[] { };
            string[] RgxPageNo = new string[] { };
            string sikvalue = string.Empty;


            try
            {
                string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));

                if (pageSource1.Contains("csrfToken"))
                {
                    csrfToken = pageSource1.Substring(pageSource1.IndexOf("csrfToken"), 50);
                    string[] Arr = csrfToken.Split('>');
                    csrfToken = Arr[0];
                    csrfToken = csrfToken.Replace(":", "%3A").Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty).Replace("\n", string.Empty).Replace(">", string.Empty).Replace("<script src", string.Empty);
                    csrfToken = csrfToken.Trim();
                }

                pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/groups?viewMembers=&gid=" + gid));
                RgxSikValue = System.Text.RegularExpressions.Regex.Split(pageSource, "sik");

                try
                {
                    sikvalue = RgxSikValue[1].Split('&')[0].Replace("=", string.Empty);
                }
                catch { }

                try
                {
                    if (NumberHelper.ValidateNumber(sikvalue))
                    {
                        sikvalue = sikvalue.Split('\"')[0];
                    }
                    else
                    {
                        sikvalue = sikvalue.Split('\"')[0];
                    }
                }
                catch
                {
                    sikvalue = sikvalue.Split('\"')[0];
                }


                string getdata = "http://www.linkedin.com/groups?viewMembers=&gid=" + gid + "&sik=" + sikvalue + "&split_page=1";
                pageSource = HttpHelper.getHtmlfromUrl(new Uri(getdata));
                RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "name=\"fromEmail\"");

                try
                {
                    FromId = RgxGroupData[1].Split('=')[1];
                    FromId = FromId.Replace("id", string.Empty).Replace("\"", string.Empty).Trim().ToString();
                }
                catch { }
            }
            catch
            {
                return FromId;
            }


            return FromId;
        }
        public List<string> UserPins_Repin(string UserName, ref PinInterestUser objPinUser)
        {
            List<string> lstUsernamePin = new List<string>();
            try
            {
                GlobusRegex objGlobusRegex = new GlobusRegex();
                GlobusHttpHelper objglobusHttpHelper = new GlobusHttpHelper();
				GlobusLogHelper.log.Info("[ " + DateTime.Now + "] => [ Start Getting Pins For this User " + UserName + " ]");
                string UserPins = string.Empty;
               
                if (UserName.Contains("pinterest.com"))
                {
                    UserUrl = UserName;
                    UserPins = UserName + "pins/";
                }
                else
                {
                    UserUrl = "https://pinterest.com/" + UserName + "/";
                    UserPins = "https://pinterest.com/" + UserName + "/pins/";
                }

                try
                {
                    UserPageSource = objglobusHttpHelper.getHtmlfromUrl(new Uri(UserUrl), "http://pinterest.com/", string.Empty, objPinUser.UserAgent);
                    UserPinPageSource = objglobusHttpHelper.getHtmlfromUrl(new Uri(UserPins), UserUrl, string.Empty, objPinUser.UserAgent);
                }
                catch (Exception ex)
                {
                }
                List<string> lst = objGlobusRegex.GetHrefUrlTagsForPinDescription(UserPinPageSource);
                lst = lst.Distinct().ToList();
                string PinUrl = string.Empty;

                foreach (string item in lst)
                {
                    try
                    {
                        if (item.Contains("/pin/"))
                        {
                            if (!item.Contains("/pin/A"))
                            {
                                try
                                {
                                    int FirstPinPoint = item.IndexOf("/pins/");
                                    int SecondPinPoint = item.IndexOf("class=");									                               
                                    PinUrl = Utils.Utils.getBetween(item, "/pin/", "/\" class=");
                                    if (!string.IsNullOrEmpty(PinUrl))
                                    {
                                        lstUsernamePin.Add(PinUrl);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    PinUrl = item.Replace("/pins/", "");
                                    lstUsernamePin.Add(PinUrl);
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {

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

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

            return lstUsernamePin;
        }
        public string FromName(ref GlobusHttpHelper HttpHelper)
        {
            try
            {
                string FromNm = string.Empty;

                string pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/profile/edit?trk=nav_responsive_sub_nav_edit_profile"));

                string[] RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "fmt_full_display_name");


                foreach (var fromname in RgxGroupData)
                {
                    if (fromname.Contains("\":\""))
                    {
                        try
                        {
                            if (!(fromname.Contains("<!DOCTYPE html>")))
                            {
                                try
                                {
                                    int StartIndex = fromname.IndexOf("\":\"");
                                    string start = fromname.Substring(StartIndex);
                                    int endIndex = start.IndexOf("i18n_optional_not_pinyin");
                                    FromNm = start.Substring(0, endIndex).Replace("\"", string.Empty).Replace("\":\"", string.Empty);
                                    FromNam = FromNm.Split(',')[0].Replace(":", string.Empty).Replace("\\u002d", "-");
                                }
                                catch
                                { }
                                try
                                {
                                    if (string.IsNullOrEmpty(FromNm) || FromNm.Contains("LastName"))
                                    {
                                        int StartIndex = fromname.IndexOf("\":\"");
                                        string start = fromname.Substring(StartIndex);
                                        int endIndex = start.IndexOf(",");
                                        FromNm = start.Substring(0, endIndex).Replace("\"", string.Empty).Replace("\":\"", string.Empty);
                                        FromNam = FromNm.Split(',')[0].Replace(":", string.Empty);
                                    }
                                }
                                catch
                                { }
                            }
                        }
                        catch { }
                    }
                }



                return FromNam;


            }
            catch (Exception ex)
            {
                return FromNam;
            }



        }
        public void UnFollowBack(ref InstagramUser Gram_Obj)
        {
            try
            {
                lstThreadsunFollowerbackPoster.Add(Thread.CurrentThread);
                lstThreadsunFollowerbackPoster.Distinct();
                Thread.CurrentThread.IsBackground = true;
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
            DataSet ds = null;
            int days = No_Days_To_Unfollow;
            try
            {
                ds = Qm.SelectFollowUser("Followed", Gram_Obj.username);
                DataTable firstTable = ds.Tables[0];

                if(firstTable.Rows.Count==0)
                {
                    GlobusLogHelper.log.Info("!! Inputed Days you Enter at that Days you not Follow Any user Thourgh This Bot !!");
                    return;
                }


                foreach (DataRow dRow in firstTable.Rows)
                {
                    string following_username = dRow["FollowTime"].ToString() + "";
                    string follow_Username = dRow["FollowingUser"].ToString() + "";
                    DateTime dt = DateTime.Parse(following_username);
                   TimeSpan tsDays =  DateTime.Now.Date.Subtract(dt.Date);
                   if (tsDays.TotalDays <= days)
                 {
                     lst_UnfollowUser.Add(follow_Username);
                     lst_UnfollowUser = lst_UnfollowUser.Distinct().ToList();
                 }
                    

                }
                GlobusHttpHelper obj_globalus = new GlobusHttpHelper();
                #region Scrape Follower

                string gramfeed_user_Url = "http://www.gramfeed.com/" + Gram_Obj.username;               
                List<string> follower_list = new List<string>();
                int count = 0;
                ClGlobul.switchAccount = false;
                string GramFeed_Userhit = obj_globalus.getHtmlfromUrl(new Uri(gramfeed_user_Url), "");
                string client_Id = Utils.getBetween(GramFeed_Userhit, "client_id=", "&");
                string Id_Url = "https://api.instagram.com/v1/users/search?q=" + Gram_Obj.username + "&client_id=" + client_Id + "&callback=jQuery183011914858664385974_1455619732855&_=1455619735024";
                string Gram_Hit_second = obj_globalus.getHtmlfromUrl(new Uri(Id_Url), "");
                if (string.IsNullOrEmpty(Gram_Hit_second))
                {
                    Gram_Hit_second = obj_ChangeProxy.chnageproxyMethod(Id_Url);
                }
                string GramFeed_UserId = Utils.getBetween(Gram_Hit_second, "id\":", "\",").Replace(" ","").Replace("\"","");
                string Follower_Url = "https://api.instagram.com/v1/users/" + GramFeed_UserId + "/followed-by?client_id=" + client_Id + "&callback=jQuery183011914858664385974_1455619732855&_=1455619735024";
                string GramFeed_UserFollower = obj_globalus.getHtmlfromUrl(new Uri(Follower_Url), "");
                if(string.IsNullOrEmpty(GramFeed_UserFollower))
                {
                    GramFeed_UserFollower = obj_ChangeProxy.chnageproxyMethod(Follower_Url);
                }
                string[] follower_regexlist = Regex.Split(GramFeed_UserFollower, "username");
                foreach (string item in follower_regexlist)
                {
                    if (item.Contains("profile_picture"))
                    {
                        string user_name = Utils.getBetween(item, "\":\"", "\"");
                        if (!lst_Follower_unfollowback.Contains(user_name))
                        {

                            lst_Follower_unfollowback.Add(user_name);
                            lst_Follower_unfollowback = lst_Follower_unfollowback.Distinct().ToList();
                                                                                
                        }
                        else
                        {
                            break;
                        }
                    }
                }
              
                if (GramFeed_UserFollower.Contains("next_url"))
                {
                    value = true;
                    while (value)
                    {
                        if (GramFeed_UserFollower.Contains("next_url"))
                        {
                            string hit_data = Utils.getBetween(GramFeed_UserFollower, "next_url\":\"", "\",").Replace("\u0026", "&").Replace("\\", "").Replace("u0026", "&");
                            GramFeed_UserFollower = obj_globalus.getHtmlfromUrl(new Uri(hit_data), "");
                            string[] follower_regexlist2 = Regex.Split(GramFeed_UserFollower, "username");
                            foreach (string item in follower_regexlist2)
                            {
                                if (item.Contains("profile_picture"))
                                {
                                    string user_name = Utils.getBetween(item, "\":\"", "\"");
                                    if (!lst_Follower_unfollowback.Contains(user_name))
                                    {
                                        lst_Follower_unfollowback.Add(user_name);
                                        lst_Follower_unfollowback = lst_Follower_unfollowback.Distinct().ToList();                                                                                                                                                     
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }
                            }
                            //if (minDelayUnFollowerBack != 0)
                            //{
                            //    mindelay = minDelayUnFollowerBack;
                            //}
                            //if (maxDelayUnFollowerBack != 0)
                            //{
                            //    maxdelay = maxDelayUnFollowerBack;
                            //}

                            // delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                            //GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ");
                            //Thread.Sleep(delay * 1000);
                        }
                        else
                        {
                            value = false;
                        }
                    }                 
                }        
                #endregion

                #region UnfollowBack Process

                try
                {
                    int Sum = 0;
                    foreach (string item in lst_UnfollowUser)
                    {
                        string resp_test = Gram_Obj.globusHttpHelper.getHtmlfromUrl(new Uri("http://www.Instagram.com/" + item));
                        
                            if (!lst_Follower_unfollowback.Contains(item))
                            {
                                if (resp_test.Contains("followed_by_viewer\":false") || resp_test.Contains("requested_by_viewer\":false"))
                                {
                                    Sum++;
                                    IsunfollowBack = true;
                                    unfollowAccount(ref Gram_Obj, item, Sum);
                                   

                                    



                                    Qm.DeleteunfollowUser(item);                                    
                                    if (minDelayUnFollowerBack != 0)
                                    {
                                        mindelay = minDelayUnFollowerBack;
                                    }
                                    if (maxDelayUnFollowerBack != 0)
                                    {
                                        maxdelay = maxDelayUnFollowerBack;
                                    }
                                    Random rn = new Random();
                                 int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                                    delay = rn.Next(mindelay, maxdelay);
                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]");
                                    Thread.Sleep(delay * 1000);           
                                }
                                else
                                {
                                    if(resp_test.Contains("followed_by_viewer\":true") || resp_test.Contains("requested_by_viewer\":true"))
                                    {
                                        GlobusLogHelper.log.Info(item+ "--> Start Follow -->" +Gram_Obj.username);
                                    }
                                }
                            }
                            else
                            {
                                // User Follow Back to You.
                            }
                        
                    }
                }
                catch (Exception ex)
                {
                    GlobusLogHelper.log.Error("Error:" + ex.StackTrace);                   
                }
                #endregion


            }
            catch(Exception ex)
            {
                GlobusLogHelper.log.Error("Error:" + ex.StackTrace);
            }
            GlobusLogHelper.log.Info(" ---Process Completed--- ");
        }
Пример #44
0
        public void GetRecords(ref GlobusHttpHelper HttpHelper)
        {
            try
            {
                string csrfToken      = string.Empty;
                string LastName       = string.Empty;
                string FirstName      = string.Empty;
                string Industry       = string.Empty;
                string Postalcode     = string.Empty;
                string Distance       = string.Empty;
                string contentSummary = string.Empty;
                string Title          = string.Empty;
                string Company        = string.Empty;
                string school         = string.Empty;
                string Country        = string.Empty;
                string countrycode    = string.Empty;
                string industrycode   = string.Empty;
                string rsid           = string.Empty;

                string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));

                try
                {
                    try
                    {
                        string[] Arr_Pst = Regex.Split(postalCode, "(");
                    }
                    catch { }
                    try
                    {
                        Postalcode = postalCode.Substring(0, postalCode.IndexOf(" "));
                        Country    = postalCode.Replace(Postalcode, string.Empty).Replace(")", string.Empty).Replace("(", string.Empty).Trim();
                        //Postalcode = Arr_Pst[0].Replace(" ", string.Empty).Trim();
                        //Country = Arr_Pst[1].Replace("{", string.Empty).Replace("}", string.Empty).Trim();
                    }
                    catch
                    {
                        if (Postalcode == string.Empty)
                        {
                            Postalcode = postalCode;
                        }
                    }
                }
                catch { }
                if (pageSource.Contains("csrfToken"))
                {
                    csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 100);
                    string[] Arr = csrfToken.Split('&');
                    csrfToken = Arr[0];
                    csrfToken = csrfToken.Replace("csrfToken=", "");
                    csrfToken = csrfToken.Replace("%3A", ":");
                }
                InBoardPro.GetIndustryCode  objIndustry       = new GetIndustryCode();
                Dictionary <string, string> Dict_IndustryCode = new Dictionary <string, string>();


                Dict_IndustryCode = objIndustry.getIndustry();
                foreach (KeyValuePair <string, string> item in Dict_IndustryCode)
                {
                    try
                    {
                        string toloweritem         = item.Value.ToLower();
                        string tolowerindustrytype = industryType.ToLower();
                        if (toloweritem == tolowerindustrytype)
                        {
                            //SearchCriteria.Country = item.Key;
                            industrycode = item.Key;
                            break;
                        }
                    }
                    catch
                    {
                    }
                }

                Dictionary <string, string> Dict_CountryCode = new Dictionary <string, string>();
                Dict_CountryCode = objIndustry.getCountry();
                foreach (KeyValuePair <string, string> item in Dict_CountryCode)
                {
                    try
                    {
                        string toloweritem        = item.Value.ToLower();
                        string tolowercountrytype = Country.ToLower();
                        if (toloweritem == tolowercountrytype)
                        {
                            countrycode = item.Key;
                            break;
                        }
                    }
                    catch
                    {
                    }
                }
                string Firstresponse = string.Empty;
                if (string.IsNullOrEmpty(countrycode))
                {
                    countrycode = "us";
                }

                string FirstGetRequestUrl = string.Empty;
                string FirstGetResponse   = string.Empty;
                {
                    try
                    {
                        FirstGetRequestUrl = "http://www.linkedin.com/search/fpsearch?lname=" + lastName + "&searchLocationType=I&countryCode=" + countrycode + "&postalCode=" + Postalcode + "&distance=" + distance + "&keepFacets=keepFacets&page_num=1&facet_I=" + industrycode + "&pplSearchOrigin=ADVS&viewCriteria=2&sortCriteria=R&redir=redir";
                        FirstGetResponse   = HttpHelper.getHtmlfromUrl1(new Uri(FirstGetRequestUrl));
                    }
                    catch { }
                }

                int RecordCount = 0;
                try
                {
                    RecordCount = objIndustry.GetPageNo(FirstGetResponse);

                    if (RecordCount == 0)
                    {
                        string getAdvPagedata = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/vsearch/f?adv=true&trk=advsrch"), "http://www.linkedin.com/");

                        try
                        {
                            int    startindex = getAdvPagedata.IndexOf("rsid=");
                            string start      = getAdvPagedata.Substring(startindex).Replace("rsid=", "");
                            int    endindex   = start.IndexOf("&amp;");
                            string end        = start.Substring(0, endindex);
                            rsid = end;
                        }
                        catch (Exception ex)
                        {
                        }

                        //FirstGetRequestUrl = "http://www.linkedin.com/vsearch/p?lastName=" + lastName + "&postalCode=" + postalCode + "&openAdvancedForm=true&locationType=I&countryCode=" + countrycode + "&distance=" + distance + "&facet_I=" + industrycode + "&sortBy=R&rsid=" + rsid + "&orig=MDYS";
                        // http://www.linkedin.com/vsearch/p?lastName=James&postalCode=44101&openAdvancedForm=true&locationType=I&countryCode=us&distance=50&f_N=F,S,A&rsid=2247217581372762829704&orig=MDYS";
                        //http://www.linkedin.com/vsearch/p?lastName=" + lastName + "&postalCode=" + postalCode + "&openAdvancedForm=true&locationType=I&countryCode=" + countrycode + "&distance=" + distance + "&facet_I=" + industrycode + "&sortBy=R&rsid=" + rsid + "&orig=MDYS";

                        try
                        {
                            FirstGetRequestUrl = "http://www.linkedin.com/vsearch/p?lastName=" + lastName + "&postalCode=" + postalCode + "&openAdvancedForm=true&locationType=I&countryCode=" + countrycode + "&distance=" + distance + "&f_I=" + industrycode.Replace(" ", "") + "&rsid=" + rsid + "&orig=ADVS";
                            FirstGetResponse   = HttpHelper.getHtmlfromUrl1(new Uri(FirstGetRequestUrl));
                        }
                        catch { }
                    }


                    RecordCount = objIndustry.GetPageNo(FirstGetResponse);

                    Loger("[ " + DateTime.Now + " ] => [ Get RecordCount : " + RecordCount + " Using UserName : "******" Postal Code : " + postalCode.ToString() + " Distance : " + distance + " Industry : " + industrycode + " ]");
                }
                catch { }
                try
                {
                    LinkedinScrappDbManager objLsManager = new LinkedinScrappDbManager();
                    objLsManager.InsertScarppRecordData(Postalcode, distance, industryType, lastName, RecordCount);
                }
                catch { }
                try
                {
                    string prxyadress = string.Empty;
                    try
                    {
                        if (!string.IsNullOrEmpty(proxyAddress) && !string.IsNullOrEmpty(proxyPort))
                        {
                            prxyadress = proxyAddress + ":" + proxyPort;
                        }
                    }
                    catch { }

                    string CSVHeader   = "PostalCode" + "," + "Distance" + "," + "IndustryType" + "," + "LastName" + "," + "UserName" + "," + "Password" + "," + "Proxy" + "," + "ProxyPwd " + "," + "Number Of Result";                                                                                                                                                                      // + "," + "Connection" + "," + "Recommendations " + "," + "SkillAndExpertise " + "," + "Experience " + "," + " Education" + "," + "Groups" + "," + "UserEmail" + "," + "UserContactNumber" + "," + "PastTitles" + "," + "PastCompany" + "," + "Location" + "," + "Country" + "," + "Industry" + "," + "WebSites" + "," + "LinkedinLogInID" + ",";
                    string CSV_Content = postalCode.Replace(",", ";") + "," + distance.Replace(",", ";") + "," + industryType.Replace(",", ";") + "," + lastName.Replace(",", ";") + "," + accountUser.Replace(",", ";") + "," + accountPass.Replace(",", ";") + "," + prxyadress.Replace(",", ";") + "," + proxyPassword.Replace(",", ";") + "," + RecordCount.ToString().Replace(",", ";"); //+ "," + Connection.Replace(",", ";") + "," + recomandation.Replace(",", string.Empty) + "," + Skill.Replace(",", ";") + "," + LDS_Experience.Replace(",", string.Empty) + "," + EducationCollection.Replace(",", ";") + "," + groupscollectin.Replace(",", ";") + "," + USERemail.Replace(",", ";") + "," + LDS_UserContact.Replace(",", ";") + "," + LDS_PastTitles + "," + AllComapny.Replace(",", ";") + "," + country.Replace(",", ";") + "," + location.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + Website.Replace(",", ";") + "," + accountUser + ",";// +TypeOfProfile + ",";
                    CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_InBoardProGetDataResultCount);
                }
                catch { }
            }
            catch { }
        }
        public List<string> GetUserFollowing_newComment(string UserName, int NoOfPage, int FollowingCount)
        {
            List<string> TotalFollowerComment = new List<string>();
            try
            {            
                List<string> FollowerComment = new List<string>();
				GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Starting Extraction Of Following For " + UserName + " ]");
                GlobusHttpHelper objglobusHttpHelper = new GlobusHttpHelper();
                for (int i = 1; i <= 1000; i++)
                {
                    try
                    {
                        string FollowerPageSource = string.Empty;

                        if (i == 1)
                        {
                            FollowUrl = "http://pinterest.com/" + UserName + "/following/";
                            FollowerPageSource = objglobusHttpHelper.getHtmlfromUrl(new Uri(FollowUrl), referer, string.Empty, "");
                            referer = FollowUrl;
                        }
                        else
                        {
                            FollowUrl = "https://www.pinterest.com/resource/UserFollowingResource/get/?source_url=%2F" + UserName + "%2Ffollowing%2F&data=%7B%22options%22%3A%7B%22username%22%3A%22" + UserName + "%22%2C%22bookmarks%22%3A%5B%22" + bookmark + "%3D%22%5D%7D%2C%22context%22%3A%7B%7D%7D&module_path=App(module%3D%5Bobject+Object%5D)&_=144204352215" + (i - 1);

                            try
                            {
                                FollowerPageSource = objglobusHttpHelper.getHtmlfromUrlProxy(new Uri(FollowUrl), referer, "", 80, string.Empty, "", "");
                            }
                            catch
                            {
                                FollowerPageSource = objglobusHttpHelper.getHtmlfromUrlProxy(new Uri(FollowUrl), "", Convert.ToInt32(""), "", "");

                            }
                            if (FollowerPageSource.Contains("Whoops! We couldn't find that page."))
                            {
                                break;
                            }
                        }

                        ///Get App Version 
                        if (FollowerPageSource.Contains("app_version") && string.IsNullOrEmpty(AppVersion))
                        {
                            string[] ArrAppVersion = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "app_version");
                            if (ArrAppVersion.Count() > 0)
                            {
                                string DataString = ArrAppVersion[ArrAppVersion.Count() - 1];

                                int startindex = DataString.IndexOf("\": \"");
                                int endindex = DataString.IndexOf("\", \"");

                                AppVersion = DataString.Substring(startindex, endindex - startindex).Replace("\": \"", "");
                            }
                        }

                        ///get bookmarks value from page 
                        ///
                        if (FollowerPageSource.Contains("bookmarks"))
                        {
                            string[] bookmarksDataArr = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "bookmarks");

                            string Datavalue = string.Empty;
                            if (bookmarksDataArr.Count() > 2)
                                Datavalue = bookmarksDataArr[bookmarksDataArr.Count() - 2];
                            else
                                Datavalue = bookmarksDataArr[bookmarksDataArr.Count() - 1];

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


                        try
                        {
                            if (!FollowerPageSource.Contains("No one has followed"))
                            {
                                List<string> lst = objGlobusRegex.GetHrefUrlTags(FollowerPageSource);
                                if (lst.Count == 0)
                                {
                                    lst = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "href").ToList();
                                    if (lst.Count() == 1)
                                    {
                                        lst = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "\"username\":").ToList();
                                    }
                                }
                                foreach (string item in lst)
                                {
                                    if (item.Contains("class=\"userWrapper") || item.Contains("class=\\\"userWrapper"))
                                    {
                                        try
                                        {
                                            if (item.Contains("\\"))
                                            {
                                                int FirstPinPoint = item.IndexOf("=\\\"/");
                                                int SecondPinPoint = item.IndexOf("/\\\"");
                                                User = item.Substring(FirstPinPoint, SecondPinPoint - FirstPinPoint).Replace("\"", string.Empty).Replace("\\", string.Empty).Replace("=", string.Empty).Replace("/", string.Empty).Trim();
                                            }
                                            else
                                            {
                                                int FirstPinPoint = item.IndexOf("href=");
                                                int SecondPinPoint = item.IndexOf("class=");

                                                User = item.Substring(FirstPinPoint, SecondPinPoint - FirstPinPoint).Replace("\"", string.Empty).Replace("href=", string.Empty).Replace("/", string.Empty).Trim();
                                            }

                                            FollowerComment.Add(User);
                                        
                                            //GlobusLogHelper.log.Info(" => [ " + User + " ]");                                           
                                            if (FollowerComment.Count == FollowingCount)
                                            {
                                                break;
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusLogHelper.log.Error(" Error : " + ex.StackTrace);
                                        }
                                    }
                                    if (i > 1)
                                    {
                                        if (item.Contains("\"request_identifier\":"))
                                        {
                                            continue;
                                        }
                                        else
                                        {
                                            try
                                            {
                                                User = Utils.Utils.getBetween(item, "\"", "\"");
                                                if (User == UserName)
                                                {
                                                    break;
                                                }
                                                FollowerComment.Add(User);
                                              
                                                //GlobusLogHelper.log.Info(" => [ " + User + " ]");

                                                if (FollowerComment.Count == FollowingCount)
                                                {
                                                    break;
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusLogHelper.log.Error(" Error : " + ex.StackTrace);
                                            }
                                        }
                                    }
                                }


                                FollowerComment = FollowerComment.Distinct().ToList();
                                foreach (string lstdata in FollowerComment)
                                {
                                    TotalFollowerComment.Add(lstdata);

                                }
                                TotalFollowerComment = TotalFollowerComment.Distinct().ToList();
                                //if (TotalFollowerComment.Count == MaxComment)
                                //{
                                //    break;
                                //}
                                Thread.Sleep(1000);
                            }
                            else
                            {
								GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ No following ]");
                                break;
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                        }
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                        break;

                    }
                }

                //GlobusLogHelper.log.Info(" => [ Finished Extracting following For " + UserName + " ]");
                //GlobusLogHelper.log.Info(" => [ Process Completed Please. Now you can export file ]");
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
            }

			GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Total Followings : " + TotalFollowerComment.Count + " ]");

            return TotalFollowerComment;
        }
Пример #46
0
        private void btnStart_Searching_Click(object sender, EventArgs e)
        {
            AllOfTheseWords      = (txtAllofTheseKeywords.Text).ToString();
            ThisExtractPhrase    = (txtThisExactPhrase.Text).ToString();
            AnyOfTheseWords      = (txtAnyOfTheseWords.Text).ToString();
            TheseHashTags        = (txtTheseHashTags.Text).ToString();
            NoneOfTheseWords     = (txtNoneofTheseWords.Text).ToString();
            FromTheseAccounts    = (txtFromTheseAccounts.Text).ToString();
            ToTheseAccounts      = (txtToTheseAccounts.Text).ToString();
            MentionTheseAccounts = (txtMentioningTheseAccounts.Text).ToString();
            NearThisPlace        = (txtNearThisPlace.Text).ToString();


            AddToLog_AdvancedSearch("[ " + DateTime.Now + " ] => Process Started");

            try
            {
                if (string.IsNullOrEmpty(ThisExtractPhrase))
                {
                    ThisExtractPhrase = "";
                }
                else
                {
                    ThisExtractPhrase = "%20%22" + ThisExtractPhrase;
                }
            }
            catch { }

            try
            {
                if (string.IsNullOrEmpty(AnyOfTheseWords))
                {
                    AnyOfTheseWords = "";
                }
                else
                {
                    AnyOfTheseWords = "%22%20" + AnyOfTheseWords;
                }
            }
            catch
            { }


            try
            {
                if (string.IsNullOrEmpty(TheseHashTags))
                {
                    TheseHashTags = "";
                }
                else
                {
                    TheseHashTags = "%20%23" + TheseHashTags;
                }
            }
            catch
            { }


            try
            {
                if (string.IsNullOrEmpty(NoneOfTheseWords))
                {
                    NoneOfTheseWords = "";
                }
                else
                {
                    NoneOfTheseWords = "%20-" + NoneOfTheseWords;
                }
            }
            catch
            { }


            try
            {
                if (string.IsNullOrEmpty(FromTheseAccounts))
                {
                    FromTheseAccounts = "";
                }
                else
                {
                    FromTheseAccounts = "%20from%3A" + FromTheseAccounts;
                }
            }
            catch
            { }


            try
            {
                if (string.IsNullOrEmpty(ToTheseAccounts))
                {
                    ToTheseAccounts = "";
                }
                else
                {
                    ToTheseAccounts = "%20to%3A" + ToTheseAccounts;
                }
            }
            catch
            { }


            try
            {
                if (string.IsNullOrEmpty(MentionTheseAccounts))
                {
                    MentionTheseAccounts = "";
                }
                else
                {
                    MentionTheseAccounts = "%20%40" + MentionTheseAccounts;
                }
            }
            catch
            { }

            try
            {
                if (string.IsNullOrEmpty(NearThisPlace))
                {
                    NearThisPlace = "";
                }
                else
                {
                    NearThisPlace = "%20near%3A%22" + NearThisPlace;
                }
            }
            catch
            { }



            try
            {
                if (!string.IsNullOrEmpty(txtAllofTheseKeywords.Text))
                {
                    #region Commented
                    //try
                    //{
                    //    string Url = "https://twitter.com/search?f=realtime&q=" + AllOfTheseWords + ThisExtractPhrase + AnyOfTheseWords + NoneOfTheseWords + TheseHashTags + _selectedLanguage + FromTheseAccounts + ToTheseAccounts + MentionTheseAccounts + NearThisPlace + "%22%20within%3A15mi&src=typd";
                    //    string response = _GlobusHttpHelper.getHtmlfromUrl(new Uri(Url), "", "");
                    //}
                    //catch { } public List<StructTweetIDs> NewKeywordStructDataForSearchByKeyword(string keyword)
                    #endregion
                    {
                        try
                        {
                            BaseLib.GlobusRegex regx = new GlobusRegex();

                            int    counter           = 0;
                            string res_Get_searchURL = string.Empty;
                            string searchURL         = string.Empty;
                            string maxid             = string.Empty;
                            string TweetId           = string.Empty;
                            string text = string.Empty;

                            string ProfileName = string.Empty;
                            string Location    = string.Empty;
                            string Bio         = string.Empty;
                            string website     = string.Empty;
                            string NoOfTweets  = string.Empty;
                            string Followers   = string.Empty;
                            string Followings  = string.Empty;
                            int    noOfRecords = 0;
                            try
                            {
                                noOfRecords = int.Parse(txtNoOfRecords.Text);
                            }
                            catch { }


startAgain:


                            if (counter == 0)
                            {
                                searchURL = "https://twitter.com/i/search/timeline?q=" + AllOfTheseWords + ThisExtractPhrase + AnyOfTheseWords + NoneOfTheseWords + TheseHashTags + _selectedLanguage + FromTheseAccounts + ToTheseAccounts + MentionTheseAccounts + NearThisPlace + "%22%20within%3A15mi&src=typd" + "&f=realtime";
                                counter++;
                            }
                            else
                            {
                                searchURL = "https://twitter.com/i/search/timeline?q=" + AllOfTheseWords + ThisExtractPhrase + AnyOfTheseWords + NoneOfTheseWords + TheseHashTags + _selectedLanguage + FromTheseAccounts + ToTheseAccounts + MentionTheseAccounts + NearThisPlace + "%22%20within%3A15mi&src=typd" + "&f=realtime&include_available_features=1&include_entities=1&last_note_ts=0&oldest_unread_id=0&scroll_cursor=" + TweetId + "";
                            }


                            try
                            {
                                res_Get_searchURL = _GlobusHttpHelper.getHtmlfromUrl(new Uri(searchURL), "", "");
                                AddToLog_AdvancedSearch("[ " + DateTime.Now + " ] => Finding results for entered details ");

                                if (string.IsNullOrEmpty(res_Get_searchURL))
                                {
                                    res_Get_searchURL = _GlobusHttpHelper.getHtmlfromUrl(new Uri(searchURL), "", "");
                                }

                                try
                                {
                                    //string sjss = globushttpHelper.getHtmlfromUrl(new Uri(searchURL), "", "");
                                    string[] splitRes = Regex.Split(res_Get_searchURL, "refresh_cursor");
                                    //splitRes = splitRes.Skip(1).ToArray();
                                    foreach (string item in splitRes)
                                    {
                                        if (item.Contains("refresh_cursor"))
                                        {
                                            int    startIndex = item.IndexOf("TWEET-");
                                            string start      = item.Substring(startIndex).Replace("data-user-id=\\\"", "");
                                            int    endIndex   = start.IndexOf("\"");
                                            string end        = start.Substring(0, endIndex).Replace("id_str", "").Replace("\"", "").Replace(":", "").Replace("{", "").Replace("}", "").Replace("]", "");
                                            TweetId = end;
                                        }
                                        if (item.Contains("scroll_cursor"))
                                        {
                                            int    startIndex = item.IndexOf("TWEET-");
                                            string start      = item.Substring(startIndex).Replace("data-user-id=\\\"", "");
                                            int    endIndex   = start.IndexOf("\"");
                                            string end        = start.Substring(0, endIndex).Replace("id_str", "").Replace("\"", "").Replace(":", "").Replace("{", "").Replace("}", "").Replace("]", "");
                                            TweetId = end;
                                        }
                                    }
                                }
                                catch (Exception)
                                {
                                }
                            }

                            catch (Exception ex)
                            {
                                System.Threading.Thread.Sleep(2000);
                                res_Get_searchURL = _GlobusHttpHelper.getHtmlfromUrl(new Uri(searchURL), "", "");
                            }
                            // && !res_Get_searchURL.Contains("has_more_items\":false")
                            if (!string.IsNullOrEmpty(res_Get_searchURL))
                            {
                                //string[] splitRes = Regex.Split(res_Get_searchURL, "data-item-id"); //Regex.Split(res_Get_searchURL, "\"in_reply_to_status_id_str\"");
                                string[] splitRes = Regex.Split(res_Get_searchURL, "data-item-id");

                                splitRes = splitRes.Skip(1).ToArray();


                                foreach (string item in splitRes)
                                {
                                    if (item.Contains("data-screen-name=") && !item.Contains("js-actionable-user js-profile-popup-actionable"))
                                    {
                                        //var avc = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(res_Get_searchURL);
                                        //string DataHtml = (string)avc["items_html"];
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                    string modified_Item = "\"from_user\"" + item;

                                    string id = "";
                                    try
                                    {
                                        int    startIndex = item.IndexOf("data-user-id=");
                                        string start      = item.Substring(startIndex).Replace("data-user-id=\\\"", "");
                                        int    endIndex   = start.IndexOf("\\\"");
                                        string end        = start.Substring(0, endIndex).Replace("id_str", "").Replace("\"", "").Replace(":", "").Replace("{", "").Replace("}", "").Replace("]", "");
                                        id = end;
                                        //lst_structTweetIDs.Add(id);
                                        AddToLog_AdvancedSearch("[ " + DateTime.Now + " ] => User Id " + id);
                                    }
                                    catch (Exception ex)
                                    {
                                        id = "null";
                                        //Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetPhotoFromUsername() -- id -- " + keyword + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                                    }

                                    string from_user_id = "";
                                    try
                                    {
                                        int    startIndex = item.IndexOf("data-screen-name=\\\"");
                                        string start      = item.Substring(startIndex).Replace("data-screen-name=\\\"", "");
                                        int    endIndex   = start.IndexOf("\\\"");
                                        string end        = start.Substring(0, endIndex).Replace("from_user_id\":", "").Replace("\"", "").Replace(":", "").Replace("{", "").Replace("_str", "").Replace("user", "").Replace("}", "").Replace("]", "");
                                        from_user_id = end;
                                        AddToLog_AdvancedSearch("[ " + DateTime.Now + " ] => User ScreenName " + from_user_id);
                                    }
                                    catch (Exception ex)
                                    {
                                        from_user_id = "null";
                                        // Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetPhotoFromUsername() -- " + keyword + " -- from_user_id --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                                    }

                                    string tweetUserid = string.Empty;
                                    try
                                    {
                                        int    startIndex = item.IndexOf("=\\\"");
                                        string start      = item.Substring(startIndex).Replace("=\\\"", "");
                                        int    endIndex   = start.IndexOf("\\\"");
                                        string end        = start.Substring(0, endIndex).Replace("from_user_id\":", "").Replace("\"", "").Replace(":", "").Replace("{", "").Replace("_str", "").Replace("user", "").Replace("}", "").Replace("]", "");
                                        tweetUserid = end;
                                        AddToLog_AdvancedSearch("[ " + DateTime.Now + " ] => Tweet Id " + tweetUserid);
                                    }
                                    catch (Exception ex)
                                    {
                                        from_user_id = "null";
                                    }

                                    ///Tweet Text
                                    #region Commented
                                    //try
                                    //{


                                    //    int startindex = item.IndexOf("js-tweet-text tweet-text\"");
                                    //    if (startindex == -1)
                                    //    {
                                    //        startindex = 0;
                                    //        startindex = item.IndexOf("js-tweet-text tweet-text");
                                    //    }

                                    //    string start = item.Substring(startindex).Replace("js-tweet-text tweet-text\"", "").Replace("js-tweet-text tweet-text tweet-text-rtl\"", "");
                                    //    int endindex = start.IndexOf("</p>");

                                    //    if (endindex == -1)
                                    //    {
                                    //        endindex = 0;
                                    //        endindex = start.IndexOf("stream-item-footer");
                                    //    }

                                    //    string end = start.Substring(0, endindex);
                                    //    end = regx.StripTagsRegex(end);
                                    //    text = end.Replace("&nbsp;", "").Replace("a href=", "").Replace("/a", "").Replace("<span", "").Replace("</span", "").Replace("class=\\\"js-display-url\\\"", "").Replace("class=\\\"tco-ellipsis\\\"", "").Replace("class=\\\"invisible\\\"", "").Replace("<strong>", "").Replace("target=\\\"_blank\\\"", "").Replace("class=\\\"twitter-timeline-link\\\"", "").Replace("</strong>", "").Replace("rel=\\\"nofollow\\\" dir=\\\"ltr\\\" data-expanded-url=", "");
                                    //    text = text.Replace("&quot;", "").Replace("<", "").Replace(">", "").Replace("\"", "").Replace("\\", "").Replace("title=", "");

                                    //    string[] array = Regex.Split(text, "http");
                                    //    text = string.Empty;
                                    //    foreach (string itemData in array)
                                    //    {
                                    //        if (!itemData.Contains("t.co"))
                                    //        {
                                    //            string data = string.Empty;
                                    //            if (itemData.Contains("//"))
                                    //            {
                                    //                data = ("http" + itemData).Replace(" span ", string.Empty);
                                    //                if (!text.Contains(itemData.Replace(" ", "")))// && !data.Contains("class") && !text.Contains(data))
                                    //                {
                                    //                    text += data.Replace("u003c", string.Empty).Replace("u003e", string.Empty);
                                    //                }
                                    //            }
                                    //            else
                                    //            {
                                    //                if (!text.Contains(itemData.Replace(" ", "")))
                                    //                {
                                    //                    text += itemData.Replace("u003c", string.Empty).Replace("u003e", string.Empty).Replace("js-tweet-text tweet-text", "");
                                    //                }
                                    //            }
                                    //        }
                                    //    }
                                    //}
                                    //catch { };

                                    #endregion


                                    twtboardpro.TwitterDataScrapper.StructTweetIDs structTweetIDs = new twtboardpro.TwitterDataScrapper.StructTweetIDs();

                                    if (id != "null")
                                    {
                                        structTweetIDs.ID_Tweet             = tweetUserid;
                                        structTweetIDs.ID_Tweet_User        = id;
                                        structTweetIDs.username__Tweet_User = from_user_id;
                                        structTweetIDs.wholeTweetMessage    = text;
                                        lst_structTweetIDs.Add(structTweetIDs);
                                    }


                                    //if (!File.Exists(Globals.Path_KeywordScrapedListData + "-" + keyword + ".csv"))
                                    //{
                                    //    GlobusFileHelper.AppendStringToTextfileNewLine("USERID , USERNAME , PROFILE NAME , BIO , LOCATION , WEBSITE , NO OF TWEETS , FOLLOWERS , FOLLOWINGS", Globals.Path_KeywordScrapedListData + "-" + keyword + ".csv");
                                    //}

                                    {
                                        ChilkatHttpHelpr objChilkat        = new ChilkatHttpHelpr();
                                        GlobusHttpHelper HttpHelper        = new GlobusHttpHelper();
                                        string           ProfilePageSource = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/" + from_user_id), "", "");

                                        string Responce = ProfilePageSource;

                                        #region Convert HTML to XML

                                        string      xHtml = objChilkat.ConvertHtmlToXml(Responce);
                                        Chilkat.Xml xml   = new Chilkat.Xml();
                                        xml.LoadXml(xHtml);

                                        Chilkat.Xml xNode             = default(Chilkat.Xml);
                                        Chilkat.Xml xBeginSearchAfter = default(Chilkat.Xml);
                                        #endregion

                                        int counterdata = 0;
                                        xBeginSearchAfter = null;
                                        string dataDescription = string.Empty;
                                        xNode = xml.SearchForAttribute(xBeginSearchAfter, "h1", "class", "ProfileHeaderCard-name");
                                        while ((xNode != null))
                                        {
                                            xBeginSearchAfter = xNode;
                                            if (counterdata == 0)
                                            {
                                                ProfileName = xNode.AccumulateTagContent("text", "script|style");
                                                counterdata++;
                                            }
                                            else if (counterdata == 1)
                                            {
                                                website = xNode.AccumulateTagContent("text", "script|style");
                                                counterdata++;
                                            }
                                            else
                                            {
                                                break;
                                            }

                                            xNode = xml.SearchForAttribute(xBeginSearchAfter, "a", "class", "u-textUserColor");
                                        }

                                        xBeginSearchAfter = null;
                                        dataDescription   = string.Empty;
                                        xNode             = xml.SearchForAttribute(xBeginSearchAfter, "p", "class", "ProfileHeaderCard-bio u-dir");//bio profile-field");
                                        while ((xNode != null))
                                        {
                                            xBeginSearchAfter = xNode;
                                            Bio = xNode.AccumulateTagContent("text", "script|style").Replace("&#39;", "'").Replace("&#13;&#10;", string.Empty).Trim();
                                            break;
                                        }

                                        xBeginSearchAfter = null;
                                        dataDescription   = string.Empty;
                                        xNode             = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "ProfileHeaderCard-locationText u-dir");//location profile-field");
                                        while ((xNode != null))
                                        {
                                            xBeginSearchAfter = xNode;
                                            Location          = xNode.AccumulateTagContent("text", "script|style");
                                            break;
                                        }

                                        int counterData = 0;
                                        xBeginSearchAfter = null;
                                        dataDescription   = string.Empty;
                                        xNode             = xml.SearchForAttribute(xBeginSearchAfter, "a", "class", "ProfileNav-stat ProfileNav-stat--link u-borderUserColor u-textCenter js-tooltip js-nav");//location profile-field");
                                        while ((xNode != null))
                                        {
                                            xBeginSearchAfter = xNode;
                                            if (counterData == 0)
                                            {
                                                // NoOfTweets = xml.SearchForAttribute(xBeginSearchAfter, "span", "class", "ProfileNav-value");
                                                NoOfTweets = xNode.AccumulateTagContent("text", "script|style").Replace("Tweets", string.Empty).Replace(",", string.Empty).Replace("Tweet", string.Empty);
                                                counterData++;
                                            }
                                            else if (counterData == 1)
                                            {
                                                Followings = xNode.AccumulateTagContent("text", "script|style").Replace(" Following", string.Empty).Replace(",", string.Empty).Replace("Following", string.Empty);
                                                counterData++;
                                            }
                                            else if (counterData == 2)
                                            {
                                                Followers = xNode.AccumulateTagContent("text", "script|style").Replace("Followers", string.Empty).Replace(",", string.Empty).Replace("Follower", string.Empty);
                                                counterData++;
                                            }
                                            else
                                            {
                                                break;
                                            }
                                            //xNode = xml.SearchForAttribute(xBeginSearchAfter, "a", "class", "js-nav");
                                            xNode = xml.SearchForAttribute(xBeginSearchAfter, "a", "class", "ProfileNav-stat ProfileNav-stat--link u-borderUserColor u-textCenter js-tooltip js-openSignupDialog js-nonNavigable u-textUserColor");
                                        }


                                        if (!string.IsNullOrEmpty(from_user_id) && tweetUserid != "null")
                                        {
                                            string Id_user = tweetUserid.Replace("}]", string.Empty).Trim();
                                            Globals.lstScrapedUserIDs.Add(Id_user);
                                            // GlobusFileHelper.AppendStringToTextfileNewLine(id + "," + from_user_id + "," + ProfileName + "," + Bio.Replace(",", "") + "," + Location.Replace(",", "") + "," + website + "," + NoOfTweets.Replace(",", "").Replace("Tweets", "") + "," + Followers.Replace(",", "").Replace("Following", "") + "," + Followings.Replace(",", "").Replace("Followers", "").Replace("Follower", ""), Globals.Path_KeywordScrapedListData + "-" + keyword + ".csv");
                                            // Log("[ " + DateTime.Now + " ] => [ " + from_user_id + "," + Id_user + "," + ProfileName + "," + Bio.Replace(",", "") + "," + Location + "," + website + "," + NoOfTweets + "," + Followers + "," + Followings + " ]");
                                        }
                                    }



                                    lst_structTweetIDs = lst_structTweetIDs.Distinct().ToList();

                                    if (lst_structTweetIDs.Count >= noOfRecords)
                                    {
                                        // return lst_structTweetIDs;
                                    }
                                }

                                if (lst_structTweetIDs.Count <= noOfRecords)
                                {
                                    maxid = lst_structTweetIDs[lst_structTweetIDs.Count - 1].ID_Tweet;

                                    if (res_Get_searchURL.Contains("has_moreitems\":false"))
                                    {
                                    }
                                    else
                                    {
                                        goto startAgain;
                                    }
                                }
                                else
                                {
                                    if (res_Get_searchURL.Contains("has_more_items\":false"))
                                    {
                                    }
                                    else
                                    {
                                        goto startAgain;
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                }
            }


            catch
            { }
        }
Пример #47
0
        private void ThreadPoolMethod(object parameters)
        {
            try
            {
                //string email = (string)parameters;

                Array paramsArray = new object[2];
                paramsArray = (Array)parameters;

                string email = (string)paramsArray.GetValue(0);

                int count_Names = (int)paramsArray.GetValue(1);

                GlobusHttpHelper HttpHelper = new GlobusHttpHelper();

                string post_form_id = string.Empty;
                string lsd = string.Empty;
                string reg_instance = string.Empty;
                string firstname = string.Empty;
                string lastname = string.Empty;
                string reg_email__ = string.Empty;
                string reg_email_confirmation__ = string.Empty;
                string reg_passwd__ = string.Empty;
                string sex = string.Empty;
                string birthday_month = string.Empty;
                string birthday_day = string.Empty;
                string birthday_year = string.Empty;
                string captcha_persist_data = string.Empty;
                string captcha_session = string.Empty;
                string extra_challenge_params = string.Empty;
                string recaptcha_public_key = string.Empty;
                string authp_pisg_nonce_tt = null;
                string authp = string.Empty;
                string psig = string.Empty;
                string nonce = string.Empty;
                string tt = string.Empty;
                string time = string.Empty;
                string challenge = string.Empty;
                string CaptchaSummit = string.Empty;

                string Email = string.Empty;
                string Password = string.Empty;

                string proxyAddress = string.Empty;
                string proxyPort = string.Empty;
                string proxyUsername = string.Empty;
                string proxyPassword = string.Empty;

                try
                {
                    Email = email.Split(':')[0];
                    Password = email.Split(':')[1];

                    firstname = listFirstName[count_Names];
                    lastname = listLastName[count_Names];
                }
                catch (Exception ex){ AddToListBox(ex.Message); }

                AddToListBox("Creating Account with " + Email);

                string responseMessage = string.Empty;
                string captchaSrcMulti = string.Empty;

                #region Commented
                // captchaSrcMulti = GetCaptchaImageMulti(email, ref HttpHelper, ref post_form_id, ref lsd,
                //ref reg_instance,
                //ref firstname,
                //ref lastname,
                //ref reg_email__,
                //ref reg_email_confirmation__,
                //ref reg_passwd__,
                //ref sex,
                //ref birthday_month,
                //ref birthday_day,
                //ref birthday_year,
                //ref captcha_persist_data,
                //ref captcha_session,
                //ref extra_challenge_params,
                //ref recaptcha_public_key,
                //ref authp_pisg_nonce_tt,
                //ref authp,
                //ref psig,
                //ref nonce,
                //ref tt,
                //ref time,
                //ref challenge,
                //ref CaptchaSummit);

                // if (email.Split(':').Length > 5)
                // {
                //     proxyAddress = email.Split(':')[2];
                //     proxyPort = email.Split(':')[3];
                //     proxyUsername = email.Split(':')[4];
                //     proxyPassword = email.Split(':')[5];
                //     //AddToListBox("Setting proxy " + proxyAddress + ":" + proxyPort);
                // }
                // else if (email.Split(':').Length == 4)
                // {
                //     //MessageBox.Show("Private proxies not loaded with emails \n Accounts will be created with public proxies");
                //     proxyAddress = email.Split(':')[2];
                //     proxyPort = email.Split(':')[3];
                // } 
                #endregion

                 GetCaptchaImageMultiModified(email, ref HttpHelper, ref post_form_id, ref lsd,
               ref reg_instance,
               ref firstname,
               ref lastname,
               ref reg_email__,
               ref reg_email_confirmation__,
               ref reg_passwd__,
               ref sex,
               ref birthday_month,
               ref birthday_day,
               ref birthday_year,
               ref captcha_persist_data,
               ref captcha_session,
               ref extra_challenge_params,
               ref recaptcha_public_key,
               ref authp_pisg_nonce_tt,
               ref authp,
               ref psig,
               ref nonce,
               ref tt,
               ref time,
               ref challenge,
               ref CaptchaSummit);

                 if (email.Split(':').Length > 5)
                 {
                     proxyAddress = email.Split(':')[2];
                     proxyPort = email.Split(':')[3];
                     proxyUsername = email.Split(':')[4];
                     proxyPassword = email.Split(':')[5];
                     //AddToListBox("Setting proxy " + proxyAddress + ":" + proxyPort);
                 }
                 else if (email.Split(':').Length == 4)
                 {
                     //MessageBox.Show("Private proxies not loaded with emails \n Accounts will be created with public proxies");
                     proxyAddress = email.Split(':')[2];
                     proxyPort = email.Split(':')[3];
                 }

                //if (!string.IsNullOrEmpty(captchaSrcMulti))
                //{
                    #region Old Captcha Method
                 //   if (UseDBC)
                 //   {
                 //       System.Net.WebClient webClient = new System.Net.WebClient();
                 //       byte[] imageBytes = webClient.DownloadData(captchaSrcMulti);

                 //       //Getting Captcha Text
                 //       string captchaText = DecodeDBC(new string[] { Globals.DBCUsername, Globals.DBCPassword, "" }, imageBytes);

                 //       if (!string.IsNullOrEmpty(captchaText))
                 //       {
                 //           SummitCaptchaMulti(captchaText, ref HttpHelper, post_form_id, lsd,
                 //reg_instance,
                 //firstname,
                 //lastname,
                 //reg_email__,
                 //reg_email_confirmation__,
                 //reg_passwd__,
                 //sex,
                 //birthday_month,
                 //birthday_day,
                 //birthday_year,
                 //captcha_persist_data,
                 //captcha_session,
                 //extra_challenge_params,
                 //recaptcha_public_key,
                 //authp_pisg_nonce_tt = null,
                 //authp,
                 //psig,
                 //nonce,
                 //tt,
                 //time,
                 //challenge,
                 //CaptchaSummit);
                 //       }
                 //       else
                 //       {
                 //           AddToListBox("Captcha text NULL for : " + Email);
                 //       }

                 //   }
                 //   else if (UseDeCaptcher)
                 //   {
                 //       DownloadImageViaWebClient(captchaSrcMulti, Email.Split('@')[0]);
                 //       System.Threading.Thread.Sleep(15000);

                 //       //Getting Captcha Text using Decaptcher
                 //       string Captchatext = decaptcha(decaptchaImagePath + "\\decaptcha" + Email.Split('@')[0]);

                 //       try
                 //       {
                 //           File.Delete(decaptchaImagePath + "\\decaptcha" + Email.Split('@')[0]);
                 //       }
                 //       catch (Exception) { }


                 //       if (!string.IsNullOrEmpty(Captchatext))
                 //       {
                 //           SummitCaptchaMulti(Captchatext, ref HttpHelper, post_form_id, lsd,
                 //reg_instance,
                 //firstname,
                 //lastname,
                 //reg_email__,
                 //reg_email_confirmation__,
                 //reg_passwd__,
                 //sex,
                 //birthday_month,
                 //birthday_day,
                 //birthday_year,
                 //captcha_persist_data,
                 //captcha_session,
                 //extra_challenge_params,
                 //recaptcha_public_key,
                 //authp_pisg_nonce_tt = null,
                 //authp,
                 //psig,
                 //nonce,
                 //tt,
                 //time,
                 //challenge,
                 //CaptchaSummit);
                 //       }
                 //       else
                 //       {
                 //           AddToListBox("Captcha text NULL for : " + Email);
                 //       }
                 //   } 
                    #endregion

                    //string url_Registration = "https://www.facebook.com/ajax/register.php?__a=5&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&asked_to_login=0&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&recaptcha_challenge_field=" + challenge + "&captcha_response=" + "" + "&ignore=captcha|pc&__user=0";
                 string url_Registration = "https://www.facebook.com/ajax/register.php?__a=4&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&asked_to_login=0&ab_test_data=AAAAAAAAAAAA%2FA%2FAAAAA%2FAAAAAAAAAAAAAAAAAAAA%2FAA%2FfAAfABAAD&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";

                    string res_Registration = HttpHelper.getHtmlfromUrl(new Uri(url_Registration));

                    //reg_passwd__ = Uri.UnescapeDataString(reg_passwd__);

                    FinishRegistrationMultiThreaded(res_Registration, Email, Password, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref HttpHelper);
                //}
            }
            catch (Exception ex)
            {
                AddToListBox(ex.Message);
            }
        }
        public void Pagination(ref GlobusHttpHelper objHttpHelper, string mainUrl)
        {
            int PageCunt = 1;
            try
            {
                string totalResults = string.Empty;
                bool dispTotalResults = true;
                string mainPageResponse = string.Empty;
                int paginationCounter = 0;
                do
                {
                    //mainUrl = mainUrl.Replace("replaceVariableCounter", paginationCounter.ToString());

                    //if (SalesNavigatorGlobals.isStop)
                    //{
                    //    return;
                    //}

                    ///string hoMEuRL = "https://www.linkedin.com/sales/search/?facet=N&facet.N=O&facet=G&facet.G=in:7350&facet=I&facet.I=96&facet=FA&facet.FA=12&defaultSelection=false&start=0&count=10&searchHistoryId=1540160093&keywords=ITIL&trk=lss-search-tab";
                    // string Url = mainUrl.Replace("replaceVariableCounter", paginationCounter.ToString());
                    mainPageResponse = objHttpHelper.getHtmlfromUrl(new Uri(mainUrl));
                    if (string.IsNullOrEmpty(mainPageResponse))
                    {
                        mainPageResponse = objHttpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/sales/?trk=nav_responsive_sub_nav_upgrade"));
                        mainPageResponse = objHttpHelper.getHtmlfromUrl(new Uri(mainUrl));
                    }

                    //if (mainPageResponse.Contains("We'll be back soon.")&&(mainPageResponse.Contains("We're getting things cleaned up.")))
                    //{
                    //    string unwatedStr = "https://www.linkedin.com/sales/search/?facet=N&facet.N=O&facet=G&facet.G=in:7350&facet=I&facet.I=96&facet=FA&facet.FA=12&defaultSelection=false&start=0&count=10&searchHistoryId=1540160093&keywords="+""+"&trk=lss-search-tab";// "&countryCode=" + Utils.getBetween(mainUrl, "&countryCode=", "&");
                    //    mainPageResponse = objHttpHelper.getHtmlfromUrl(new Uri(mainUrl.Replace(unwatedStr, paginationCounter.ToString())));
                    //}


                    if (string.IsNullOrEmpty(mainPageResponse))
                    {
                        if (string.IsNullOrEmpty(mainPageResponse))
                        {
                            //MessageBox.Show("Null response from internet. Please check your internet connection and restart the software.");
                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ No response from internet. Please check your internet connection. ] ");
                        }
                        Thread.Sleep(2000);
                        mainPageResponse = objHttpHelper.getHtmlfromUrl(new Uri(mainUrl.Replace("replaceVariableCounter", paginationCounter.ToString())));

                    }
                    try
                    {
                        if (dispTotalResults)
                        {
                            totalResults = Utils.getBetween(mainPageResponse, "\"total\":", ",\"").Trim();
                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Total results found : " + totalResults + " ]");
                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Scraping profile Url ]");
                            dispTotalResults = false;
                        }
                    }
                    catch
                    { }
                    int checkCountUrls = 0;
                    string[] profileUrl_Split = Regex.Split(mainPageResponse, "\"profileUrl\"");
                    List<string> ProfileList = new List<string>();
                    foreach (string profileUrlItem in profileUrl_Split)
                    {
                        if (!profileUrlItem.Contains("<!DOCTYPE"))
                        {
                            checkCountUrls++;
                            string profileUrl = Utils.getBetween(profileUrlItem, ":\"", "\",\"");
                            lstProfileUrls.Add(profileUrl);
                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Scraped Url : " + profileUrl + " ] ");
                            ProfileList.Add(profileUrl);

                        }
                    }
                    Thread.Sleep(1000);
                    ScrapeProfileDetails(ref objHttpHelper, ProfileList);
                    int startindex = paginationCounter;
                    paginationCounter = paginationCounter + 100;
                    mainUrl = CreatePaginationUrl(mainUrl, startindex, paginationCounter);
                } while (mainPageResponse.Contains("\"profileUrl\":\""));
            }
            catch (Exception ex)
            {
            }
        }
Пример #49
0
        private void FinishRegistrationMultiThreaded(string responseRegistration, string email, string password, string proxyAddress, string proxyPort, string proxyUser, string proxyPassword, ref GlobusHttpHelper HttpHelper)
        {
            if (!string.IsNullOrEmpty(responseRegistration) && responseRegistration.Contains("registration_succeeded"))
            {
                AddToListBox("Registration Succeeded");
                try
                {
                    string res = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/c.php?email=" + email));

                    /// JS, CSS, Image Requests
                    RequestsJSCSSIMG.RequestJSCSSIMG(res, ref HttpHelper);
                }
                catch { };

                VerifiyAccountMultiThreaded(email, password, proxyAddress, proxyPort, proxyUser, proxyPassword, ref HttpHelper);
            }
            //else if (!string.IsNullOrEmpty(responseRegistration) && responseRegistration.Contains("It looks like you already have an account on Facebook"))
            else
            {
                AddToListBox("It looks like you already have an account on Facebook");
                try
                {
                    string res = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/c.php?email=" + email));

                    /// JS, CSS, Image Requests
                    RequestsJSCSSIMG.RequestJSCSSIMG(res, ref HttpHelper);
                }
                catch { };

                VerifiyAccountMultiThreaded(email, password, proxyAddress, proxyPort, proxyUser, proxyPassword, ref HttpHelper);
            }


            #region Old Code
            //else if (!string.IsNullOrEmpty(responseRegistration) && responseRegistration.Contains("The text you entered didn't match the security check"))
            //{
            //    //AddToListBox("The text you entered didn't match the security check. Retrying..");
            //    //accountCounter--;  //Decrement Counter as it'll be incremented in next line => GoToNextAccount()
            //    ////And we don't want to switch the account now
            //    //GoToNextAccount();
            //}
            //else if (!string.IsNullOrEmpty(responseRegistration) && responseRegistration.Contains("You took too much time"))
            //{
            //    //AddToListBox("You took too much time in submitting captcha. Retrying..");
            //    //accountCounter--;  //Decrement Counter as it'll be incremented in next line => GoToNextAccount()
            //    ////And we don't want to switch the account now
            //    //GoToNextAccount();
            //}
            //else if (!string.IsNullOrEmpty(responseRegistration) && responseRegistration.Contains("to an existing account"))
            //{
            //    //AddToListBox("This email is associated to an existing account");
            //    //accountCounter--;  //Decrement Counter as it'll be incremented in next line => GoToNextAccount()
            //    ////And we don't want to switch the account now
            //    //GoToNextAccount();
            //}
            //else
            //{
            //    if (retryCounter <= 2)
            //    {
            //        ////AddToListBox("Error in submitting captcha. Retrying..");
            //        //accountCounter--;  //Decrement Counter as it'll be incremented in next line => GoToNextAccount()
            //        //And we don't want to switch the account now
            //        ////GoToNextAccount();
            //    }
            //    else
            //    {
            //        //retryCounter = 0;  //Reset the retryCounter as we're switching account now
            //        //AddToListBox("Couldn't create account with " + Email + "---Switching to next account");
            //        //GoToNextAccount();
            //    }
            //} 
            #endregion
        }
Пример #50
0
        public bool ValidateCPUID(ref string statusMessage, string servr, ref string username, ref string password, ref string txnID, ref string email, string freeTrialKey, string cpuID)
        {
            //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("UserName: "******" CPUID:" + cpuID, Globals.DesktopFolder + "\\LogLicensingProcess.txt");

            try
            {
                #region Drct
                //string cpuID = FetchMacId();
                //string SelectQuery = "Select * from users where cpuid='" + cpuID + "'";
                //DataSet ds = DataBaseHandler.SelectQuery(SelectQuery, "users");
                //if (ds.Tables[0].Rows.Count == 1)
                //{
                //    string status = ds.Tables[0].Rows[0]["status"].ToString();
                //    if (status.ToLower() == "active")
                //    {
                //        statusMessage = "active";
                //        return true;
                //    }
                //    else if (status.ToLower() == "nonactive")
                //    {
                //        statusMessage = "nonactive";
                //        return false;
                //    }
                //    else if (status.ToLower() == "suspended")
                //    {
                //        statusMessage = "suspended";
                //        return false;
                //    }
                //}

                #endregion

                #region Through php

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

                #region Servr 1
                {
                    string res = string.Empty;

                    string url = "http://" + servr + "/GetUserData.php?cpid=" + cpuID + "";
                    res = HttpHelpr.getHtmlfromUrl(new Uri(url), "", "", "");
                    res = HttpHelpr.getHtmlfromUrl(new Uri(url), "", "", "");

                    if (string.IsNullOrEmpty(res))
                    {
                        System.Threading.Thread.Sleep(1000);
                        res = HttpHelpr.getHtmlfromUrl(new Uri(url), "", "", "");
                    }

                    if (!string.IsNullOrEmpty(res))
                    {
                        string activationstatus = string.Empty;
                        string dateTime         = string.Empty;
                        //string username = string.Empty;
                        //string txnID = string.Empty;

                        string trimmed_response = res.Replace("<pre>", "").Replace("</pre>", "").Trim().ToLower();

                        //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Responce):" + trimmed_response, Globals.DesktopFolder + "\\LogLicensingProcess.txt");

                        string[] array_status = System.Text.RegularExpressions.Regex.Split(trimmed_response, "<:>");

                        try
                        {
                            activationstatus = array_status[0].ToLower();
                            //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Status):" + activationstatus, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                        }
                        catch (Exception ex)
                        {
                            GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message, PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt");
                        }
                        try
                        {
                            dateTime = array_status[1].ToLower();
                            //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(LicenseDate):" + dateTime, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                        }
                        catch (Exception ex)
                        {
                            GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message, PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt");
                        }

                        try
                        {
                            username = array_status[2].ToLower();
                            //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Username):" + username, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                        }
                        catch (Exception ex)
                        {
                            GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message, PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt");
                        }
                        try
                        {
                            password = array_status[3].ToLower();
                            //GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Username):" + username, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                        }
                        catch (Exception ex)
                        {
                            GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message, PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt");
                        }

                        try
                        {
                            txnID = array_status[4].ToLower();
                        }
                        catch (Exception ex)
                        {
                            GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message, PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt");
                        }

                        try
                        {
                            email = array_status[5].ToLower();
                            //GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Username):" + username, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                        }
                        catch (Exception ex)
                        {
                            GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message, PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt");
                        }

                        try
                        {
                            Globals.licType = array_status[6].ToLower();
                        }
                        catch { }

                        if (trimmed_response.ToLower().Contains(freeTrialKey) && ((activationstatus.ToLower() == "active") || (activationstatus.ToLower() == "nonactive")))
                        {
                            //Globals.IsFreeVersion = true ;

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

                            if (activationstatus.ToLower() == "active")
                            {
                                statusMessage = "active";
                                //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Status):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                                //servr = "1";
                                return(true);
                            }
                            else if (activationstatus.ToLower() == "nonactive")
                            {
                                //Update status as Active
                                string url1      = "http://" + servr + "/UpdateStatus.php?cpid=" + cpuID + "&status=" + "Active";
                                string updateRes = HttpHelpr.getHtmlfromUrl(new Uri(url1), "", "", "");
                                if (string.IsNullOrEmpty(updateRes))
                                {
                                    System.Threading.Thread.Sleep(1000);
                                    updateRes = HttpHelpr.getHtmlfromUrl(new Uri(url1), "", "", "");
                                }

                                // BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Your Free Version is Activated):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                                // MessageBox.Show("Your Free Version is Activated");
                                return(true);
                            }
                        }
                        else if (activationstatus.ToLower() == "active")
                        {
                            statusMessage = "active";
                            //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(LicenceStatus2):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                            return(true);
                            // DisableControls();
                        }
                        else if (activationstatus.ToLower() == "nonactive")
                        {
                            statusMessage = "nonactive";
                            //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(LicenceStatus2):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                            // MessageBox.Show("Verification of your txn is under process.\n Please wait for your Transaction to be verified.\n Please Contact To Support Team to activate your license,   Skype Id Is :- Facedominatorsupport");
                            return(false);
                            // DisableControls();
                        }

                        else if (trimmed_response.Contains("trialexpired"))
                        {
                            statusMessage = "trialexpired";
                            //need to know the naviagtion site : LinkedinDominator.com
                            // BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(LicenceStatus2):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                            // MessageBox.Show("Your 3 Days Trial Version has Expired. Please visit our site: http://linkeddominator.com/ to purchase your License");
                            return(false);
                        }
                        else if (trimmed_response.ToLower() == "suspended")
                        {
                            statusMessage = "suspended";
                            //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(LicenceStatus2):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                            return(false);
                        }
                        else if (trimmed_response.Contains("no record found"))
                        {
                            statusMessage = "norecordfound";
                            //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(LicenceStatus2):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                            return(false);
                        }
                        else
                        {
                            statusMessage = "Some Error in Licensing Server";
                            //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(LicenceStatus2):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                            return(false);
                        }
                    }
                    else
                    {
                        statusMessage = "ServerDown";
                        // BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(LicenceStatus2):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                        return(false);
                    }
                }
                #endregion
                #endregion
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                statusMessage = "Error in License Validation";
                Loger("Error in License Validation");
                //MessageBox.Show(ex.StackTrace);
            }
            return(false);
        }
Пример #51
0
        /// <summary>
        /// Returns Captcha Image from Facebook
        /// </summary>
        /// <param name="responseMessage"></param>
        /// <returns></returns>
        public string GetCaptchaImageMulti(string email, ref GlobusHttpHelper HttpHelper, ref string post_form_id, ref string lsd,
           ref string reg_instance,
           ref string firstname,
           ref string lastname,
           ref string reg_email__,
           ref string reg_email_confirmation__,
           ref string reg_passwd__,
           ref string sex,
           ref string birthday_month,
           ref string birthday_day,
           ref string birthday_year,
           ref string captcha_persist_data,
           ref string captcha_session,
           ref string extra_challenge_params,
           ref string recaptcha_public_key,
           ref string authp_pisg_nonce_tt,
           ref string authp,
           ref string psig,
           ref string nonce,
           ref string tt,
           ref string time,
           ref string challenge,
           ref string CaptchaSummit)
        {
            string proxyAddress = string.Empty;
            string proxyPort = string.Empty;
            string proxyUsername = string.Empty;
            string proxyPassword = string.Empty;

            string FirstName = string.Empty;
            string LastName = string.Empty;
            string Email = string.Empty;
            string Password = string.Empty;
            string DOB = string.Empty;

            Email = email.Split(':')[0];
            Password = email.Split(':')[1];

            if (email.Split(':').Length > 5)
            {
                proxyAddress = email.Split(':')[2];
                proxyPort = email.Split(':')[3];
                proxyUsername = email.Split(':')[4];
                proxyPassword = email.Split(':')[5];
                //AddToListBox("Setting proxy " + proxyAddress + ":" + proxyPort);
            }
            else if (email.Split(':').Length == 4)
            {
                //MessageBox.Show("Private proxies not loaded with emails \n Accounts will be created with public proxies");
                proxyAddress = email.Split(':')[2];
                proxyPort = email.Split(':')[3];
            }

            if (listFirstName.Count > 0)
            {
                try
                {
                    FirstName = listFirstName[RandomNumberGenerator.GenerateRandom(0, listFirstName.Count)];
                }
                catch (Exception ex)
                {
                    FirstName = string.Empty;
                }
            }
            if (listLastName.Count > 0)
            {
                try
                {
                    LastName = listLastName[RandomNumberGenerator.GenerateRandom(0, listLastName.Count)];
                }
                catch (Exception ex)
                {
                    LastName = string.Empty;
                }
            }

           


            #region Get Params

            //string post_form_id = string.Empty;
            //string lsd = string.Empty;
            //string reg_instance = string.Empty;
            //string firstname = string.Empty;
            //string lastname = string.Empty;
            //string reg_email__ = string.Empty;
            //string reg_email_confirmation__ = string.Empty;
            //string reg_passwd__ = string.Empty;
            //string sex = string.Empty;
            //string birthday_month = string.Empty;
            //string birthday_day = string.Empty;
            //string birthday_year = string.Empty;
            //string captcha_persist_data = string.Empty;
            //string captcha_session = string.Empty;
            //string extra_challenge_params = string.Empty;
            //string recaptcha_public_key = string.Empty;
            //string authp_pisg_nonce_tt = null;
            //string authp = string.Empty;
            //string psig = string.Empty;
            //string nonce = string.Empty;
            //string tt = string.Empty;
            //string time = string.Empty;
            //string challenge = string.Empty;
            //string CaptchaSummit = string.Empty;

            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");
            //GlobusHttpHelper 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

            ///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");
            } 
             
            #endregion

            //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);
            //Thread.Sleep(RandomNumberGenerator.GenerateRandom(4000, 8000));


            //////////////////////////////*****Gets Captcha URL****////////////////////////////////////////////////
            string pageSourceCaptcha = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/ajax/register.php?__a=4&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;
            }
        }
        public void Pagination(ref GlobusHttpHelper objHttpHelper, string mainUrl)
        {
            int PageCunt = 1;

            try
            {
                string totalResults      = string.Empty;
                bool   dispTotalResults  = true;
                string mainPageResponse  = string.Empty;
                int    paginationCounter = 0;
                do
                {
                    //mainUrl = mainUrl.Replace("replaceVariableCounter", paginationCounter.ToString());

                    //if (SalesNavigatorGlobals.isStop)
                    //{
                    //    return;
                    //}

                    ///string hoMEuRL = "https://www.linkedin.com/sales/search/?facet=N&facet.N=O&facet=G&facet.G=in:7350&facet=I&facet.I=96&facet=FA&facet.FA=12&defaultSelection=false&start=0&count=10&searchHistoryId=1540160093&keywords=ITIL&trk=lss-search-tab";
                    // string Url = mainUrl.Replace("replaceVariableCounter", paginationCounter.ToString());
                    mainPageResponse = objHttpHelper.getHtmlfromUrl(new Uri(mainUrl));
                    if (string.IsNullOrEmpty(mainPageResponse))
                    {
                        mainPageResponse = objHttpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/sales/?trk=nav_responsive_sub_nav_upgrade"));
                        mainPageResponse = objHttpHelper.getHtmlfromUrl(new Uri(mainUrl));
                    }

                    //if (mainPageResponse.Contains("We'll be back soon.")&&(mainPageResponse.Contains("We're getting things cleaned up.")))
                    //{
                    //    string unwatedStr = "https://www.linkedin.com/sales/search/?facet=N&facet.N=O&facet=G&facet.G=in:7350&facet=I&facet.I=96&facet=FA&facet.FA=12&defaultSelection=false&start=0&count=10&searchHistoryId=1540160093&keywords="+""+"&trk=lss-search-tab";// "&countryCode=" + Utils.getBetween(mainUrl, "&countryCode=", "&");
                    //    mainPageResponse = objHttpHelper.getHtmlfromUrl(new Uri(mainUrl.Replace(unwatedStr, paginationCounter.ToString())));
                    //}


                    if (string.IsNullOrEmpty(mainPageResponse))
                    {
                        if (string.IsNullOrEmpty(mainPageResponse))
                        {
                            //MessageBox.Show("Null response from internet. Please check your internet connection and restart the software.");
                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ No response from internet. Please check your internet connection. ] ");
                        }
                        Thread.Sleep(2000);
                        mainPageResponse = objHttpHelper.getHtmlfromUrl(new Uri(mainUrl.Replace("replaceVariableCounter", paginationCounter.ToString())));
                    }
                    try
                    {
                        if (dispTotalResults)
                        {
                            totalResults = Utils.getBetween(mainPageResponse, "\"total\":", ",\"").Trim();
                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Total results found : " + totalResults + " ]");
                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Scraping profile Url ]");
                            dispTotalResults = false;
                        }
                    }
                    catch
                    { }
                    int           checkCountUrls   = 0;
                    string[]      profileUrl_Split = Regex.Split(mainPageResponse, "\"profileUrl\"");
                    List <string> ProfileList      = new List <string>();
                    foreach (string profileUrlItem in profileUrl_Split)
                    {
                        if (!profileUrlItem.Contains("<!DOCTYPE"))
                        {
                            checkCountUrls++;
                            string profileUrl = Utils.getBetween(profileUrlItem, ":\"", "\",\"");
                            lstProfileUrls.Add(profileUrl);
                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Scraped Url : " + profileUrl + " ] ");
                            ProfileList.Add(profileUrl);
                        }
                    }
                    Thread.Sleep(1000);
                    ScrapeProfileDetails(ref objHttpHelper, ProfileList);
                    int startindex = paginationCounter;
                    paginationCounter = paginationCounter + 100;
                    mainUrl           = CreatePaginationUrl(mainUrl, startindex, paginationCounter);
                } while (mainPageResponse.Contains("\"profileUrl\":\""));
            }
            catch (Exception ex)
            {
            }
        }
		public static  List<string> GetPhotoId(string hashTag)
		{
			string url = "http://websta.me/" + "tag/" + hashTag;
			GlobusHttpHelper objInstagramUser = new GlobusHttpHelper ();
			List<string> lstPhotoId = new List<string> ();
			int counter = 0;


			string pageSource = objInstagramUser.getHtmlfromUrl(new Uri(url),"","");

			if (!string.IsNullOrEmpty (pageSource)) 
			{
				if (pageSource.Contains ("<div class=\"mainimg_wrapper\">")) 
				{
					string[] arr = Regex.Split (pageSource, "<div class=\"mainimg_wrapper\">");
					if (arr.Length > 1) 
					{
						arr = arr.Skip (1).ToArray ();
						foreach (string itemarr in arr)
						{
							try
							{
								string startString = "<a href=\"/p/";
								string endString = "\" class=\"mainimg\"";
								string imageId=string.Empty;
								string imageSrc = string.Empty;
								if(itemarr.Contains("<a href=\"/p/"))
								{
									int indexStart = itemarr.IndexOf("<a href=\"/p/");
									string itemarrNow = itemarr.Substring(indexStart);
									if (itemarrNow.Contains(startString) && itemarrNow.Contains(endString))
									{
										try
										{
											imageId = GlobusHttpHelper.getBetween(itemarrNow, startString, endString).Replace("/","");
										}
										catch { }
										if (!string.IsNullOrEmpty(imageId))
										{
											lstPhotoId.Add(imageId);
											lstPhotoId.Distinct();
											if(lstPhotoId.Count>=counterPhotoId)
											{
												return lstPhotoId;
											}

											//imageId = "http://websta.me"+imageId;
										}
									}
								}
							}
							catch(Exception ex)
							{

							}

						}




						#region pagination
						string pageLink = string.Empty;
						while (true)
						{
							//if (stopScrapImageBool) return;
							string startString = "<a href=\"";
							string endString = "\" class=\"mainimg\"";
							string imageId = string.Empty;
							string imageSrc = string.Empty;                                           

							if (!string.IsNullOrEmpty(pageLink))
							{
								pageSource = objInstagramUser.getHtmlfromUrl(new Uri(pageLink),"","");
							}

							if (pageSource.Contains("<ul class=\"pager\">") && pageSource.Contains("rel=\"next\">"))
							{
								try
								{
									pageLink = GlobusHttpHelper.getBetween(pageSource, "<ul class=\"pager\">", "rel=\"next\">");
								}
								catch { }
								if (!string.IsNullOrEmpty(pageLink))
								{
									try
									{
										int len = pageLink.IndexOf("<a href=\"");
										len = len + ("<a href=\"").Length;
										pageLink = pageLink.Substring(len);
										pageLink = pageLink.Trim();
										pageLink = pageLink.TrimEnd(new char[] { '"' });
										pageLink = "http://websta.me/" + pageLink;
									}
									catch { }
									if (!string.IsNullOrEmpty(pageLink))
									{
										string response = string.Empty;
										try
										{
											response = objInstagramUser.getHtmlfromUrl(new Uri(pageLink),"","");
										}
										catch { }
										if (!string.IsNullOrEmpty(response))
										{
											if (response.Contains("<div class=\"mainimg_wrapper\">"))
											{
												try
												{
													string[] arr1 = Regex.Split(response, "<div class=\"mainimg_wrapper\">");
													if (arr1.Length > 1)
													{
														arr1 = arr1.Skip(1).ToArray();
														foreach (string items in arr1)
														{
															try
															{
																//if (stopScrapImageBool) return;
																if (items.Contains("<a href=\"/p/"))
																{
																	int indexStart = items.IndexOf("<a href=\"/p/");
																	string itemarrNow = items.Substring(indexStart);

																	try
																	{
																		imageId = GlobusHttpHelper.getBetween(itemarrNow, startString, endString).Replace("/","");
																	}
																	catch { }
																	if (!string.IsNullOrEmpty(imageId))
																	{
																		lstPhotoId.Add(imageId);
																		lstPhotoId.Distinct();
																		if(lstPhotoId.Count>=counterPhotoId)
																		{
																			return lstPhotoId;
																		}

																		//imageId = "http://websta.me"+imageId;
																	}


																	counter++;

																	//Addtologger("Image DownLoaded with ImageName  "+imageId+"_"+counter);
																	if(lstPhotoId.Count>=counterPhotoId)
																	{
																		return lstPhotoId;
																	}

																}

															}
															catch { }
														}
														if(lstPhotoId.Count>=counterPhotoId)
														{
															return lstPhotoId;
														}
													}
												}
												catch { }

											}
										}
										else
										{

										}

									}
									else
									{
										break;
									}
								}
								else
								{
									break;
								}
							}
							else
							{
								break;
							}
						}
						#endregion




					}
				}
			}
			return lstPhotoId;
		}
Пример #54
0
        private void ButonTest_Click(object sender, EventArgs e)
        {
            UserControl abc = new UserControl();
            abc.Show();
            //TweetAccountManager tweetAccountManager = new TweetAccountManager();
            //tweetAccountManager.Username = "******";
            //tweetAccountManager.Password = "******";
            ////tweetAccountManager.proxyAddress = "173.208.131.234";
            ////tweetAccountManager.proxyPort = "8888";
            ////tweetAccountManager.proxyUsername = "******";
            ////tweetAccountManager.proxyPassword = "******";


            //tweetAccountManager.follower.logEvents.addToLogger += new EventHandler(logEvents_Follower_addToLogger);
            ////tweetAccountManager.logEvents.addToLogger += logEvents_Follower_addToLogger;
            //tweetAccountManager.Login();
            ////tweetAccountManager.UpdateProfile();

            //string unfollowuserId = "569071036";
            //string unfollowpost_authenticity_token = tweetAccountManager.postAuthenticityToken;
            //string unfollowpostdata = "user_id=" + unfollowuserId + "&post_authenticity_token=" + tweetAccountManager.postAuthenticityToken;
            //////string unfollowresponse = tweetAccountManager.globusHttpHelper.postFormData(new Uri("https://api.twitter.com/1/friendships/destroy.json"), unfollowpostdata, "https://api.twitter.com/receiver.html", "", "XMLHttpRequest", "true", "");
            //string res_PostFollow = tweetAccountManager.globusHttpHelper.postFormData(new Uri("https://api.twitter.com/1/friendships/destroy.json"), unfollowpostdata, "https://api.twitter.com/receiver.html", string.Empty, "XMLHttpRequest", "true", "https://api.twitter.com");

            //ParseJson();

            GlobusHttpHelper httpHelper = new GlobusHttpHelper();
            string res = httpHelper.getHtmlfromUrl(new Uri("http://www.wotif.com/hotel/View?hotel=W1711"), "", "");
        }
Пример #55
0
        public void getTweetUsers(string Url, ref GlobusHttpHelper HttpHelper)
        {
            string        cursor       = "-1";
            string        FollowingUrl = string.Empty;
            List <string> lstIds       = new List <string>();
            string        userID;
            string        Screen_name;
            int           counter = 0;

            try
            {
                Url = Url + "@@@";

                string numResult = getBetween(Url, "status/", "@@@");    //Regex.Match(Url, @"\d+").Value;



                FollowingUrl = "https://twitter.com/i/activity/retweeted_popup?id=" + numResult;

                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 is Invalid or PageSource is getting Null or Empty.");

                    //ReturnStatus = "Error";
                    return;
                }

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

                foreach (var DataDivArr_item in DataDivArr)
                {
                    if (DataDivArr_item.Contains("data-screen-name"))
                    {
                        int endIndex   = 0;
                        int startIndex = DataDivArr_item.IndexOf("data-screen-name");
                        try
                        {
                            endIndex = DataDivArr_item.IndexOf("data-name");
                        }
                        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 (_SCRName.Contains(" "))
                        {
                            _SCRName = _SCRName.Split(' ')[0];
                        }

                        //if (noOfRecords > lstIds.Count)
                        {
                            lstIds.Add(_SCRName);
                            lstIds = lstIds.Distinct().ToList();
                            AddToLog_ScrapMember("[ " + DateTime.Now + " ] => [" + _SCRName + " ]");
                            if (!File.Exists(Globals.Path_ScrapedMembersList))
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine(" UserName , Url", Globals.Path_ScrapedMembersList);
                            }
                            GlobusFileHelper.AppendStringToTextfileNewLine(_SCRName + "," + Url, Globals.Path_ScrapedMembersList);
                        }
                    }
                }
            }
            catch { }
        }
Пример #56
0
        public void GetPostCommentParsing(string posturl, ref GlobusHttpHelper objGlobusHttpHelper, string pageid, string UserId, ref List<string> Idlist,string pageUrl)
        {
            #region Variables resion
            string posthtml = string.Empty;
            string posturl1 = string.Empty;
            string post = string.Empty;           
            string like_id = string.Empty;
            string like_name = string.Empty;           
            string commentid = string.Empty;
            string commentmsg = string.Empty;
            string commentcreated_time = string.Empty;
            string commentlike_count = string.Empty;
            string user_likes = string.Empty;           
            string post_date = string.Empty;
            string linkurl = string.Empty;
            string pictureurl = string.Empty;
            string statustype = string.Empty;
            string type = string.Empty;
            string fromname = string.Empty;
            string postid = posturl.Split('/')[posturl.Split('/').Count() - 1].ToString();
            //string postid = string.Empty;
            string userid = string.Empty;
            string fromid = string.Empty;
            string getlikecomment = string.Empty;
            DateTime comment_date = new DateTime();
            #endregion
            if (posturl.Contains("https:"))
            {
                posturl1 = posturl;
            }
            else
            {
                posturl1 =("https://www.facebook.com" + posturl).Replace("\\",string.Empty);
            }
            try
            {                
               
                posthtml = objGlobusHttpHelper.getHtmlfromUrl(new Uri(posturl1));
                //post = socioHelper.getBetween(posthtml, "class=\"hasCaption\">", "<i class=\"_4-k1 img sp_LWp1MpKGrs1 sx_35a5d8").Replace("<br />", " ");
                string post1 = Utils.getBetween(posthtml, "<p>", "<form rel=\"async").Replace("See Translation", "");
               
                post = Regex.Replace(post1, "<[^>]+>|&nbsp;", "");
                try
                {
                    pictureurl = Utils.getBetween(posthtml, "id=\"fbPhotoImage\" src=\"", "\" alt=\"\" /></div><div").Replace("amp;", "");                    
                }
                catch (Exception ex)
                {

                }
                getlikecomment = Utils.getBetween(posthtml, "feedbacktargets\":", "mentionsdatasource\":");           


                JObject jobjectdata = JObject.Parse("{" + Utils.getBetween(posthtml, "showsendonentertip\":true}],", ",\"actions\":[]") + "}");
                try
                {
                    var Comments = jobjectdata["comments"];
                    foreach (var _Commentitem in Comments)
                    {                     
                        
                        string commentfrom_id = string.Empty;
                        string commentfrom_name = string.Empty;
                        commentid = _Commentitem["id"].ToString().Replace("\"", string.Empty).Trim();
                        commentmsg = _Commentitem["body"]["text"].ToString().Replace("\"", string.Empty).Trim();
                        commentfrom_id = _Commentitem["author"].ToString().Replace("\"", string.Empty).Trim();                     
                        
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }

                try
                {

                    string likerurl = "https://www.facebook.com/ajax/browser/dialog/likes?id=" + postid + "&actorid=" + pageid + "&__asyncDialog=1&__user="******"&__a=1&__dyn=7n8ajEBQ9FoBZypQ9UoHFaeFDzECiq78hACF3pqzCC-C26m6oKezpUgDyQqUgF5BzEy6E&__req=28&__rev=1461180";
                    string likerhtml = objGlobusHttpHelper.getHtmlfromUrl(new Uri(likerurl));
                    string[] splitliker = Regex.Split(likerhtml, "_s0 _rw img");
                    foreach (string liker_item in splitliker)
                    {
                        if (!liker_item.Contains("for (;;);"))
                        {

                            like_id = Utils.getBetween(liker_item, "data-hovercard=\\\"\\/ajax\\/hovercard\\/user.php?id=", "&amp;extragetparams");
                            Idlist.Add(like_id);


                            DataParsingWithGraphApi(like_id, pageUrl);

                            //like_name = Utils.getBetween(liker_item, "profile_browser\\u002522\\u00257D\\\">", "\\u003C\\/a>");                     
                          
                           
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }

        }
        public void ScrapeProfileDetails(ref GlobusHttpHelper objHttpHelper, List<string> ProfileUrls)
        {
            foreach (string profileURL in ProfileUrls)
            {
                try
                {
                    CheckDuplicate.Add(profileURL, profileURL);
                }
                catch (Exception)
                {
                    continue;
                }

                string name = string.Empty;
                string memberID = string.Empty;
                string imageUrl = string.Empty;
                string connection = string.Empty;
                string location = string.Empty;
                string industry = string.Empty;
                string headlineTitle = string.Empty;
                string currentTitle = string.Empty;
                string pastTitles = string.Empty;
                string currentCompany = string.Empty;
                string pastCompanies = string.Empty;
                string skills = string.Empty;
                string numberOfConnections = string.Empty;
                string education = string.Empty;
                string email = string.Empty;
                string phoneNumber = string.Empty;
                //if (SalesNavigatorGlobals.isStop)
                //{
                //    return;
                //}
                try
                {
                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Scraping profile details of profile url : " + profileURL + " ]");

                    string pgSource = objHttpHelper.getHtmlfromUrl(new Uri(profileURL));
                    if (string.IsNullOrEmpty(pgSource))
                    {
                        pgSource = objHttpHelper.getHtmlfromUrl(new Uri(profileURL));
                    }
                    if (!pgSource.Contains("\"profile\":"))
                    {
                        Thread.Sleep(2000);
                        pgSource = objHttpHelper.getHtmlfromUrl(new Uri(profileURL));
                    }

                    name = GetName(pgSource);

                    memberID = Utils.getBetween(profileURL, "profile/", ",").Trim();

                    imageUrl = GetImageUrl(pgSource);

                    email = GetEmail(pgSource);

                    phoneNumber = GetPhoneNumber(pgSource);

                    connection = GetConnection(pgSource);

                    location = GetLocation(pgSource);

                    industry = GetIndustry(pgSource);

                    headlineTitle = GetHeadlineTitle(pgSource);

                    headlineTitle = headlineTitle.Replace("\\u002d", string.Empty);

                    string allTitles = GetAllTitle(pgSource).Replace("d/b/a", string.Empty).Replace("&amp;", string.Empty); //title at company : title at company : title at company

                    try
                    {
                        string[] titles = Regex.Split(allTitles, " : ");

                        currentTitle = Utils.getBetween(titles[0], "", " at ");

                        foreach (string item in titles)
                        {
                            if (string.IsNullOrEmpty(pastTitles))
                            {
                                pastTitles = Utils.getBetween(item, "", " at ");
                            }
                            else
                            {
                                pastTitles = pastTitles + ":" + Utils.getBetween(item, "", " at ");
                            }
                        }


                        currentCompany = Utils.getBetween(titles[0] + "@", " at ", "@").Replace("d/b/a", string.Empty);

                        foreach (string item in titles)
                        {
                            if (string.IsNullOrEmpty(pastCompanies))
                            {
                                pastCompanies = Utils.getBetween(item + "@", " at ", "@").Replace("d/b/a", string.Empty);
                            }
                            else
                            {
                                if (!pastCompanies.Contains(Utils.getBetween(item + "@", " at ", "@")))
                                {
                                    pastCompanies = pastCompanies + ":" + Utils.getBetween(item + "@", " at ", "@").Replace("d/b/a", string.Empty);
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                    }

                    skills = GetSkills(pgSource);

                    numberOfConnections = GetNumberOfConnections(pgSource);

                    education = GetEducation(pgSource);
                }
                catch (Exception ex)
                {
                }
                lstProfileUrls.Remove(profileURL);

                WriteDataToCSV(name, profileURL, memberID, connection, location, industry, headlineTitle, currentTitle, pastTitles, currentCompany, pastCompanies, skills, numberOfConnections, education, email, phoneNumber);
            }
        }
Пример #58
0
        public bool Login()
        {
            string OAuthVerifier      = string.Empty;
            string OAuthenticityToken = string.Empty;
            string OAuthToken         = string.Empty;
            string PinToken           = string.Empty;
            string InviteUrl          = string.Empty;

            bool IsAccountCreated = false;

            try
            {
                string ts = GenerateTimeStamp();

                InviteUrl = "http://pinterest.com/invited/?email=" + PinEmail + "&invite=" + InviteCode;
                InviteUrl = "http://pinterest.com/invited/?invite=" + InviteCode;

                int intProxyPort = 80;
                if (ApplicationData.ValidateNumber(this.proxyPort))
                {
                    intProxyPort = int.Parse(this.proxyPort);
                }

                string TwitterPageContent = httpHelper.getHtmlfromUrlProxy(new Uri("https://twitter.com/"), "", this.proxyAddress, intProxyPort, this.proxyUsername, this.proxyPassword, this.userAgent);
                string BootPageContent    = httpHelper.getHtmlfromUrl(new Uri("https://twitter.com/account/bootstrap_data?r=0.9414130715097342"), "https://twitter.com/", "", this.userAgent);

                //string PostData = "session%5Busername_or_email%5D=" + TwitterUsername + "&session%5Bpassword%5D=" + TwitterPassword  + "&scribe_log=%5B%22%7B%5C%22event_name%5C%22%3A%5C%22web%3Afront%3Alogin_callout%3Aform%3A%3Alogin_click%5C%22%2C%5C%22noob_level%5C%22%3Anull%2C%5C%22internal_referer%5C%22%3Anull%2C%5C%22user_id%5C%22%3A0%2C%5C%22page%5C%22%3A%5C%22front%5C%22%2C%5C%22_category_%5C%22%3A%5C%22client_event%5C%22%2C%5C%22ts%5C%22%3A" + ts + "%7D%22%5D&redirect_after_login="******"https://twitter.com/sessions?phx=1"), PostData, "https://twitter.com/", "" , this.userAgent);

                //string ts = GenerateTimeStamp();
                string get_twitter_first = string.Empty;
                try
                {
                    get_twitter_first = httpHelper.getHtmlfromUrlProxy(new Uri("https://twitter.com/"), "", proxyAddress, 0, proxyUsername, proxyPassword, "");
                }
                catch (Exception ex)
                {
                    //string get_twitter_first = globusHttpHelper1.getHtmlfromUrlp(new Uri("http://twitter.com/"), string.Empty, string.Empty);
                    //Thread.Sleep(1000);
                    get_twitter_first = httpHelper.getHtmlfromUrlProxy(new Uri("https://twitter.com/"), "", proxyAddress, 0, proxyUsername, proxyPassword, "");
                }

                string postAuthenticityToken = "";

                int startIndx = get_twitter_first.IndexOf("postAuthenticityToken");
                if (startIndx > 0)
                {
                    int indexstart = startIndx + "postAuthenticityToken".Length + 3;
                    int endIndx    = get_twitter_first.IndexOf("\"", startIndx);

                    postAuthenticityToken = get_twitter_first.Substring(startIndx, endIndx - startIndx).Replace(",", "");

                    if (postAuthenticityToken.Contains("postAuthenticityToken"))
                    {
                        try
                        {
                            string[] getOuthentication = System.Text.RegularExpressions.Regex.Split(get_twitter_first, "\"postAuthenticityToken\":\"");
                            string[] authenticity      = System.Text.RegularExpressions.Regex.Split(getOuthentication[1], ",");

                            if (authenticity[0].IndexOf("\"") > 0)
                            {
                                int    indexStart1 = authenticity[0].IndexOf("\"");
                                string start       = authenticity[0].Substring(0, indexStart1);
                                postAuthenticityToken = start.Replace("\"", "").Replace(":", "");
                            }
                        }
                        catch { };
                    }
                }
                else
                {
                    string[] array = System.Text.RegularExpressions.Regex.Split(get_twitter_first, "<input type=\"hidden\"");
                    foreach (string item in array)
                    {
                        if (item.Contains("authenticity_token"))
                        {
                            int startindex = item.IndexOf("value=\"");
                            if (startindex > 0)
                            {
                                string start    = item.Substring(startindex).Replace("value=\"", "");
                                int    endIndex = start.IndexOf("\"");
                                string end      = start.Substring(0, endIndex);
                                postAuthenticityToken = end;
                                break;
                            }
                        }
                    }
                }

                string get_twitter_second = httpHelper.postFormData(new Uri("https://twitter.com/scribe"), "log%5B%5D=%7B%22event_name%22%3A%22web%3Amobile_gallery%3Agallery%3A%3A%3Aimpression%22%2C%22noob_level%22%3Anull%2C%22internal_referer%22%3Anull%2C%22context%22%3A%22mobile_gallery%22%2C%22event_info%22%3A%22mobile_app_download%22%2C%22user_id%22%3A0%2C%22page%22%3A%22mobile_gallery%22%2C%22_category_%22%3A%22client_event%22%2C%22ts%22%3A" + ts + "%7D", "https://twitter.com/?lang=en&logged_out=1#!/download", "", ""); //globusHttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/account/bootstrap_data?r=0.21632839148912897"), "https://twitter.com/", string.Empty);

                string get2nd = httpHelper.getHtmlfromUrlProxy(new Uri("http://twitter.com/account/bootstrap_data?r=0.21632839148912897"), "https://twitter.com/", proxyAddress, 0, proxyUsername, proxyPassword, "");

                string get_api = httpHelper.getHtmlfromUrl(new Uri("http://api.twitter.com/receiver.html"), "https://twitter.com/", "", "");


                //Old postdata
                //string postData = "session%5Busername_or_email%5D=" + Username + "&session%5Bpassword%5D=" + Password + "&scribe_log=%5B%22%7B%5C%22event_name%5C%22%3A%5C%22web%3Afront%3Alogin_callout%3Aform%3A%3Alogin_click%5C%22%2C%5C%22noob_level%5C%22%3Anull%2C%5C%22internal_referer%5C%22%3Anull%2C%5C%22user_id%5C%22%3A0%2C%5C%22page%5C%22%3A%5C%22front%5C%22%2C%5C%22_category_%5C%22%3A%5C%22client_event%5C%22%2C%5C%22ts%5C%22%3A" + ts + "%7D%22%5D&redirect_after_login="******"session%5Busername_or_email%5D=" + TwitterUsername + "&session%5Bpassword%5D=" + TwitterPassword + "&scribe_log=&redirect_after_login=&authenticity_token=" + postAuthenticityToken + "";

                string response_Login = httpHelper.postFormData(new Uri("https://twitter.com/sessions"), postData, "https://twitter.com/", "", "");


                string AfterPostPageContent = httpHelper.getHtmlfromUrl(new Uri("https://twitter.com/"), "https://twitter.com/", "", this.userAgent);

                if (AfterPostPageContent.Contains("signout-button"))
                {
                    string InvitePageContent = httpHelper.getHtmlfromUrl(new Uri(InviteUrl), "", "", this.userAgent);

                    if (InvitePageContent.Contains("This invite code is not valid"))
                    {
                        IsAccountCreated = false;
                        Log("[ " + DateTime.Now + " ] => [ This invite code is not valid " + PinEmail + " ]");
                        return(IsAccountCreated);
                    }

                    string InvitedPageContent = httpHelper.getHtmlfromUrl(new Uri("http://pinterest.com/twitter/?invited=1"), InviteUrl, "", this.userAgent);

                    if (InvitedPageContent.Contains("Logout"))
                    {
                        IsAccountCreated = true;
                        Log("[ " + DateTime.Now + " ] => [ This twitter account allready added with pinterest " + TwitterUsername + " ]");
                        return(IsAccountCreated);
                    }

                    Uri ResponseUri = httpHelper.GetResponseData();


                    if (!string.IsNullOrEmpty(ResponseUri.OriginalString))
                    {
                        if (ResponseUri.OriginalString.Contains("verify_captcha/?"))
                        {
                            //List<string> lstData = GetCapctha();
                            //string challenge = string.Empty;
                            //string response = string.Empty;


                            //challenge = lstData[0].ToString();
                            //response = lstData[1].ToString();
                            //response = response.Replace(" ", "+");
                            //string postUrl = "http://pinterest.com/verify_captcha/?src=register&return=%2Fwelcome%2F";
                            //string postData = "challenge=" + challenge + "&response=" + response;

                            //string POstResponse = httpHelper.postFormData(new Uri(postUrl), postData, "", string.Empty);

                            //string pageSrcWelcome = httpHelper.getHtmlfromUrl(new Uri("http://pinterest.com/welcome/"), postUrl, "");
                        }
                        if (ResponseUri.OriginalString.Contains("http://pinterest.com/twitter/?oauth_token"))
                        {
                            OAuthVerifier = ResponseUri.OriginalString;

                            int    FirstPointToken     = InvitedPageContent.IndexOf("csrfmiddlewaretoken");
                            string FirstTokenSubString = InvitedPageContent.Substring(FirstPointToken);

                            int SecondPointToken = FirstTokenSubString.IndexOf("/>");
                            PinToken = FirstTokenSubString.Substring(0, SecondPointToken).Replace("csrfmiddlewaretoken", string.Empty).Replace("value=", string.Empty).Replace("'", string.Empty).Trim();
                        }
                        if (ResponseUri.OriginalString.Contains("api.twitter.com/oauth/authenticate?oauth_token="))
                        {
                            int FirstAuthenticityPoint = InvitedPageContent.IndexOf("authenticity_token\" type=\"hidden\"");

                            string FirstSubAuthenticity = InvitedPageContent.Substring(FirstAuthenticityPoint);
                            OAuthenticityToken = FirstSubAuthenticity.Substring(FirstSubAuthenticity.IndexOf("value="), (FirstSubAuthenticity.IndexOf("/></div>")) - (FirstSubAuthenticity.IndexOf("value="))).Replace("value=", string.Empty).Replace("\"", string.Empty).Trim();

                            OAuthToken = ResponseUri.OriginalString.Replace("https://api.twitter.com/oauth/authenticate?oauth_token=", string.Empty).Replace("http://api.twitter.com/oauth/authenticate?oauth_token=", string.Empty);

                            string AcceptPostData = "authenticity_token=" + OAuthenticityToken + "&oauth_token=" + OAuthToken;

                            string OauthUrl = "https://twitter.com/oauth/authenticate?oauth_token=" + OAuthToken;

                            string AcceptedPageContent = httpHelper.postFormData(new Uri("https://twitter.com/oauth/authenticate"), AcceptPostData, OauthUrl, string.Empty, this.userAgent);

                            int FirstOAuthVerifierPoint = AcceptedPageContent.IndexOf("http://pinterest.com/twitter/?oauth_token=");

                            string FirstSuboAuth = AcceptedPageContent.Substring(FirstOAuthVerifierPoint);

                            OAuthVerifier = FirstSuboAuth.Substring(0, FirstSuboAuth.IndexOf(">")).Replace("\"", string.Empty).Trim();//.Replace("&oauth_verifier=", string.Empty).Trim();

                            string PinterestRegistrationPageContent = httpHelper.getHtmlfromUrl(new Uri(OAuthVerifier), string.Empty, string.Empty, this.userAgent);

                            if (!PinterestRegistrationPageContent.Contains("Oops! We are having some issues talking to Twitter. Please try again later"))
                            {
                                int    FirstPointToken     = PinterestRegistrationPageContent.IndexOf("csrfmiddlewaretoken");
                                string FirstTokenSubString = PinterestRegistrationPageContent.Substring(FirstPointToken);

                                int SecondPointToken = FirstTokenSubString.IndexOf("/>");
                                PinToken = FirstTokenSubString.Substring(0, SecondPointToken).Replace("csrfmiddlewaretoken", string.Empty).Replace("value=", string.Empty).Replace("'", string.Empty).Trim();
                            }
                            else
                            {
                                Log("[ " + DateTime.Now + " ] => [ We are having some issues talking to Twitter. Please try again later ]");
                                return(false);
                            }
                        }


                        //Checking For User Name
                        string CheckUserNameUrl = "http://pinterest.com/check_username/?check_username="******"&csrfmiddlewaretoken=" + PinToken;
                        string User             = httpHelper.getHtmlfromUrl(new Uri(CheckUserNameUrl), OAuthVerifier, PinToken, this.userAgent);

                        if (User.Contains("username is already"))
                        {
                            int num = RandomNumberGenerator.GenerateRandom(100, 1000);

                            PinUserName = PinUserName + num.ToString();

                            //Checking For User Name
                            CheckUserNameUrl = "http://pinterest.com/check_username/?check_username="******"&csrfmiddlewaretoken=" + PinToken;
                            User             = httpHelper.getHtmlfromUrl(new Uri(CheckUserNameUrl), OAuthVerifier, PinToken, this.userAgent);
                        }

                        ////Checking For User Name
                        //string CheckEmailUrl = "http://pinterest.com/check_username/?check_email=" + PinEmail + "&csrfmiddlewaretoken=" + PinToken;
                        //string Email = httpHelper.getHtmlfromUrl(new Uri(CheckEmailUrl), OAuthVerifier, PinToken);

                        //if (!Email.Contains("success"))
                        //{
                        //    //IsPinLoggedIn = true;
                        //    Log("This email not valid " + PinEmail);
                        //    return;
                        //}
                        string RegistrationPostData = "username="******"&email=" + PinEmail + "&password="******"&invite=" + InviteCode.Replace(" ", "").Replace("http://email.pinterest.com/wf/click&upn=", "") + "&twitter=1&csrfmiddlewaretoken=" + PinToken + "&user_image=http%3A%2F%2Fimg.tweetimag.es%2Fi%2FSocioPro_o";

                        string RegistredPageContent = httpHelper.postFormData(new Uri("http://pinterest.com/register/"), RegistrationPostData, OAuthVerifier, string.Empty, this.userAgent);

                        if (RegistredPageContent.Contains("recaptcha/api/js/recaptcha"))
                        {
                            List <string> lstData   = GetCapctha();
                            string        challenge = string.Empty;
                            string        response  = string.Empty;


                            challenge = lstData[0].ToString();
                            response  = lstData[1].ToString();
                            response  = response.Replace(" ", "+");
                            string postUrl   = "http://pinterest.com/verify_captcha/?src=register&return=/welcome/";
                            string postData1 = "challenge=" + challenge + "&response=" + response;

                            string POstResponse = httpHelper.postFormData(new Uri(postUrl), postData1, OAuthVerifier, PinToken, this.userAgent);

                            RegistredPageContent = httpHelper.getHtmlfromUrl(new Uri("http://pinterest.com/welcome/"), "", "", this.userAgent);
                        }
                        if (RegistredPageContent.Contains("architecture"))
                        {
                            IsAccountCreated = true;
                            Log("[ " + DateTime.Now + " ] => [ Account Created " + PinUserName + " ]");
                        }
                        else
                        {
                            IsAccountCreated = false;
                            Log("[ " + DateTime.Now + " ] => [ Account Not Created " + PinUserName + " ]");
                            return(IsAccountCreated);
                        }

                        string WelcomPageContent = httpHelper.postFormData(new Uri("http://pinterest.com/welcome/"), "", OAuthVerifier, PinToken, this.userAgent);

                        //Changed By  Gargi On 22nd May 2012 --> request from fiddler changed
                        //string CategoryPostData = "categories=architecture&user_follow=true";

                        string CategoryPostData = "categories=art%2Ccars_motorcycles%2Cdesign%2Cdiy_crafts%2Ceducation%2Carchitecture%2Cfitness";

                        string CategoryPageContent = httpHelper.postFormData(new Uri("http://pinterest.com/welcome/"), CategoryPostData, "http://pinterest.com/welcome/", PinToken, this.userAgent);

                        if (CategoryPageContent.Contains("success"))
                        {
                            IsAccountCreated = true;
                            Log("[ " + DateTime.Now + " ] => [ Initial Category Added " + PinUserName + " ]");
                        }

                        string AllowUserPostData = "follow_users%5B%5D=sharp&follow_users%5B%5D=neillehepworth&follow_users%5B%5D=miamalm&follow_users%5B%5D=kiluka&follow_users%5B%5D=gaileguevara&follow_users%5B%5D=jellway&follow_users%5B%5D=richard_larue&follow_users%5B%5D=rayestudio&follow_users%5B%5D=jdraper&follow_users%5B%5D=shashashasha";
                        //if (string.IsNullOrEmpty(ApplicationData.UsersToFollow))
                        //{
                        //    AllowUserPostData = "follow_users%5B%5D=sharp&follow_users%5B%5D=neillehepworth&follow_users%5B%5D=miamalm&follow_users%5B%5D=kiluka&follow_users%5B%5D=gaileguevara&follow_users%5B%5D=jellway&follow_users%5B%5D=richard_larue&follow_users%5B%5D=rayestudio&follow_users%5B%5D=jdraper&follow_users%5B%5D=shashashasha";
                        //}
                        //else
                        //{
                        //    AllowUserPostData = ApplicationData.UsersToFollow;
                        //}

                        string AlloweduserPostData = httpHelper.postFormData(new Uri("http://pinterest.com/welcome/"), AllowUserPostData, "http://pinterest.com/welcome/", PinToken, this.userAgent);

                        if (AlloweduserPostData.Contains("success"))
                        {
                            IsAccountCreated = true;
                            Log("[ " + DateTime.Now + " ] => [ Intial User Added " + PinUserName + " ]");
                        }

                        string BordPostData = "board_names%5B%5D=Products+I+Love&board_names%5B%5D=Favorite+Places+%26+Spaces&board_names%5B%5D=Books+Worth+Reading&board_names%5B%5D=My+Style&board_names%5B%5D=For+the+Home";

                        string BoardPostedPageContent = httpHelper.postFormData(new Uri("http://pinterest.com/welcome/"), BordPostData, "http://pinterest.com/welcome/", PinToken, this.userAgent);

                        if (BoardPostedPageContent.Contains("success"))
                        {
                            IsAccountCreated = true;
                            Log("[ " + DateTime.Now + " ] => [ Intial Board Added " + PinUserName + " ]");
                        }
                    }

                    return(IsAccountCreated);
                }
                else
                {
                    Log("[ " + DateTime.Now + " ] => [ Twitter Account Not Logged In :" + TwitterUsername + " ]");
                    return(IsAccountCreated);
                }
            }
            catch (Exception ex)
            {
                //Log("Error " + ex.Message);
                return(IsAccountCreated);
            }
        }
Пример #59
0
        /// <summary>
        /// Checks the status of the CPUID from Database
        /// If status is Active, MainFrm starts
        /// </summary>
        ///
        #region ValidateCPUID
        public bool ValidateCPUID(ref string statusMessage, string cpuID)
        {
            try
            {
                #region Through php

                string res = string.Empty;
                string url = string.Empty;
                //getHtmlfromUrl(new Uri(Photolink), "","");
                url = "http://faced.extrem-hosting.net/GetUserData.php?cpid=" + cpuID + "";
                res = HttpHelpr.getHtmlfromUrl(new Uri(url), "", "", "");

                if (string.IsNullOrEmpty(res))
                {
                    System.Threading.Thread.Sleep(1000);
                    res = HttpHelpr.getHtmlfromUrl(new Uri(url), "", "", "");
                }

                if (!string.IsNullOrEmpty(res))
                {
                    string status   = string.Empty;
                    string dateTime = string.Empty;
                    string username = string.Empty;
                    string txnID    = string.Empty;

                    string trimmed_response = res.Replace("<pre>", "").Replace("</pre>", "").Trim().ToLower();

                    // BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Responce):" + trimmed_response, Globals.DesktopFolder + "\\LogLicensingProcess.txt");

                    string[] array_status = System.Text.RegularExpressions.Regex.Split(trimmed_response, "<:>");
                    try
                    {
                        status = array_status[0].ToLower();
                    }
                    catch (Exception ex)
                    {
                        GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message + "ValidateCPUID", PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt");
                    }
                    try
                    {
                        dateTime = array_status[1].ToLower();
                        Loger("Date:" + dateTime);
                        //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(LicensingDate):" + dateTime, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                    }
                    catch (Exception ex)
                    {
                        GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message, PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt");
                    }
                    try
                    {
                        username = array_status[2].ToLower();
                        //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Username):" + username, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                    }
                    catch (Exception ex)
                    {
                        GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message, PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt");
                    }
                    try
                    {
                        txnID = array_status[3].ToLower();
                        //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(TxnId):" + txnID, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                    }
                    catch (Exception ex)
                    {
                        GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message, PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt");
                    }

                    if (trimmed_response.ToLower().Contains("freetrial") && ((status.ToLower() == "active") || (status.ToLower() == "nonactive")))
                    {
                        if (CheckActivationUpdateStatus(cpuID, dateTime, status, ""))
                        {
                            statusMessage = "Active";
                            //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Licence Status):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                            return(true);
                        }
                        else
                        {
                            statusMessage = "trialexpired";
                            //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Licence Status):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                            return(false);
                        }
                    }
                    else if (status.ToLower() == "active")
                    {
                        statusMessage = "active";
                        //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Licence Status):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                        return(true);
                        // DisableControls();
                    }
                    else if (status.ToLower() == "nonactive")
                    {
                        statusMessage = "nonactive";
                        //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Licence Status):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                        //MessageDialog md = new MessageDialog (this, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, "Verification of your txn is under process.\\n Please wait for your Transaction to be verified");
                        //ResponseType response = (ResponseType)md.Run ();
                        //md.Destroy();
                        //MessageBox.Show("Verification of your txn is under process.\n Please wait for your Transaction to be verified");
                        return(false);
                    }
                    else if (trimmed_response.Contains("trialexpired"))
                    {
                        statusMessage = "trialexpired";
                        //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Licence Status):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                        //MessageBox.Show("Your 3 Days Trial Version has Expired.");
                        return(false);
                    }
                    else if (trimmed_response.ToLower() == "suspended")
                    {
                        statusMessage = "suspended";
                        //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Licence Status):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                        return(false);
                    }
                    else if (trimmed_response.Contains("no record found"))
                    {
                        statusMessage = "norecordfound";
                        //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Licence Status):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                        return(false);
                    }
                    else
                    {
                        statusMessage = "Some Error in Status Field";
                        //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID(Licence Status):" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                        return(false);
                    }
                }
                else
                {
                    statusMessage = "ServerDown";
                    //BaseLib.GlobusFileHelper.AppendStringToTextfileNewLine("ValidateCPUID Sorry:" + statusMessage, Globals.DesktopFolder + "\\LogLicensingProcess.txt");
                    return(false);
                }

                #endregion
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                statusMessage = "Error in License Validation";
                GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message + "ValidateCPUID", PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt");
                //MessageBox.Show(ex.StackTrace);
            }
            return(false);
        }
Пример #60
0
        private void CheckVersion()
        {
            try
            {

                string thisVersionNumber = GetAssemblyNumber();

                string textFileLocationOnServer = "http://faced.extrem-hosting.net/TDLatestVersion.txt";//"http://cmswebusa.com/developers/SumitGupta/TDLatestVersion.txt";

                GlobusHttpHelper httpHelper = new GlobusHttpHelper();
                string textFileData = httpHelper.getHtmlfromUrl(new Uri(textFileLocationOnServer), "", "");

                string latestVersion = Regex.Split(textFileData, "<:>")[0];
                string updateVersionPath = Regex.Split(textFileData, "<:>")[1];

                if (thisVersionNumber == latestVersion)
                {
                    MessageBox.Show("You have the Updated Version", "Information");
                }

                else
                {
                    if (MessageBox.Show("An Updated Version Available - Do you Want to Upgrade!", "Update Available", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        System.Diagnostics.Process.Start("iexplore", updateVersionPath);

                        this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                AddToGeneralLogs("Error in Auto Update Module");
            }
        }