Ejemplo n.º 1
0
        public static string DecodeGetCharector(string PageString)
        {
            GlobusHttpHelper obj_http = new GlobusHttpHelper();
            string GetOrginalString = string.Empty;
            try
            {
                string[] Arr = System.Text.RegularExpressions.Regex.Split(PageString, "&#");
                foreach (var item_Arr in Arr)
                {
                    try
                    {

                        string ss = string.Empty;

                        ss = "&#" + Uri.EscapeDataString(Utils.getBetween("&#" + item_Arr, "&#", ";")) + ";";
                        string Url = "http://chars.suikawiki.org/string?s=" +Uri.EscapeDataString(ss);

                        string PageSource = obj_http.getHtmlfromUrl(new Uri(Url));
                        string[] Arr11 = System.Text.RegularExpressions.Regex.Split(PageSource, "escapes");

                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }

            return GetOrginalString;
        }
Ejemplo n.º 2
0
        public static string DecodeGetCharector(string PageString)
        {
            GlobusHttpHelper obj_http         = new GlobusHttpHelper();
            string           GetOrginalString = string.Empty;

            try
            {
                string[] Arr = System.Text.RegularExpressions.Regex.Split(PageString, "&#");
                foreach (var item_Arr in Arr)
                {
                    try
                    {
                        string ss = string.Empty;

                        ss = "&#" + Uri.EscapeDataString(Utils.getBetween("&#" + item_Arr, "&#", ";")) + ";";
                        string Url = "http://chars.suikawiki.org/string?s=" + Uri.EscapeDataString(ss);

                        string   PageSource = obj_http.getHtmlfromUrl(new Uri(Url));
                        string[] Arr11      = System.Text.RegularExpressions.Regex.Split(PageSource, "escapes");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }

            return(GetOrginalString);
        }
        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;
        }
Ejemplo n.º 4
0
        public bool LogoutHttpHelper(ref GlobusHttpHelper HttpHelper)
        {
            try
            {
                //string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/"));
                string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/"));
                if (pageSource1.Contains("\"h\"") && pageSource1.Contains("post_form_id") && pageSource1.Contains("fb_dtsg"))
                {
                    string h            = string.Empty;
                    string post_form_id = string.Empty;
                    string fb_dtsg      = string.Empty;

                    if (pageSource1.Contains("\"h\""))
                    {
                        string   strTemp = pageSource1.Substring(pageSource1.IndexOf("\"h\""), 200);
                        string[] ArrTemp = strTemp.Split('"');
                        h = ArrTemp[3];
                    }
                    if (pageSource1.Contains("post_form_id") && pageSource1.Contains("fb_dtsg"))
                    {
                        string   strTemp = pageSource1.Substring(pageSource1.IndexOf("post_form_id"), 200);
                        string[] ArrTemp = strTemp.Split('"');
                        post_form_id = ArrTemp[2];
                        fb_dtsg      = ArrTemp[6];
                    }

                    string ResponseLogout = HttpHelper.postFormData(new Uri("http://www.facebook.com/logout.php"), "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&ref=mb&h=" + h);
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                return(false);

                Console.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 5
0
        public bool LogoutHttpHelper(ref GlobusHttpHelper HttpHelper)
        {
            try
            {
                //string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/"));
                string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/"));
                if (pageSource1.Contains("\"h\"") && pageSource1.Contains("post_form_id") && pageSource1.Contains("fb_dtsg"))
                {
                    string h = string.Empty;
                    string post_form_id = string.Empty;
                    string fb_dtsg = string.Empty;

                    if (pageSource1.Contains("\"h\""))
                    {
                        string strTemp = pageSource1.Substring(pageSource1.IndexOf("\"h\""), 200);
                        string[] ArrTemp = strTemp.Split('"');
                        h = ArrTemp[3];
                    }
                    if (pageSource1.Contains("post_form_id") && pageSource1.Contains("fb_dtsg"))
                    {
                        string strTemp = pageSource1.Substring(pageSource1.IndexOf("post_form_id"), 200);
                        string[] ArrTemp = strTemp.Split('"');
                        post_form_id = ArrTemp[2];
                        fb_dtsg = ArrTemp[6];

                    }

                    string ResponseLogout = HttpHelper.postFormData(new Uri("http://www.facebook.com/logout.php"), "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&ref=mb&h=" + h);
                    return true;
                }
                return false;
            }
            catch (Exception ex)
            {
                return false;
                Console.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 6
0
        public Dictionary<string, string> PostAddMembers(ref GlobusHttpHelper HttpHelper, string user)
        {
            try
            {
                string MemId = string.Empty;
                string MemFName = string.Empty;
                string MemLName = string.Empty;
                string MemFullName = string.Empty;
                string pageSource = string.Empty;
                string Name = string.Empty;
                int start1 = 0;
                #region old code
                //MemberDtl.Clear();
                //string pageGetreq = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/groups?gid=28410&csrfToken=ajax%3A1826913778783200924"));
                //http://www.linkedin.com/connections2?displayFilteredConns=&fetchConnsFromDB=false
                #endregion

                //string pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/connections2?displayFilteredConns"));
                //string pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/connections"));
                //string pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/contacts/api/contacts/?start=0&count=10"));
                do
                {

                    pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/contacts/api/contacts/?start="+start1+"&count=10"));
                    //string[] RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "{&quot;");
                    string[] RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "{\"name\":");

                    foreach (var Members in RgxGroupData)
                    {
                        try
                        {
                            if (Members.Contains(", \"id\":"))
                            {
                                int startindex = Members.IndexOf(", \"id\":");
                                string start = Members.Substring(startindex);
                                int endIndex = start.IndexOf("}");
                                MemId = start.Substring(0, endIndex).Replace("&quot;", string.Empty).Replace("id", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("li_",string.Empty).Replace(", \"title\"",string.Empty).Replace("\"",string.Empty).Trim();
                                MemId = user + ':' + MemId;
                                string Fname = string.Empty;
                                string Lname = string.Empty;
                                try
                                {
                                    int StartIndex = Members.IndexOf("&quot;firstName&quot;:&quot;");
                                    if (StartIndex > 0)
                                    {
                                        string Start = Members.Substring(StartIndex).Replace("&quot;firstName&quot;:&quot;", "");
                                        int EndIndex = Start.IndexOf("&quot;,");
                                        string End = Start.Substring(0, EndIndex);
                                        Fname = End;
                                    }
                                }
                                catch (Exception ex)
                                {

                                }
                                try
                                {
                                    int StartIndex = Members.IndexOf("&quot;lastName&quot;:&quot;");
                                    if (StartIndex > 0)
                                    {
                                        string Start = Members.Substring(StartIndex).Replace("&quot;lastName&quot;:&quot;", "");
                                        int EndIndex = Start.IndexOf("&quot;,");
                                        string End = Start.Substring(0, EndIndex);
                                        Lname = End;
                                    }
                                }
                                catch (Exception ex)
                                {

                                }
                                try
                                {
                                    int StartIndex = Members.IndexOf("\"");
                                    if (StartIndex > 0)
                                    {
                                        string Start = Members.Substring(StartIndex).Replace("&quot;firstName&quot;:&quot;", "");
                                        int EndIndex = Start.IndexOf(", \"title\"");
                                        string End = Start.Substring(0, EndIndex).Replace(", \"title\"",string.Empty).Replace("\"",string.Empty).Trim();
                                        Name = End;
                                    }
                                }
                                catch (Exception ex)
                                {

                                }

                                //MemFullName = Fname + " " + Lname;
                                MemFullName = Name;

                                #region old code
                                //int startindex1 = Members.IndexOf("formattedName");
                                //string start1 = Members.Substring(startindex1);
                                //int endIndex1 = start1.IndexOf("}");
                                //MemFullName = start1.Substring(0, endIndex1).Replace("formattedName", string.Empty).Replace("&quot;", string.Empty).Replace(":", string.Empty).Trim();

                                //.Replace("&quot;", string.Empty).Replace(":", string.Empty).Replace(",", string.Empty).Trim();

                                //&quot;:&quot;agrawal, gaurav&quot;
                                //int startindex2 = Members.IndexOf("lastName");
                                //string start2 = Members.Substring(startindex2);
                                //int endIndex2 = start2.IndexOf("company\":\"");
                                //MemLName = start2.Substring(0, endIndex1).Replace("lastName", string.Empty).Replace("&quot", string.Empty).Replace(";",string.Empty).Replace(":", string.Empty).Replace(",", string.Empty).Replace("&quo",string.Empty).Trim();

                                //MemFullName = MemFName +":" + MemLName;
                                #endregion
                                try
                                {
                                    MemberNameAndID.Add(MemId, MemFullName);
                                }
                                catch (Exception ex)
                                {

                                }
                            }
                        }
                        catch
                        {
                        }
                    }
                    start1++;
                } while (pageSource.Contains("name"));
                return MemberNameAndID;
            }
            catch (Exception ex)
            {
                return MemberNameAndID;
            }
        }
        public string UpdateWebSiteData(string Id,string Url)
        {
            WebSiteReviewDataRpository _WebSiteReviewDataRpository = new WebSiteReviewDataRpository();
            websitereviewdata _WebSiteReviewData = new websitereviewdata();
            _WebSiteReviewData = _WebSiteReviewDataRpository.getinfoforupdate(Guid.Parse(Id), Url);
            if (_WebSiteReviewData.entrydate.Date == DateTime.Today)
            {

                string imageurl = "";
                string textname = "";
                string websitedescription = "";
                string GlobalRank = "";
                string CountryRank = "";
                string CategoryRank = "";
                string VisitersOnSite = "";
                string TimeOnSite = "";
                string WebSitePageViewers = "";
                string WebSiteBounceRate = "";
                string DirrectTrafficOnSite = "";
                string ReferralTrafficOnSite = "";
                string SearchTrafficeOnSite = "";
                string SocialTrafficeOnSite = "";
                string MailTrafficeOnSite = "";
                string DisplayTrafficOnSite = "";
                string toprefersitedata = "";
                string topdestiantionsites = "";
                string PaidSearch = "";
                string organickeyword = "";
                string paidkeyword = "";
                string socialsites = "";
                string sitesvalue = "";
                string display = "";
                string interestvalue = "";
                string audienceinterest = "";
                string visitedsites = "";
                string similarwebsite = "";
                string inmagesource = "";
                string appname = "";
                string inmagesourceapp = "";
                string appnameapp = "";
                string pagesource = "";
                string TrafficbyCountry = "";
                string googleappimageurl = "";
                string appleappimageurl = "";

                string url = "http://www.similarweb.com/website/" + Url;
                ChilkatHttpHelpr objChilkatHttpHelpr = new ChilkatHttpHelpr();
                GlobusHttpHelper _GlobusHttpHelper = new GlobusHttpHelper();
                pagesource = _GlobusHttpHelper.getHtmlfromUrl(new Uri(url));

                if (pagesource.Contains("stickyHeader-nameItem"))
                {
                    string requiredpagesource = Utils.getBetween(pagesource, "stickyHeader-nameItem", "class=\"icon-new-window stickyHeader-iconNew\"");
                    imageurl = Utils.getBetween(requiredpagesource, "src=\"", "\" />");
                    textname = Utils.getBetween(requiredpagesource, "\"stickyHeader-nameText\">", "</span>");
                }
                if (pagesource.Contains("analysis-descriptionText"))
                {
                    string descriptionsource = Utils.getBetween(pagesource, "analysis-descriptionText", "stickyHeader-relatedAppsSection");
                    websitedescription = Utils.getBetween(descriptionsource, "\">", "</div>");

                }
                if (pagesource.Contains("stickyHeader-relatedAppsHeader"))
                {
                    string apppagesource = Utils.getBetween(pagesource, "stickyHeader-relatedAppsHeader", "stickyHeader-pdfButtonContainer");
                    string[] imagepath = Regex.Split(apppagesource, "Internal Link");
                    foreach (var item in imagepath)
                    {
                        if (item.Contains("Related Mobile Apps App Store"))
                        {
                            string appitem = Utils.getBetween(item, "stickyHeader-appImage", "</span>");
                            appitem = Utils.getBetween(appitem, "src=\"", "\">");
                            appleappimageurl = appitem + "," + appleappimageurl;

                        }
                        else if (item.Contains("Related Mobile Apps Google Play"))
                        {
                            string googleitem = Utils.getBetween(item, "stickyHeader-appImage", "</span>");
                            googleitem = Utils.getBetween(googleitem, "src=\"", "\">");
                            googleappimageurl = googleitem + "," + googleappimageurl;
                        }
                    }

                }
                if (pagesource.Contains("rankingSection"))
                {
                    string rankepagesource = Utils.getBetween(pagesource, "rankingSection", "rankingItem-embed");
                    string globalrank = Utils.getBetween(rankepagesource, "data-value=\"", "/span>");
                    GlobalRank = Utils.getBetween(globalrank, "\">", "<");

                }
                if (pagesource.Contains("Category Rank"))
                {
                    string countryrankpagesource = Utils.getBetween(pagesource, "Country Rank", "Category Rank");
                    countryrankpagesource = Utils.getBetween(countryrankpagesource, "data-value=\"", "/span>");
                    CountryRank = Utils.getBetween(countryrankpagesource, "\">", "<");

                    string categorypagesource = Utils.getBetween(pagesource, "Category Rank", "Traffic Overview");
                    categorypagesource = Utils.getBetween(categorypagesource, "data-value=\"", "/span>");
                    CategoryRank = Utils.getBetween(categorypagesource, "\">", "<");
                }

                if (pagesource.Contains("Estimated Monthly Visits"))
                {
                    string EstimatedMonthlyVisits = Utils.getBetween(pagesource, "Engagement", "Traffic by countries");
                    string visits = Utils.getBetween(EstimatedMonthlyVisits, "visits", "Time on site");
                    visits = Utils.getBetween(visits, "engagementInfo-value engagementInfo-value--large u-text-ellipsis", "span>");
                    VisitersOnSite = Utils.getBetween(visits, "\">", "<");

                    string timeonsite = Utils.getBetween(EstimatedMonthlyVisits, "Time on site", "Page views");
                    timeonsite = Utils.getBetween(timeonsite, "engagementInfo-value u-text-ellipsis", "/span>");

                    TimeOnSite = Utils.getBetween(timeonsite, "\">", "<");


                    string pageview = Utils.getBetween(EstimatedMonthlyVisits, "Page views", "Bounce rate");
                    pageview = Utils.getBetween(pageview, "engagementInfo-value u-text-ellipsis", "/span>");

                    WebSitePageViewers = Utils.getBetween(pageview, "\">", "<");


                    string bouncerate = Utils.getBetween(EstimatedMonthlyVisits, "Bounce rate", "geo");
                    bouncerate = Utils.getBetween(bouncerate, "engagementInfo-value u-text-ellipsis", "/span>");
                    WebSiteBounceRate = Utils.getBetween(bouncerate, "\">", "<");
                }

                if (pagesource.Contains("WebsitePageModule.Views.MapView"))
                {
                    string trafficbycountry = Utils.getBetween(pagesource, "WebsitePageModule.Views.MapView", "websitePage-contentNarrow websitePage-contentRight geo-accordion");
                    TrafficbyCountry = Utils.getBetween(trafficbycountry, "&quot;Country&quot;, &quot;Share&quot;],", "]}'></div>").Replace("&quot;", "");
                }
                if (pagesource.Contains("trafficSourcesSection"))
                {

                    string trafficsource = Utils.getBetween(pagesource, "trafficSourcesChart-list", "analysisPage-section websitePage-referrals hideInCompared");
                    string trafficsourcedirrect = Utils.getBetween(trafficsource, "trafficSourcesChart-item direct", "icon-direct trafficSourcesChart-icon");
                    DirrectTrafficOnSite = Utils.getBetween(trafficsourcedirrect, "<div class=\"trafficSourcesChart-value\">", "</div>");

                    string refferalsource = Utils.getBetween(trafficsource, "trafficSourcesChart-item referrals", "icon-referrals trafficSourcesChart-icon");
                    ReferralTrafficOnSite = Utils.getBetween(refferalsource, "<div class=\"trafficSourcesChart-value\">", "</div>");

                    string searchtrafficsource = Utils.getBetween(trafficsource, "trafficSourcesChart-item search", "icon-search trafficSourcesChart-icon");
                    SearchTrafficeOnSite = Utils.getBetween(searchtrafficsource, "<div class=\"trafficSourcesChart-value\">", "</div>");

                    string socialtrafficesource = Utils.getBetween(trafficsource, "trafficSourcesChart-item social", "icon-social trafficSourcesChart-icon");
                    SocialTrafficeOnSite = Utils.getBetween(socialtrafficesource, "<div class=\"trafficSourcesChart-value\">", "</div>");

                    string mailtrafficesource = Utils.getBetween(trafficsource, "trafficSourcesChart-item mail", "icon-mail trafficSourcesChart-icon");
                    MailTrafficeOnSite = Utils.getBetween(mailtrafficesource, "<div class=\"trafficSourcesChart-value\">", "</div>");


                    string displaytrafficesource = Utils.getBetween(trafficsource, "trafficSourcesChart-item display", "icon-display trafficSourcesChart-icon");
                    DisplayTrafficOnSite = Utils.getBetween(displaytrafficesource, "<div class=\"trafficSourcesChart-value\">", "</div>");
                }
                if (pagesource.Contains("analysisPage-section websitePage-referrals hideInCompared"))
                {
                    string topsitereferrral = Utils.getBetween(pagesource, "Top Referring Sites", "searchSection analysisPage-section websitePage-search hideInCompared");
                    string toprefersite = Utils.getBetween(topsitereferrral, "Top Referring Sites", "Top Destination Sites:");
                    string[] reqdataarr = Regex.Split(toprefersite, "class=\"websitePage-listItemLink");

                    foreach (var item in reqdataarr)
                    {


                        if (item.Contains("\"Internal Link\""))
                        {

                            string topsitename = Utils.getBetween(item, "\">", "</a>");
                            toprefersitedata = topsitename + "," + toprefersitedata;
                        }
                    }

                    string topdestinationsite = Utils.getBetween(topsitereferrral, "Top Destination Sites", "websitePage-blueButton websitePage-sectionButton referrals-hookButton js-proPopup");

                    string[] topdestiantion = Regex.Split(topdestinationsite, "websitePage-listItemLink js-tooltipTarget");


                    foreach (var item_site in topdestiantion)
                    {

                        if (item_site.Contains("\"Internal Link\""))
                        {
                            string topdetsianton = Utils.getBetween(item_site, "\">", "</a>");
                            topdestiantionsites = topdetsianton + "," + topdestiantionsites;
                        }
                    }

                }
                if (pagesource.Contains("searchPie-text searchPie-text--left"))
                {
                    string serchvalue = Utils.getBetween(pagesource, "searchPie-text searchPie-text--left", "searchKeywords-text searchKeywords-text--left websitePage-mobileFramed");
                    string organicsearch = Utils.getBetween(serchvalue, "<span class=\"searchPie-number\">", "</span>");
                    string paidserach = Utils.getBetween(serchvalue, "<div class=\"searchPie-text searchPie-text--right  \">", "/span>");
                    PaidSearch = Utils.getBetween(paidserach, "\">", "<");
                }

                if (pagesource.Contains("Organic Keywords"))
                {
                    string keyword = Utils.getBetween(pagesource, "Organic Keywords", "socialSection analysisPage-section websitePage-social hideInCompared");
                    string keywordvalue = Utils.getBetween(keyword, "searchKeywords-list", "websitePage-sectionButton u-button--wide js-proPopup");
                    string[] onganickeywordarry = Regex.Split(keywordvalue, "class='searchKeywords-words'");


                    foreach (var item in onganickeywordarry)
                    {
                        if (item.Contains("title=\""))
                        {
                            string valuekeyword = Utils.getBetween(item, "\">", "</span>");
                            organickeyword = valuekeyword + "," + organickeyword;
                        }
                    }

                    string paidvalue = Utils.getBetween(keyword, "websitePage-sectionButton u-button--wide js-proPopup", "social");
                    paidkeyword = Utils.getBetween(paidvalue, "search-noDataMessage\">", "</div>").Replace("\n", "");

                }


                if (pagesource.Contains("socialSection analysisPage-section websitePage-social hideInCompared"))
                {
                    string socialvalue = Utils.getBetween(pagesource, "socialSection analysisPage-section websitePage-social hideInCompared", "Display Advertising");
                    string[] socialsitesvalue = Regex.Split(socialvalue, "class=\"socialItem\"");

                    foreach (var item in socialsitesvalue)
                    {
                        if (item.Contains("Internal Link"))
                        {
                            string data = Utils.getBetween(item, "Internal Link\"", "/a>");
                            data = Utils.getBetween(data, "'>", "<");
                            socialsites = data + "," + socialsites;

                            string value = Utils.getBetween(item, "socialItem-value\">", "</div>");
                            sitesvalue = value + "," + sitesvalue;
                        }
                    }

                }

                if (pagesource.Contains("Display Advertising"))
                {
                    string displayvalue = Utils.getBetween(pagesource, "Display Advertising", "Audience Interests");
                    display = Utils.getBetween(displayvalue, "class=\"noData-title display\">", "</h2>");
                }
                if (pagesource.Contains("Audience Interests"))
                {
                    string audiencesvalue = Utils.getBetween(pagesource, "Audience Interests", "Also visited websites");
                    string[] audiencedata = Regex.Split(audiencesvalue, "audienceCategories-item fadeInLeft");

                    foreach (var item in audiencedata)
                    {
                        if (item.Contains("audienceCategories-chartContainer"))
                        {
                            string values = Utils.getBetween(item, "\"fillValue\":", "\"innerSize\"").Replace(",", "");
                            interestvalue = values + "," + interestvalue;

                            string intreset = Utils.getBetween(item, "audienceCategories-itemLink", "/a>");
                            intreset = Utils.getBetween(intreset, "\">", "<");
                            audienceinterest = intreset + "," + audienceinterest;
                        }
                    }
                }
                if (pagesource.Contains("Also visited websites"))
                {
                    string alsovisitedvalue = Utils.getBetween(pagesource, "Also visited websites", "Similar Sites");
                    string[] data = Regex.Split(alsovisitedvalue, "websitePage-listItemContainer");

                    foreach (var item in data)
                    {
                        if (item.Contains("Internal Link"))
                        {
                            string value = Utils.getBetween(item, "Internal Link", "/a>");
                            value = Utils.getBetween(value, "\">", "<");
                            visitedsites = value + "," + visitedsites;
                        }
                    }
                }
                if (pagesource.Contains("Similar Sites"))
                {
                    string SimilaSitesdata = Utils.getBetween(pagesource, "Similar Sites", "Related Mobile Apps");
                    string[] data = Regex.Split(SimilaSitesdata, "compareModal-row-cell-title");

                    foreach (var item in data)
                    {
                        if (item.Contains("data-url="))
                        {
                            string value = Utils.getBetween(item, "\">", "</span>");
                            similarwebsite = value + "," + similarwebsite;
                        }
                    }
                }
                if (pagesource.Contains("analysisPage-section websitePage-websiteMobileApps hideInCompared"))
                {
                    string RelatedMobilAppsdata = Utils.getBetween(pagesource, "analysisPage-section websitePage-websiteMobileApps hideInCompared", "Get More with SimilarWeb PRO");
                    string data = Utils.getBetween(RelatedMobilAppsdata, "Google Play Store", "App Store");
                    string[] dataarry = Regex.Split(data, "data-analytics-category=\"Internal Link\"");

                    foreach (var item in dataarry)
                    {
                        if (item.Contains("data-analytics-label="))
                        {
                            string valueimgaesrc = Utils.getBetween(item, "data-original=\"", "alt=\"").Replace("\"", "");
                            inmagesource = valueimgaesrc + "," + inmagesource;
                            string valueappname = Utils.getBetween(item, "itemprop=\"name\"", "/span>");
                            valueappname = Utils.getBetween(valueappname, ">", "<").Replace("\n", "").Trim();
                            appname = valueappname + "," + appname;

                        }
                    }

                    string appdatavlue = Utils.getBetween(RelatedMobilAppsdata, "App Store", "u-button--middle websitePage-pinkStrongButton websitePage-sectionButton js-proPopup");
                    string[] datavalue = Regex.Split(appdatavlue, "mobileApps-appList");

                    foreach (var item in datavalue)
                    {
                        if (item.Contains("data-options="))
                        {
                            string valueimgaesrc = Utils.getBetween(item, "data-original=\"", "alt=\"").Replace("\"", "");
                            inmagesourceapp = valueimgaesrc + "," + inmagesourceapp;
                            string valueappname = Utils.getBetween(item, "itemprop=\"name\"", "/span>");
                            valueappname = Utils.getBetween(valueappname, ">", "<").Replace("\n", "").Trim();
                            appnameapp = valueappname + "," + appnameapp;
                        }

                    }
                }
                _WebSiteReviewData.imageurl = imageurl;
                _WebSiteReviewData.googleinmagesource = inmagesource;
                _WebSiteReviewData.inmagesourceapp = inmagesourceapp;
                _WebSiteReviewData.interestvalue = interestvalue;
                _WebSiteReviewData.MailTrafficeOnSite = MailTrafficeOnSite;
                _WebSiteReviewData.organickeyword = organickeyword;
                _WebSiteReviewData.paidkeyword = paidkeyword;
                _WebSiteReviewData.PaidSearch = PaidSearch;
                _WebSiteReviewData.ReferralTrafficOnSite = ReferralTrafficOnSite;
                _WebSiteReviewData.SearchTrafficeOnSite = SearchTrafficeOnSite;
                _WebSiteReviewData.similarwebsite = similarwebsite;
                _WebSiteReviewData.sitesvalue = sitesvalue;
                _WebSiteReviewData.socialsites = socialsites;
                _WebSiteReviewData.SocialTrafficeOnSite = socialsites;
                _WebSiteReviewData.textname = textname;
                _WebSiteReviewData.TimeOnSite = TimeOnSite;
                _WebSiteReviewData.topdestiantionsites = topdestiantionsites;
                _WebSiteReviewData.toprefersitedata = toprefersitedata;
                _WebSiteReviewData.visitedsites = visitedsites;
                _WebSiteReviewData.VisitersOnSite = VisitersOnSite;
                _WebSiteReviewData.WebSiteBounceRate = WebSiteBounceRate;
                _WebSiteReviewData.websitedescription = websitedescription;
                _WebSiteReviewData.websitename = url;
                _WebSiteReviewData.WebSitePageViewers = WebSitePageViewers;
                _WebSiteReviewData.googleappname = appname;
                _WebSiteReviewData.appnameapp = appnameapp;
                _WebSiteReviewData.audienceinterest = audienceinterest;
                _WebSiteReviewData.CategoryRank = CategoryRank;
                _WebSiteReviewData.CountryRank = CountryRank;
                _WebSiteReviewData.DirrectTrafficOnSite = DirrectTrafficOnSite;
                _WebSiteReviewData.display = display;
                _WebSiteReviewData.DisplayTrafficOnSite = DisplayTrafficOnSite;
                _WebSiteReviewData.GlobalRank = GlobalRank;
                _WebSiteReviewData.TrafficbyCountry = TrafficbyCountry;
                _WebSiteReviewData.relatedappimageurl = appleappimageurl;
                _WebSiteReviewData.relatedgoogleimageurl = googleappimageurl;

                try
                {
                    _WebSiteReviewDataRpository.UpdateWebSiteData(_WebSiteReviewData);
                    return "Update Sucessfully";
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                    logger.Error(ex.Message);
                    return "something went wrong";
                }
                
            }
            else {
                string imageurl = "";
                string textname = "";
                string websitedescription = "";
                string GlobalRank = "";
                string CountryRank = "";
                string CategoryRank = "";
                string VisitersOnSite = "";
                string TimeOnSite = "";
                string WebSitePageViewers = "";
                string WebSiteBounceRate = "";
                string DirrectTrafficOnSite = "";
                string ReferralTrafficOnSite = "";
                string SearchTrafficeOnSite = "";
                string SocialTrafficeOnSite = "";
                string MailTrafficeOnSite = "";
                string DisplayTrafficOnSite = "";
                string toprefersitedata = "";
                string topdestiantionsites = "";
                string PaidSearch = "";
                string organickeyword = "";
                string paidkeyword = "";
                string socialsites = "";
                string sitesvalue = "";
                string display = "";
                string interestvalue = "";
                string audienceinterest = "";
                string visitedsites = "";
                string similarwebsite = "";
                string inmagesource = "";
                string appname = "";
                string inmagesourceapp = "";
                string appnameapp = "";
                string pagesource = "";
                string TrafficbyCountry = "";
                string googleappimageurl = "";
                string appleappimageurl = "";

                string url = "http://www.similarweb.com/website/" + Url;
                ChilkatHttpHelpr objChilkatHttpHelpr = new ChilkatHttpHelpr();
                GlobusHttpHelper _GlobusHttpHelper = new GlobusHttpHelper();
                pagesource = _GlobusHttpHelper.getHtmlfromUrl(new Uri(url));
                
                if (pagesource.Contains("stickyHeader-nameItem"))
                {
                    string requiredpagesource = Utils.getBetween(pagesource, "stickyHeader-nameItem", "class=\"icon-new-window stickyHeader-iconNew\"");
                    imageurl = Utils.getBetween(requiredpagesource, "src=\"", "\" />");
                    textname = Utils.getBetween(requiredpagesource, "\"stickyHeader-nameText\">", "</span>");
                }
                if (pagesource.Contains("analysis-descriptionText"))
                {
                    string descriptionsource = Utils.getBetween(pagesource, "analysis-descriptionText", "stickyHeader-relatedAppsSection");
                    websitedescription = Utils.getBetween(descriptionsource, "\">", "</div>");

                }
                if (pagesource.Contains("stickyHeader-relatedAppsHeader"))
                {
                    string apppagesource = Utils.getBetween(pagesource, "stickyHeader-relatedAppsHeader", "stickyHeader-pdfButtonContainer");
                    string[] imagepath = Regex.Split(apppagesource, "Internal Link");
                    foreach (var item in imagepath)
                    {
                        if (item.Contains("Related Mobile Apps App Store"))
                        {
                            string appitem = Utils.getBetween(item, "stickyHeader-appImage", "</span>");
                            appitem = Utils.getBetween(appitem, "src=\"", "\">");
                            appleappimageurl = appitem + "," + appleappimageurl;

                        }
                        else if (item.Contains("Related Mobile Apps Google Play"))
                        {
                            string googleitem = Utils.getBetween(item, "stickyHeader-appImage", "</span>");
                            googleitem = Utils.getBetween(googleitem, "src=\"", "\">");
                            googleappimageurl = googleitem + "," + googleappimageurl;
                        }
                    }

                }
                if (pagesource.Contains("rankingSection"))
                {
                    string rankepagesource = Utils.getBetween(pagesource, "rankingSection", "rankingItem-embed");
                    string globalrank = Utils.getBetween(rankepagesource, "data-value=\"", "/span>");
                    GlobalRank = Utils.getBetween(globalrank, "\">", "<");

                }
                if (pagesource.Contains("Category Rank"))
                {
                    string countryrankpagesource = Utils.getBetween(pagesource, "Country Rank", "Category Rank");
                    countryrankpagesource = Utils.getBetween(countryrankpagesource, "data-value=\"", "/span>");
                    CountryRank = Utils.getBetween(countryrankpagesource, "\">", "<");

                    string categorypagesource = Utils.getBetween(pagesource, "Category Rank", "Traffic Overview");
                    categorypagesource = Utils.getBetween(categorypagesource, "data-value=\"", "/span>");
                    CategoryRank = Utils.getBetween(categorypagesource, "\">", "<");
                }

                if (pagesource.Contains("Estimated Monthly Visits"))
                {
                    string EstimatedMonthlyVisits = Utils.getBetween(pagesource, "Engagement", "Traffic by countries");
                    string visits = Utils.getBetween(EstimatedMonthlyVisits, "visits", "Time on site");
                    visits = Utils.getBetween(visits, "engagementInfo-value engagementInfo-value--large u-text-ellipsis", "span>");
                    VisitersOnSite = Utils.getBetween(visits, "\">", "<");

                    string timeonsite = Utils.getBetween(EstimatedMonthlyVisits, "Time on site", "Page views");
                    timeonsite = Utils.getBetween(timeonsite, "engagementInfo-value u-text-ellipsis", "/span>");

                    TimeOnSite = Utils.getBetween(timeonsite, "\">", "<");


                    string pageview = Utils.getBetween(EstimatedMonthlyVisits, "Page views", "Bounce rate");
                    pageview = Utils.getBetween(pageview, "engagementInfo-value u-text-ellipsis", "/span>");

                    WebSitePageViewers = Utils.getBetween(pageview, "\">", "<");


                    string bouncerate = Utils.getBetween(EstimatedMonthlyVisits, "Bounce rate", "geo");
                    bouncerate = Utils.getBetween(bouncerate, "engagementInfo-value u-text-ellipsis", "/span>");
                    WebSiteBounceRate = Utils.getBetween(bouncerate, "\">", "<");
                }

                if (pagesource.Contains("WebsitePageModule.Views.MapView"))
                {
                    string trafficbycountry = Utils.getBetween(pagesource, "WebsitePageModule.Views.MapView", "websitePage-contentNarrow websitePage-contentRight geo-accordion");
                    TrafficbyCountry = Utils.getBetween(trafficbycountry, "&quot;Country&quot;, &quot;Share&quot;],", "]}'></div>").Replace("&quot;", "");
                }
                if (pagesource.Contains("trafficSourcesSection"))
                {

                    string trafficsource = Utils.getBetween(pagesource, "trafficSourcesChart-list", "analysisPage-section websitePage-referrals hideInCompared");
                    string trafficsourcedirrect = Utils.getBetween(trafficsource, "trafficSourcesChart-item direct", "icon-direct trafficSourcesChart-icon");
                    DirrectTrafficOnSite = Utils.getBetween(trafficsourcedirrect, "<div class=\"trafficSourcesChart-value\">", "</div>");

                    string refferalsource = Utils.getBetween(trafficsource, "trafficSourcesChart-item referrals", "icon-referrals trafficSourcesChart-icon");
                    ReferralTrafficOnSite = Utils.getBetween(refferalsource, "<div class=\"trafficSourcesChart-value\">", "</div>");

                    string searchtrafficsource = Utils.getBetween(trafficsource, "trafficSourcesChart-item search", "icon-search trafficSourcesChart-icon");
                    SearchTrafficeOnSite = Utils.getBetween(searchtrafficsource, "<div class=\"trafficSourcesChart-value\">", "</div>");

                    string socialtrafficesource = Utils.getBetween(trafficsource, "trafficSourcesChart-item social", "icon-social trafficSourcesChart-icon");
                    SocialTrafficeOnSite = Utils.getBetween(socialtrafficesource, "<div class=\"trafficSourcesChart-value\">", "</div>");

                    string mailtrafficesource = Utils.getBetween(trafficsource, "trafficSourcesChart-item mail", "icon-mail trafficSourcesChart-icon");
                    MailTrafficeOnSite = Utils.getBetween(mailtrafficesource, "<div class=\"trafficSourcesChart-value\">", "</div>");


                    string displaytrafficesource = Utils.getBetween(trafficsource, "trafficSourcesChart-item display", "icon-display trafficSourcesChart-icon");
                    DisplayTrafficOnSite = Utils.getBetween(displaytrafficesource, "<div class=\"trafficSourcesChart-value\">", "</div>");
                }
                if (pagesource.Contains("analysisPage-section websitePage-referrals hideInCompared"))
                {
                    string topsitereferrral = Utils.getBetween(pagesource, "Top Referring Sites", "searchSection analysisPage-section websitePage-search hideInCompared");
                    string toprefersite = Utils.getBetween(topsitereferrral, "Top Referring Sites", "Top Destination Sites:");
                    string[] reqdataarr = Regex.Split(toprefersite, "class=\"websitePage-listItemLink");

                    foreach (var item in reqdataarr)
                    {


                        if (item.Contains("\"Internal Link\""))
                        {

                            string topsitename = Utils.getBetween(item, "\">", "</a>");
                            toprefersitedata = topsitename + "," + toprefersitedata;
                        }
                    }

                    string topdestinationsite = Utils.getBetween(topsitereferrral, "Top Destination Sites", "websitePage-blueButton websitePage-sectionButton referrals-hookButton js-proPopup");

                    string[] topdestiantion = Regex.Split(topdestinationsite, "websitePage-listItemLink js-tooltipTarget");


                    foreach (var item_site in topdestiantion)
                    {

                        if (item_site.Contains("\"Internal Link\""))
                        {
                            string topdetsianton = Utils.getBetween(item_site, "\">", "</a>");
                            topdestiantionsites = topdetsianton + "," + topdestiantionsites;
                        }
                    }

                }
                if (pagesource.Contains("searchPie-text searchPie-text--left"))
                {
                    string serchvalue = Utils.getBetween(pagesource, "searchPie-text searchPie-text--left", "searchKeywords-text searchKeywords-text--left websitePage-mobileFramed");
                    string organicsearch = Utils.getBetween(serchvalue, "<span class=\"searchPie-number\">", "</span>");
                    string paidserach = Utils.getBetween(serchvalue, "<div class=\"searchPie-text searchPie-text--right  \">", "/span>");
                    PaidSearch = Utils.getBetween(paidserach, "\">", "<");
                }

                if (pagesource.Contains("Organic Keywords"))
                {
                    string keyword = Utils.getBetween(pagesource, "Organic Keywords", "socialSection analysisPage-section websitePage-social hideInCompared");
                    string keywordvalue = Utils.getBetween(keyword, "searchKeywords-list", "websitePage-sectionButton u-button--wide js-proPopup");
                    string[] onganickeywordarry = Regex.Split(keywordvalue, "class='searchKeywords-words'");


                    foreach (var item in onganickeywordarry)
                    {
                        if (item.Contains("title=\""))
                        {
                            string valuekeyword = Utils.getBetween(item, "\">", "</span>");
                            organickeyword = valuekeyword + "," + organickeyword;
                        }
                    }

                    string paidvalue = Utils.getBetween(keyword, "websitePage-sectionButton u-button--wide js-proPopup", "social");
                    paidkeyword = Utils.getBetween(paidvalue, "search-noDataMessage\">", "</div>").Replace("\n", "");

                }


                if (pagesource.Contains("socialSection analysisPage-section websitePage-social hideInCompared"))
                {
                    string socialvalue = Utils.getBetween(pagesource, "socialSection analysisPage-section websitePage-social hideInCompared", "Display Advertising");
                    string[] socialsitesvalue = Regex.Split(socialvalue, "class=\"socialItem\"");

                    foreach (var item in socialsitesvalue)
                    {
                        if (item.Contains("Internal Link"))
                        {
                            string data = Utils.getBetween(item, "Internal Link\"", "/a>");
                            data = Utils.getBetween(data, "'>", "<");
                            socialsites = data + "," + socialsites;

                            string value = Utils.getBetween(item, "socialItem-value\">", "</div>");
                            sitesvalue = value + "," + sitesvalue;
                        }
                    }

                }

                if (pagesource.Contains("Display Advertising"))
                {
                    string displayvalue = Utils.getBetween(pagesource, "Display Advertising", "Audience Interests");
                    display = Utils.getBetween(displayvalue, "class=\"noData-title display\">", "</h2>");
                }
                if (pagesource.Contains("Audience Interests"))
                {
                    string audiencesvalue = Utils.getBetween(pagesource, "Audience Interests", "Also visited websites");
                    string[] audiencedata = Regex.Split(audiencesvalue, "audienceCategories-item fadeInLeft");

                    foreach (var item in audiencedata)
                    {
                        if (item.Contains("audienceCategories-chartContainer"))
                        {
                            string values = Utils.getBetween(item, "\"fillValue\":", "\"innerSize\"").Replace(",", "");
                            interestvalue = values + "," + interestvalue;

                            string intreset = Utils.getBetween(item, "audienceCategories-itemLink", "/a>");
                            intreset = Utils.getBetween(intreset, "\">", "<");
                            audienceinterest = intreset + "," + audienceinterest;
                        }
                    }
                }
                if (pagesource.Contains("Also visited websites"))
                {
                    string alsovisitedvalue = Utils.getBetween(pagesource, "Also visited websites", "Similar Sites");
                    string[] data = Regex.Split(alsovisitedvalue, "websitePage-listItemContainer");

                    foreach (var item in data)
                    {
                        if (item.Contains("Internal Link"))
                        {
                            string value = Utils.getBetween(item, "Internal Link", "/a>");
                            value = Utils.getBetween(value, "\">", "<");
                            visitedsites = value + "," + visitedsites;
                        }
                    }
                }
                if (pagesource.Contains("Similar Sites"))
                {
                    string SimilaSitesdata = Utils.getBetween(pagesource, "Similar Sites", "Related Mobile Apps");
                    string[] data = Regex.Split(SimilaSitesdata, "compareModal-row-cell-title");

                    foreach (var item in data)
                    {
                        if (item.Contains("data-url="))
                        {
                            string value = Utils.getBetween(item, "\">", "</span>");
                            similarwebsite = value + "," + similarwebsite;
                        }
                    }
                }
                if (pagesource.Contains("analysisPage-section websitePage-websiteMobileApps hideInCompared"))
                {
                    string RelatedMobilAppsdata = Utils.getBetween(pagesource, "analysisPage-section websitePage-websiteMobileApps hideInCompared", "Get More with SimilarWeb PRO");
                    string data = Utils.getBetween(RelatedMobilAppsdata, "Google Play Store", "App Store");
                    string[] dataarry = Regex.Split(data, "data-analytics-category=\"Internal Link\"");

                    foreach (var item in dataarry)
                    {
                        if (item.Contains("data-analytics-label="))
                        {
                            string valueimgaesrc = Utils.getBetween(item, "data-original=\"", "alt=\"").Replace("\"", "");
                            inmagesource = valueimgaesrc + "," + inmagesource;
                            string valueappname = Utils.getBetween(item, "itemprop=\"name\"", "/span>");
                            valueappname = Utils.getBetween(valueappname, ">", "<").Replace("\n", "").Trim();
                            appname = valueappname + "," + appname;

                        }
                    }

                    string appdatavlue = Utils.getBetween(RelatedMobilAppsdata, "App Store", "u-button--middle websitePage-pinkStrongButton websitePage-sectionButton js-proPopup");
                    string[] datavalue = Regex.Split(appdatavlue, "mobileApps-appList");

                    foreach (var item in datavalue)
                    {
                        if (item.Contains("data-options="))
                        {
                            string valueimgaesrc = Utils.getBetween(item, "data-original=\"", "alt=\"").Replace("\"", "");
                            inmagesourceapp = valueimgaesrc + "," + inmagesourceapp;
                            string valueappname = Utils.getBetween(item, "itemprop=\"name\"", "/span>");
                            valueappname = Utils.getBetween(valueappname, ">", "<").Replace("\n", "").Trim();
                            appnameapp = valueappname + "," + appnameapp;
                        }

                    }
                }
                _WebSiteReviewData.Id = Guid.NewGuid();
                _WebSiteReviewData.imageurl = imageurl;
                _WebSiteReviewData.googleinmagesource = inmagesource;
                _WebSiteReviewData.inmagesourceapp = inmagesourceapp;
                _WebSiteReviewData.interestvalue = interestvalue;
                _WebSiteReviewData.MailTrafficeOnSite = MailTrafficeOnSite;
                _WebSiteReviewData.organickeyword = organickeyword;
                _WebSiteReviewData.paidkeyword = paidkeyword;
                _WebSiteReviewData.PaidSearch = PaidSearch;
                _WebSiteReviewData.ReferralTrafficOnSite = ReferralTrafficOnSite;
                _WebSiteReviewData.SearchTrafficeOnSite = SearchTrafficeOnSite;
                _WebSiteReviewData.similarwebsite = similarwebsite;
                _WebSiteReviewData.sitesvalue = sitesvalue;
                _WebSiteReviewData.socialsites = socialsites;
                _WebSiteReviewData.SocialTrafficeOnSite = socialsites;
                _WebSiteReviewData.textname = textname;
                _WebSiteReviewData.TimeOnSite = TimeOnSite;
                _WebSiteReviewData.topdestiantionsites = topdestiantionsites;
                _WebSiteReviewData.toprefersitedata = toprefersitedata;
                _WebSiteReviewData.visitedsites = visitedsites;
                _WebSiteReviewData.VisitersOnSite = VisitersOnSite;
                _WebSiteReviewData.WebSiteBounceRate = WebSiteBounceRate;
                _WebSiteReviewData.websitedescription = websitedescription;
                _WebSiteReviewData.websitename = url;
                _WebSiteReviewData.WebSitePageViewers = WebSitePageViewers;
                _WebSiteReviewData.googleappname = appname;
                _WebSiteReviewData.appnameapp = appnameapp;
                _WebSiteReviewData.audienceinterest = audienceinterest;
                _WebSiteReviewData.CategoryRank = CategoryRank;
                _WebSiteReviewData.CountryRank = CountryRank;
                _WebSiteReviewData.DirrectTrafficOnSite = DirrectTrafficOnSite;
                _WebSiteReviewData.display = display;
                _WebSiteReviewData.DisplayTrafficOnSite = DisplayTrafficOnSite;
                _WebSiteReviewData.GlobalRank = GlobalRank;
                _WebSiteReviewData.TrafficbyCountry = TrafficbyCountry;
                _WebSiteReviewData.relatedappimageurl = appleappimageurl;
                _WebSiteReviewData.relatedgoogleimageurl = googleappimageurl;
                _WebSiteReviewData.entrydate = DateTime.Now;
                try
                {
                    WebSiteReviewDataRpository.Add(_WebSiteReviewData);
                    return "Updated Sucessfully";
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                    logger.Error(ex.Message);
                    return "something went wrong";
                }
            
            
            }
        
        }
        public bool MultiPartImageUpload(ref GlobusHttpHelper httpHelper, string Username, string Password, string localImagePath, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword)
        {
            /////Login to FB

            ////string valueLSD = "name=" + "\"lsd\"";

            int intProxyPort = 80;

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

            if (!string.IsNullOrEmpty(proxyPort) && IdCheck.IsMatch(proxyPort))
            {
                intProxyPort = int.Parse(proxyPort);
            }
            //string pageSource = string.Empty;
            //try
            //{
            //    pageSource = getHtmlfromUrlProxy(new Uri("https://www.facebook.com/login.php"), proxyAddress, intProxyPort, proxyUsername, proxyPassword);
            //    //int startIndex = pageSource.IndexOf(valueLSD) + 18;
            //}
            //catch { }
            //string value = GlobusHttpHelper.GetParamValue(pageSource, "lsd");
            string ResponseLogin = string.Empty;
            try
            {
            //    ResponseLogin = postFormData(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + Username.Split('@')[0] + "%40" + Username.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "");

                ResponseLogin = httpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com"));
            }
            catch { }
            ///Setting Post Data Params...

            string userId = GlobusHttpHelper.Get_UserID(ResponseLogin);

            if (string.IsNullOrEmpty(userId) || userId == "0" || userId.Length < 3)
            {
                GlobusLogHelper.log.Info("Please Check The Account : " + Username);
                GlobusLogHelper.log.Debug("Please Check The Account : " + Username);

                return false;
            }

            string pgSrc_Profile = string.Empty;
            try
            {
                pgSrc_Profile = httpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/profile.php?id=" + userId + ""));
            }
            catch { }
            string profileSource = string.Empty;
            try
            {
                profileSource = httpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/ajax/timeline/profile_pic_selector.php?profile_id=" + userId + "&__a=1&__user="******""));
            }
            catch { }


            //GlobusHttpHelper httpHelper = new GlobusHttpHelper();
            /////Get User ID
            //ProfileIDExtractor idExtracter = new ProfileIDExtractor();
            //idExtracter.ExtractFriendIDs(ref httpHelper, ref userId);


            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 last_action_id = GlobusHttpHelper.ParseJson(pgSrc_Profile, "last_action_id");

            if (!Utils.IsNumeric(last_action_id))
            {
                last_action_id = "0";
            }

            string postData = "last_action_id=" + last_action_id + "&fb_dtsg=" + fb_dtsg + "&__user="******"&phstamp=165816810252768712174";
            string res = string.Empty;
            try
            {
                res = httpHelper.postFormData(new Uri("https://www.facebook.com/ajax/mercury/thread_sync.php?__a=1"), postData);
            }
            catch { }
            NameValueCollection nvc = new NameValueCollection();
            //nvc.Add("post_form_id", post_form_id);
            nvc.Add("fb_dtsg", fb_dtsg);
            nvc.Add("id", userId);
            nvc.Add("type", "profile");
            //nvc.Add("return", "/ajax/profile/picture/upload_iframe.php?pic_type=1&id=" + userId);
            nvc.Add("return", "/ajax/timeline/profile_pic_upload.php?pic_type=1&id=" + userId);

            //UploadFilesToRemoteUrl("http://upload.facebook.com/pic_upload.php ", new string[] { @"C:\Users\Globus-n2\Desktop\Windows Photo Viewer Wallpaper.jpg" }, "", nvc);
            //HttpUploadFile("http://upload.facebook.com/pic_upload.php ", localImagePath, "file", "image/jpeg", nvc);
            if (HttpUploadFile("https://upload.facebook.com/pic_upload.php ", localImagePath, "pic", "image/jpeg", nvc, proxyAddress, intProxyPort, proxyUsername, proxyPassword))
            //if (HttpUploadFile("http://upload.facebook.com/pic_upload.php ", localImagePath, "file", "image/jpeg", nvc, proxyAddress, intProxyPort, proxyUsername, proxyPassword))
            {
                return true;
            }
            return false;

        }
Ejemplo n.º 9
0
        public bool SetProfilePic(ref GlobusHttpHelper HttpHelper, string profileId, string Username, string Password, string localImagePath, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, ref string status, string UploadInfoData)
        {
            string FirstGetREsponse = string.Empty;
            try
            {
                FirstGetREsponse = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/profile/edit-picture-info?trk=prof-ovw-edit-photo"));
            }
            catch { }
            if (string.IsNullOrEmpty(FirstGetREsponse))
            {
                try
                {
                    FirstGetREsponse = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/profile/edit-picture-info?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&trk=prof-ovw-edit-photo"));
                }
                catch { }
            }
            string[] upload_infoArr = Regex.Split(FirstGetREsponse, " name=\"upload_info");
            string upload_infow = string.Empty;
            string upload_infowithjs = string.Empty;
            if (true)
            {
                try
                {
                    upload_infow = upload_infoArr[1].Substring(upload_infoArr[1].IndexOf("value="), upload_infoArr[1].IndexOf(">") - upload_infoArr[1].IndexOf("value=")).Replace("value=", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Replace("/", string.Empty).Trim();
                }
                catch { }
                try
                {
                    upload_infowithjs = upload_infoArr[2].Substring(upload_infoArr[2].IndexOf("value="), upload_infoArr[2].IndexOf(">") - upload_infoArr[2].IndexOf("value=")).Replace("value=", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Replace("/", string.Empty).Trim();
                }
                catch { }
            }
            else
            {
                //try
                //{
                //    string[] upload_infoArr1 = Regex.Split(FirstGetREsponse, "id\":\"upload_info");
                //    upload_infow = upload_infoArr1[1].Substring(upload_infoArr1[1].IndexOf("value\":"), upload_infoArr1[1].IndexOf("type") - upload_infoArr1[1].IndexOf("value\":")).Replace("value\":", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Replace(",", string.Empty).Trim();
                //}
                //catch { }
            }
            string posturi = string.Empty;
            if (FirstGetREsponse.Contains("name=\"uploadMemberPicture"))
            {
                try
                {
                    string[] MemberPicture = Regex.Split(FirstGetREsponse, "name=\"uploadMemberPicture");
                    posturi = MemberPicture[1].Substring(MemberPicture[1].IndexOf("action="), MemberPicture[1].IndexOf("method=") - MemberPicture[1].IndexOf("action=")).Replace("action=", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Replace("/", string.Empty).Trim();
                }
                catch { }
            }

            bool isSetProfilePic = false;
            try
            {

                string upload_info = "";
                upload_info = upload_infow;

                string upload_info_with_js = "";
                upload_info_with_js = upload_infowithjs;

                //upload_info = upload_info.Replace("&dsh;", "-"); ;
                //upload_info_with_js = upload_info;

                string callback = "";
                callback = "profilePicture.processResponse";
                NameValueCollection nvc = new NameValueCollection();

                nvc.Add("upload_info", upload_info_with_js);
                nvc.Add("upload_info_with_js", upload_info_with_js);
                nvc.Add("callback", callback);
                //nvc.Add("Content-Type:", "image/jpeg");
                posturi = posturi.Replace("mupld", string.Empty);
                //string response = HttpHelper.HttpUploadProfilePic(ref HttpHelper, profileId, "http://www.linkedin.com/mupld/" + posturi, "pic", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword);
                string response = string.Empty;
                try
                {
                    response = HttpHelper.HttpUploadProfilePic(ref HttpHelper, profileId, "http://www.linkedin.com/mupld/upload", "pic", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword);
                }
                catch { }
                if (string.IsNullOrEmpty(response))
                {
                    response = HttpHelper.HttpUploadProfilePic(ref HttpHelper, profileId, "https://www.linkedin.com/mupld/upload?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1", "pic", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword);
                    //http://www.linkedin.com/mupld/process?filter=car450&return_type=html&mid=%2Fp/6/005/025/1b7/34bf4a0.jpg&callback=profilePicture.savePhoto&filters_scale_h=397&filters_scale_w=600&filters_crop_x=101&filters_crop_y=0&filters_crop_h=396.99966&filters_crop_w=396.99966&filters_rotate_t=
                }
                string Images1 = string.Empty;
                if (response.Contains("SUCCESS"))
                {
                    try
                    {
                        Images1 = response.Substring(response.IndexOf("value\":"), response.IndexOf("}") - response.IndexOf("value\":")).Replace("value\":", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Trim();
                        Images1 = Images1.Substring(1, (Images1.Length - 1));
                        Images1 = Images1.Remove(Images1.IndexOf(","));
                        Images1 = "/" + Images1;
                    }
                    catch { }
                }
                string csrfToken = string.Empty;
                string sourceAlias = string.Empty;
                if (FirstGetREsponse.Contains("csrfToken"))
                {
                    try
                    {
                        int startindex = FirstGetREsponse.IndexOf("csrfToken");
                        if (startindex > 0)
                        {
                            string start = FirstGetREsponse.Substring(startindex);
                            int endindex = start.IndexOf("\">");
                            string end = start.Substring(0, endindex);
                            csrfToken = end.Replace("csrfToken=", "").Replace("\\", "");
                        }
                        else
                        {
                            string[] Arr = csrfToken.Split('"');
                            csrfToken = Arr[2].Replace("\\", string.Empty);
                        }
                    }
                    catch
                    {
                        try
                        {
                            csrfToken = FirstGetREsponse.Substring(FirstGetREsponse.IndexOf("csrfToken"), 100);
                            if (csrfToken.Contains("&"))
                            {
                                string[] Arr = csrfToken.Split('&');
                                csrfToken = Arr[0];
                            }
                            else if (csrfToken.Contains(","))
                            {
                                string[] Arr = csrfToken.Split(',');
                                csrfToken = Arr[0].Replace("\\", string.Empty);
                            }
                            else
                            {
                                string[] Arr = csrfToken.Split(',');
                                csrfToken = Arr[0].Replace("\\", string.Empty).Replace("csrfToken=", "").Replace("\n", "").Replace("\">", "");
                            }

                        }
                        catch { }

                    }

                }
                if (FirstGetREsponse.Contains("sourceAlias"))
                {
                    try
                    {
                        sourceAlias = FirstGetREsponse.Substring(FirstGetREsponse.IndexOf("sourceAlias"), 100);
                        string[] Arr = sourceAlias.Split('"');
                        sourceAlias = Arr[2].Replace("\\", string.Empty);
                    }
                    catch { }
                }
                if (string.IsNullOrEmpty(sourceAlias))
                {
                    if (FirstGetREsponse.Contains("sourceAlias"))
                    {
                        try
                        {
                            sourceAlias = FirstGetREsponse.Substring(FirstGetREsponse.IndexOf("sourceAlias"), 100);
                            string[] Arr = sourceAlias.Split('"');
                            sourceAlias = Arr[2];
                        }
                        catch { }
                    }

                }
                string Images = string.Empty;
                string FirstGet = string.Empty;
                string setMaskWidth = string.Empty;
                string setMaskHeight = string.Empty;
                string setMaskTop = string.Empty;
                string setMaskLeft = string.Empty;
                string setCropFilter = string.Empty;

                if (FirstGetREsponse.Contains("profilePicture.setMaskWidth"))
                {
                    try
                    {
                        string[] setMaskWidthArr = Regex.Split(FirstGetREsponse, "profilePicture.setMaskWidth");
                        Match match = Regex.Match(setMaskWidthArr[1], @"\((.*?)\)");
                        if (match.Groups.Count > 1)
                        {
                            setMaskWidth = match.Groups[1].Value;
                        }
                    }
                    catch { }
                }
                if (FirstGetREsponse.Contains("profilePicture.setMaskHeight"))
                {
                    try
                    {
                        string[] setMaskHeightArr = Regex.Split(FirstGetREsponse, "profilePicture.setMaskHeight");
                        Match match = Regex.Match(setMaskHeightArr[1], @"\((.*?)\)");
                        if (match.Groups.Count > 1)
                        {
                            setMaskHeight = match.Groups[1].Value;
                        }
                    }
                    catch { }
                }

                if (FirstGetREsponse.Contains("profilePicture.setMaskTop"))
                {
                    try
                    {
                        string[] setMaskTopArr = Regex.Split(FirstGetREsponse, "profilePicture.setMaskTop");
                        Match match = Regex.Match(setMaskTopArr[1], @"\((.*?)\)");
                        if (match.Groups.Count > 1)
                        {
                            setMaskTop = match.Groups[1].Value;
                        }
                    }
                    catch { }
                }
                if (FirstGetREsponse.Contains("profilePicture.setMaskLeft"))
                {
                    try
                    {
                        string[] setMaskLeftArr = Regex.Split(FirstGetREsponse, "profilePicture.setMaskLeft");
                        Match match = Regex.Match(setMaskLeftArr[1], @"\((.*?)\)");
                        if (match.Groups.Count > 1)
                        {
                            setMaskLeft = match.Groups[1].Value;
                        }
                    }
                    catch { }
                }
                if (FirstGetREsponse.Contains("profilePicture.setCropFilter"))
                {
                    try
                    {
                        string[] setCropFilterArr = Regex.Split(FirstGetREsponse, "profilePicture.setCropFilter");
                        Match match = Regex.Match(setCropFilterArr[1], @"\((.*?)\)");
                        if (match.Groups.Count > 1)
                        {
                            setCropFilter = match.Groups[1].Value;
                        }
                    }
                    catch { }
                }
                //profilePicture.setCropFilter

                try
                {
                    // string FirstGet = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/mupld/process?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&filter=car80&return_type=html&mid=%2Fp"+Images1+"&callback=profilePicture.savePhoto&filters_scale_h=80&filters_scale_w=335&filters_crop_x=0&filters_crop_y=0&filters_crop_h=335&filters_crop_w=335&filters_rotate_t="));
                    // string FirstGet = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/mupld/process?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&filter=car80&return_type=html&mid=%2F" + Images1 + "&callback=profilePicture.savePhoto&filters_scale_h=80&filters_scale_w=346&filters_crop_x=0&filters_crop_y=0&filters_crop_h=346&filters_crop_w=346&filters_rotate_t="));

                    #region Setting Image Parameters

                    float w = 200, h = 200;
                    try
                    {
                        //GetJpegDimension(localImagePath, out h, out w);
                        System.Drawing.Size sz = ImageHelper.GetDimensions(localImagePath);

                        w = sz.Width;
                        h = sz.Height;
                    }
                    catch { }

                    float filters_scale_h = RandomNumberGenerator.GenerateRandom(187, 187);
                    float filters_scale_w = RandomNumberGenerator.GenerateRandom(187, 187);

                    int filters_crop_h = RandomNumberGenerator.GenerateRandom(187, 187);
                    int filters_crop_w = filters_crop_h;

                    if (w >= 3000)
                    {
                        w = 3000;
                    }
                    if (h >= 800)
                    {
                        h = 800;
                    }

                    float heightwidthratio = h / w;

                    filters_scale_w = w;
                    filters_scale_h = w * heightwidthratio;

                    if (filters_scale_w < filters_scale_h)
                    {
                        filters_crop_w = (int)filters_scale_w;
                    }
                    else
                    {
                        filters_crop_w = (int)filters_scale_h - 5;
                    }
                    if (filters_crop_w > 350)
                    {
                        filters_crop_w = RandomNumberGenerator.GenerateRandom(187,187);
                    }

                    #endregion

                    //if (string.IsNullOrEmpty(setMaskHeight))
                    {
                        try
                        {
                           FirstGet = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/mupld/process?filter=" + "car450" + "&return_type=html&mid=" + Images1 + "&callback=profilePicture.savePhoto&filters_scale_h=" + (int)filters_scale_h + "&filters_scale_w=" + (int)filters_scale_w + "&filters_crop_x=0&filters_crop_y=0&filters_crop_h=" + filters_scale_h + "&filters_crop_w=" + filters_scale_h + "&filters_rotate_t="));//filters_crop_h=135&filters_crop_w=135&filters_rotate_t="));

                            if (string.IsNullOrEmpty(FirstGet))
                            {
                                System.Threading.Thread.Sleep(500);
                                FirstGet = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/mupld/process?filter=" + "car450" + "&return_type=html&mid=" + Images1 + "&callback=profilePicture.savePhoto&filters_scale_h=" + (int)filters_scale_h + "&filters_scale_w=" + (int)filters_scale_w + "&filters_crop_x=0&filters_crop_y=0&filters_crop_h=" + filters_crop_w + "&filters_crop_w=" + filters_crop_w + "&filters_rotate_t="));//filters_crop_h=135&filters_crop_w=135&filters_rotate_t="));
                            }
                            //FirstGet = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/mupld/process?filter=" + "car450" + "&return_type=html&mid=" + Images1 + "&callback=profilePicture.savePhoto&filters_scale_h=" + 180 + "&filters_scale_w=" + 180 + "&filters_crop_x=0&filters_crop_y=0&filters_crop_h=" + 145 + "&filters_crop_w=" + 145 + "&filters_rotate_t="));//filters_crop_h=135&filters_crop_w=135&filters_rotate_t="));

                            string mid = "";

                            if (FirstGet.Contains("SUCCESS"))
                            {

                                try
                                {
                                    mid = FirstGet.Substring(FirstGet.IndexOf("value\":"), FirstGet.IndexOf("}") - FirstGet.IndexOf("value\":")).Replace("value\":", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Trim();
                                    mid = mid.Substring(1, (mid.Length - 1));
                                    //mid = mid.Remove(mid.IndexOf(","));
                                    mid = "/" + mid;
                                    // Images = Uri.EscapeDataString(Images);
                                }
                                catch { }
                            }

                            string gup_savecroppic = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/profile/save-crop-picture?csrfToken=" + csrfToken + "&masterTempID=" + Images1 + "&croppedTempID=" + mid + "&xParam=0&yParam=0&xSizeParam=" + filters_crop_w + "&ySizeParam=" + filters_crop_w + "&nsave=n"));//xSizeParam=292&ySizeParam=292&nsave=n"));
                            //string gup_savecroppic = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/profile/save-crop-picture?csrfToken=" + csrfToken + "&masterTempID=" + Images1 + "&croppedTempID=" + mid + "&xParam=0&yParam=0&xSizeParam=" + 135 + "&ySizeParam=" + 135 + "&nsave=n"));//xSizeParam=292&ySizeParam=292&nsave=n"));

                            //http://www.linkedin.com/profile/edit-picture-info?trk=nprofile-save-picture-submit&report%2Esuccess=9dCbijuoBwCwpKulrwnkugn6gmZHePJOoeK5jlW7JYSHYSSp-w55jdor_TR6umL
                        }
                        catch { }

                        #region Old code
                        //if (string.IsNullOrEmpty(FirstGet))
                        //{
                        //    try
                        //    {
                        //        FirstGet = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/mupld/process?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&filter=car80&return_type=html&mid=%2F" + Images1 + "&callback=profilePicture.savePhoto&filters_scale_h=80&filters_scale_w=80&filters_crop_x=0&filters_crop_y=0&filters_crop_h=335&filters_crop_w=335&filters_rotate_t="));
                        //    }
                        //    catch { }
                        //}
                        //if (FirstGet.Contains("SUCCESS"))
                        //{
                        //    try
                        //    {
                        //        Images = FirstGet.Substring(FirstGet.IndexOf("value\":"), FirstGet.IndexOf("}") - FirstGet.IndexOf("value\":")).Replace("value\":", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Trim();
                        //        Images = Images.Substring(1, (Images.Length - 1));
                        //        // Images = Uri.EscapeDataString(Images);
                        //    }
                        //    catch { }
                        //}
                        #endregion

                    }
                    #region Old Code
                    //else
                    //{
                    //    try
                    //    {
                    //        FirstGet = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/mupld/process?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&filter=" + setCropFilter + "&return_type=html&mid=%2F" + Images1 + "&callback=profilePicture.savePhoto&filters_scale_h=" + setMaskHeight + "&filters_scale_w=" + setMaskWidth + "&filters_crop_x=" + setMaskLeft + "&filters_crop_y=" + setMaskTop + "&filters_crop_h=" + setMaskHeight + "&filters_crop_w=" + setMaskWidth + "&filters_rotate_t="));
                    //    }
                    //    catch { }
                    //    if (string.IsNullOrEmpty(FirstGet))
                    //    {
                    //        FirstGet = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/mupld/process?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&filter=" + setCropFilter + "&return_type=html&mid=%2F" + Images1 + "&callback=profilePicture.savePhoto&filters_scale_h=80&filters_scale_w=80&filters_crop_x=" + setMaskLeft + "&filters_crop_y=" + setMaskTop + "&filters_crop_h=" + setMaskHeight + "&filters_crop_w=" + setMaskWidth + "&filters_rotate_t="));

                    //    }
                    //    if (FirstGet.Contains("SUCCESS"))
                    //    {
                    //        try
                    //        {
                    //            Images = FirstGet.Substring(FirstGet.IndexOf("value\":"), FirstGet.IndexOf("}") - FirstGet.IndexOf("value\":")).Replace("value\":", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Trim();
                    //            Images = Images.Substring(1, (Images.Length - 1));
                    //            // Images = Uri.EscapeDataString(Images);
                    //        }
                    //        catch { }
                    //    }
                    //    if (string.IsNullOrEmpty(FirstGet))
                    //    {
                    //        try
                    //        {
                    //            FirstGet = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/mupld/process?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&filter=car80&return_type=html&mid=%2F" + Images1 + "&callback=profilePicture.savePhoto&filters_scale_h=80&filters_scale_w=80&filters_crop_x=0&filters_crop_y=0&filters_crop_h=335&filters_crop_w=335&filters_rotate_t="));
                    //        }
                    //        catch { }
                    //    }
                    //}
                    #endregion
                }
                catch { }

                #region Old code
                //string thirdresponse = string.Empty;
                //try
                //{
                //    string secondGetResponsee = string.Empty;
                //    try
                //    {
                //        secondGetResponsee = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/profile/save-crop-picture?csrfToken=" + csrfToken + "&masterTempID=%2F" + Images + "&croppedTempID=%2F" + Images1 + "&xParam=0&yParam=0&xSizeParam=80&ySizeParam=80&nsave=n"));
                //    }
                //    catch { }

                //    if (secondGetResponsee.Contains("name=\"currenturl"))
                //    {
                //        try
                //        {
                //            string[] currenturlArr = Regex.Split(secondGetResponsee, "name=\"currenturl");
                //            string currenturl = currenturlArr[1].Substring(currenturlArr[1].IndexOf("value=\""), currenturlArr[1].IndexOf(">") - currenturlArr[1].IndexOf("value=\"")).Replace("value=\"", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Trim();
                //            currenturl = Uri.UnescapeDataString(currenturl);
                //            currenturl = Regex.Split(currenturl, "&urlhash")[0];
                //            // string thirdresponse = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/profile/edit-picture-info?trk=nprofile-save-picture-submit&report%2Esuccess=9dCbijuoBwCwpKulrwnkugn6gmZHePJOoeK5jlW7JYSHYSSp-w55jdor_TR6umL"));
                //             thirdresponse = HttpHelper.getHtmlfromUrl(new Uri(currenturl));
                //        }
                //        catch { }
                //    }
                //}
                //catch { }

                //try
                //{
                //    string postSavePictureData = "pictureVisibility=NETWORK&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias + "&goback=.npv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1.npe_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1";
                //    string PostSavePictureUrl = "http://www.linkedin.com/profile/edit-picture-visibility-submit";
                //    string responsess = HttpHelper.postFormData(new Uri(PostSavePictureUrl), postSavePictureData);

                //    string GetResponse=HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/profile/edit?goback=%2Enpv_"+profileId+"_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1%2Enpe_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1&trk=nprofile-save-picture-settings-submit&report%2Esuccess=88GfZh25oYpGMv_ncXhqwkk2axsD1cOiNrQErX7HNxy7raoMejQEhfBsYJTYoZpJLJh9oM"));
                //}
                //catch { }

                //try
                //{
                //    //string secondpostUrl="https://www.linkedin.com/mupld/upload?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1%2Enpe_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1";
                //    //string posturl = "pkey=PAGEKEY_PLACEHOLDER&tcode=ntf_click_notifications_icon&plist=alert_count%3A0&prefix=false";
                //    //string secondres=HttpHelper.postFormData(new Uri(secondpostUrl), posturl);
                //}
                //catch { }
                ////name="sourceAlias"
                #endregion

                if (!string.IsNullOrEmpty(FirstGet) && !string.IsNullOrEmpty(response))
                {
                    if (FirstGet.Contains("SUCCESS") && response.Contains("SUCCESS")) // && !thirdresponse.Contains("error") && !string.IsNullOrEmpty(response) && !response.Contains("error"))
                    {
                        isSetProfilePic = true;
                    }
                    if (!string.IsNullOrEmpty(response) && !response.Contains("error"))
                    {

                    }
                }
                else
                {
                    return isSetProfilePic;
                }
            }
            catch
            {
            }
            return isSetProfilePic;
        }
        public List<string> ExtractFriendIDs_URLSpecific(ref GlobusHttpHelper HttpHelper, ref string userID, string specificURL, ref List<string> lstFriend_Suggestions)
        {
            try
            {
                string pgSrc_HomePage = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/"));
                string ProFileURL = string.Empty;

                string UserId = string.Empty;

                #region Get User or Account ID
                if (pgSrc_HomePage.Contains("http://www.facebook.com/profile.php?id="))
                {
                    ///Modified Sumit [10-12-2011]
                    #region

                    int startIndx = pgSrc_HomePage.IndexOf("http://www.facebook.com/profile.php?id=");
                    int endIndx = pgSrc_HomePage.IndexOf("\"", startIndx + 1);
                    ProFileURL = pgSrc_HomePage.Substring(startIndx, endIndx - startIndx);
                    if (ProFileURL.Contains("&"))
                    {
                        string[] Arr = ProFileURL.Split('&');
                        ProFileURL = Arr[0];
                    }

                    #endregion
                }
                if (ProFileURL.Contains("http://www.facebook.com/profile.php?id="))
                {
                    UserId = ProFileURL.Replace("http://www.facebook.com/profile.php?id=", "");
                    if (UserId.Contains("&"))
                    {
                        UserId = UserId.Remove(UserId.IndexOf("&"));
                    }
                    //userID = UserId;
                }
                #endregion

                List<string> lstFriend_Requests = new List<string>();
                //List<string> lstFriend_Suggestions = new List<string>();

                string pgSrc_FriendsPage = HttpHelper.getHtmlfromUrl(new Uri(specificURL));

                ChilkatHttpHelpr chilkatHelpr = new ChilkatHttpHelpr();

                //List<string> aTags = chilkatHelpr.GetDataTag(pgSrc_FriendsPage, "a");

                //List<string> spanTags = chilkatHelpr.GetDataTag(pgSrc_FriendsPage, "span");

                List<string> requestProfileURLs_FR_Requests = chilkatHelpr.GetHrefsByTagAndAttributeName(pgSrc_FriendsPage, "span", "title fsl fwb fcb");
                lstFriend_Requests.AddRange(requestProfileURLs_FR_Requests);

                List<string> requestProfileURLs_FR_Suggestions = chilkatHelpr.GetElementsbyTagAndAttributeName(pgSrc_FriendsPage, "div", "title fsl fwb fcb", "id");
                lstFriend_Suggestions.AddRange(requestProfileURLs_FR_Suggestions);

                #region Old Code

                //if (pgSrc_FriendsPage.Contains("http://www.facebook.com/profile.php?id="))
                //{
                //    string[] arr = Regex.Split(pgSrc_FriendsPage, "href");
                //    foreach (string strhref in arr)
                //    {
                //        if (!strhref.Contains("<!DOCTYPE"))
                //        {
                //            if (strhref.Contains("profile.php?id"))
                //            {
                //                int startIndx = strhref.IndexOf("profile.php?id") + "profile.php?id".Length + 1;
                //                int endIndx = strhref.IndexOf("\"", startIndx);

                //                string profileID = strhref.Substring(startIndx, endIndx - startIndx);

                //                if (profileID.Contains("&"))
                //                {
                //                    profileID = profileID.Remove(profileID.IndexOf("&"));
                //                }
                //                if (profileID.Contains("\\"))
                //                {
                //                    profileID = profileID.Replace("\\", "");
                //                }
                //                lstFriend.Add(profileID);
                //            }
                //        }
                //    }
                //} 
                #endregion
                List<string> itemId = lstFriend_Requests.Distinct().ToList();
                return itemId;
            }
            catch (Exception)
            {
                return null;
            }
        }
 public string ExtractIDOfNonTimeLine(string URL, ref GlobusHttpHelper HttpHelper)
 {
     string id = "";
     try
     {
         string strURLPageSource = HttpHelper.getHtmlfromUrl(new Uri(URL));
         if (strURLPageSource.Contains("profile-picture-overlay"))
         {
             string[] arrprofile_picture_overlay = Regex.Split(strURLPageSource, "profile-picture-overlay");
             if (arrprofile_picture_overlay.Count() > 1)
             {
                 if (arrprofile_picture_overlay[1].Contains("?set="))
                 {
                     string strid = arrprofile_picture_overlay[1].Substring(arrprofile_picture_overlay[1].IndexOf("?set="), (arrprofile_picture_overlay[1].IndexOf("&amp", arrprofile_picture_overlay[1].IndexOf("?set=")) - arrprofile_picture_overlay[1].IndexOf("?set="))).Replace("?set=", string.Empty).Replace(".", "/").Trim();
                     string[] arrId = Regex.Split(strid, "/");
                     id = arrId.Last();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
     }
     return id;
 }
Ejemplo n.º 12
0
        public Dictionary<string, string> AddSpecificGroupUser(ref GlobusHttpHelper HttpHelper, string UserID, 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;
            #endregion

            try
            {
                GroupSpecMem.Clear();
                GroupName = gid.Split(':')[0];

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

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

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

                    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]));
                            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 (!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("http://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] + "", "", "");

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

                        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] + "";
                                pageSource = HttpHelper.getHtmlfromUrl(new Uri(getdata));
                            }

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

                            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;
                                }
                            }
                        }
                        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;
                                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;
                                }
                            }
                        }
                    }
                    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(':')[2] + "&page=" + i));

                        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");
                                    Log("[ " + DateTime.Now + " ] => [ " + FrnAcceptUrL + " ]");

                                    string stringSource = HttpHelper.getHtmlfromUrl1(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.getHtmlfromUrl1(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.getHtmlfromUrl1(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 = UserID;

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

                                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) + "," + endName + "," + DeegreeConn.Replace(",", string.Empty);
                                    AddingLinkedInDataToCSVFile1(item);
                                    if (WithGroupSearch == true)
                                    {
                                        Loggergrppmem("[ " + DateTime.Now + " ] => [ Added Group Member : " + endName + " (" + DeegreeConn + ") with Search keyword : " + SearchKeyword + " ]");
                                    }
                                    else
                                    {
                                        Loggergrppmem("[ " + DateTime.Now + " ] => [ Added Group Member : " + endName + " ]");
                                    }
                                }
                                catch { }
                            }
                            else
                            {

                            }
                        }
                        catch { }
                    }

                }
                return GroupSpecMem;
            }
            catch { }
            return GroupSpecMem;
        }
Ejemplo n.º 13
0
        public bool CrawlingLinkedInPage(string Url, ref GlobusHttpHelper HttpHelper,string FileName)
        {
            //Url = "http://www.linkedin.com/profile/view?id=44952194&authType=OUT_OF_NETWORK&authToken=DYBR&locale=en_US&srchid=3817933251416230963594&srchindex=2&srchtotal=1949&trk=vsrp_people_res_name&trkInfo=VSRPsearchId%3A3817933251416230963594%2CVSRPtargetId%3A44952194%2CVSRPcmpt%3Aprimary";

            #region Data Initialization
            string GroupMemId = 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 CurrentCompUrl = string.Empty;
            string CurrentCompSite = string.Empty;
            string titlepast1 = string.Empty;
            string companypast1 = string.Empty;
            string titlepast2 = string.Empty;
            string html = 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 DeegreeConn = string.Empty;
            string AccountType = string.Empty;
            bool CheckEmployeeScraper = false;
            string fileName = string.Empty;
            bool CampaignScraper = false;
            #endregion

            #region GetRequest
            if (Url.Contains("CompanyEmployeeScraper"))
            {
                try
                {
                    Url = Url.Replace("CompanyEmployeeScraper", string.Empty);
                    CheckEmployeeScraper = true;
                }
                catch
                { }
            }

            if (Url.Contains("CampaignScraper"))
            {
                try
                {
                    string[] Url_Split = Regex.Split(Url, "CampaignScraper");
                    Url = Url_Split[0];
                    fileName = Url_Split[1];
                    CampaignScraper = true;
                }
                catch
                { }
            }

            string stringSource = HttpHelper.getHtmlfromUrl(new Uri(Url.Replace("http", "https")));
            #endregion

            #region GroupMemId
            try
            {
                string[] gid = Url.Split('&');
                GroupMemId = gid[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("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 { }
                }

                if (string.IsNullOrEmpty(strFamilyName))
                {
                    try
                    {
                        strFamilyName = stringSource.Substring(stringSource.IndexOf("<span class=\"full-name\">"), (stringSource.IndexOf("</span><span></span></span></h1></div></div><div id=\"headline-container\" data-li-template=\"headline\">", stringSource.IndexOf("</span><span></span></span></h1></div></div><div id=\"headline-container\" data-li-template=\"headline\">")) - stringSource.IndexOf("<span class=\"full-name\">"))).Replace("<span class=\"full-name\">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim();
                    }
                    catch
                    { }
                }

                if (string.IsNullOrEmpty(strFamilyName))
                {
                    try
                    {
                        int StartIndex = stringSource.IndexOf("profileFullName");
                        string Start = stringSource.Substring(StartIndex).Replace("profileFullName", string.Empty);
                        int EndIndex = Start.IndexOf("slideData");
                        string End = Start.Substring(0, EndIndex).Replace(":", string.Empty).Replace("'",string.Empty).Replace(",",string.Empty).Trim();
                        strFamilyName = End.Trim();
                    }
                    catch
                    { }
                }
            }
            catch { }

            if (string.IsNullOrEmpty(strFamilyName))
            {
                try
                {
                    int StartIndex = stringSource.IndexOf("</script><title>");
                    string Start = stringSource.Substring(StartIndex).Replace("</script><title>", string.Empty);
                    int EndIndex = Start.IndexOf("| LinkedIn</title>");
                    string End = Start.Substring(0, EndIndex).Replace(":", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Trim();
                    strFamilyName = End.Trim();
                }
                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];
            }
            catch { }

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

                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
            try
            {
                try
                {
                    try
                    {
                        //soft engg at TCSi18n__LocationLocationi18n__Linkedin_memberLinkedIn Member
                        //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("   ", string.Empty).Replace("visibletrue", string.Empty).Replace("isLNLedtrue",string.Empty).Replace("isPortfoliofalse",string.Empty).Replace("i18n__Location",string.Empty).Replace("Locationi18n__Linkedin_member",string.Empty).Replace("u002d","-").Replace("LinkedIn Member",string.Empty).Replace("--Location","--").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("   ", string.Empty).Replace("visibletrue", string.Empty).Replace("isLNLedtrue", string.Empty).Replace("isPortfoliofalse", string.Empty).Replace("i18n__Location", string.Empty).Replace("Locationi18n__Linkedin_member", string.Empty).Replace("u002d", "-").Replace("LinkedIn Member", string.Empty).Replace("--Location", "--").ToString().Trim();
                        if (Company.Contains("#Name?"))
                        {
                            Company = "--";
                        }
                        if (Company.Contains("i18n"))
                        {
                            Company = Regex.Split(Company, "i18n")[0];
                        }

                    }
                    catch
                    {
                    }

                    if (string.IsNullOrEmpty(Company))
                    {
                        try
                        {
                            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("visibletrue", string.Empty).Replace("&dsh;", "").Replace("&amp", "").Replace(";", "").Replace("isLNLedtrue", string.Empty).Replace("isPortfoliofalse", string.Empty).Trim();
                        }
                        catch { }

                    }

                    if (string.IsNullOrEmpty(Company))
                    {
                        try
                        {
                            Company = stringSource.Substring(stringSource.IndexOf("class=\"title \">"), (stringSource.IndexOf("</p></div></div><div class=\"demographic-info adr editable-item\" id=\"demographics\">", stringSource.IndexOf("</p></div></div><div class=\"demographic-info adr editable-item\" id=\"demographics\">")) - stringSource.IndexOf("class=\"title \">"))).Replace("class=\"title \">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace("<strong class=highlight>", string.Empty).Replace("</strong>", string.Empty).Trim();
                        }
                        catch { }
                    }

                    string[] strdesigandcompany = new string[4];
                    if (Company.Contains(" at "))
                    {
                        try
                        {
                            strdesigandcompany = Regex.Split(Company, " at ");
                        }
                        catch { }

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

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

                #region Current Company Site
                try
                {
                    try
                    {
                        CurrentCompUrl = stringSource.Substring(stringSource.IndexOf("/companies"), (stringSource.IndexOf("/companies", stringSource.IndexOf("?miniprofile")) - stringSource.IndexOf("?miniprofile"))).Replace("?miniprofi", string.Empty).ToString().Trim();
                        CurrentCompUrl = "https://www.linkedin.com" + CurrentCompUrl;
                    }
                    catch { }

                    string CompanyUrl = HttpHelper.getHtmlfromUrl1(new Uri(CurrentCompUrl));

                    try
                    {
                        CurrentCompSite = CompanyUrl.Substring(CompanyUrl.IndexOf("<dt>Website</dt>"), (CompanyUrl.IndexOf("</dd>", CompanyUrl.IndexOf("<dt>Website</dt>")) - CompanyUrl.IndexOf("<dt>Website</dt>"))).Replace("<dt>Website</dt>", string.Empty).Replace("<dd>", string.Empty).Trim();
                    }
                    catch { }

                    try
                    {
                        CurrentCompSite = CompanyUrl.Substring(CompanyUrl.IndexOf("<h4>Website</h4>"), (CompanyUrl.IndexOf("</p>", CompanyUrl.IndexOf("<h4>Website</h4>")) - CompanyUrl.IndexOf("<h4>Website</h4>"))).Replace("<h4>Website</h4>", string.Empty).Replace("<p>", string.Empty).Trim();

                        if (CurrentCompSite.Contains("a href="))
                        {
                            try
                            {
                                string[] websArr = Regex.Split(CurrentCompSite, ">");
                                CurrentCompSite = websArr[1].Replace("</a", string.Empty).Replace("\n", string.Empty).Trim(); ;
                            }
                            catch { }
                        }
                    }
                    catch { }
                }
                catch { }

                #endregion

                #region PastCompany
                string[] companylist = Regex.Split(stringSource, "companyName\"");
                if (companylist.Count() == 1)
                {
                    companylist = Regex.Split(stringSource, "company-name");
                }
                if (companylist.Count() == 1)
                {
                    //companylist = Regex.Split(stringSource, "Companies");
                }

                string AllComapny = string.Empty;

                string Companyname = string.Empty;
                if (!stringSource.Contains("company-name") && companylist.Count() > 1)
                {
                    foreach (string item in companylist)
                    {
                        try
                        {
                            if (!item.Contains("<!DOCTYPE html>"))
                            {
                                Companyname = item.Substring(item.IndexOf(":"), (item.IndexOf(",", item.IndexOf(":")) - item.IndexOf(":"))).Replace(":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("}", string.Empty).Replace("]", string.Empty).Trim();
                                string items = item;
                                checkerlst.Add(Companyname);
                                checkerlst = checkerlst.Distinct().ToList();
                            }
                        }
                        catch { }
                    }
                }
                else
                {
                    foreach (string item in companylist)
                    {
                        try
                        {
                            if (!item.Contains("<!DOCTYPE html>"))
                            {
                                Companyname = item.Substring(item.IndexOf(">"), (item.IndexOf("<", item.IndexOf(">")) - item.IndexOf(">"))).Replace(">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("}", string.Empty).Replace("]", string.Empty).Trim();
                                string items = item;
                                if (!string.IsNullOrEmpty(Companyname))
                                {
                                    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;", "&");
                    }
                }
                #endregion

            #endregion Company

                #region Company Descripription

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

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

                                if (startindex > 0)
                                {
                                    try
                                    {
                                        string start = item.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("&#x2022;", ";").Replace("<br>", string.Empty).Replace("\\n", string.Empty).Replace("\"u002", "-");
                                        LDS_BackGround_Summary = Current_Company;
                                    }
                                    catch { }
                                }

                            }

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

                                if (startindex > 0)
                                {
                                    try
                                    {
                                        string start = item.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("&#x2022;", string.Empty).Replace(":", string.Empty);
                                        LDS_BackGround_Summary = Current_Company;
                                    }
                                    catch { }
                                }

                            }

                        }
                        catch { }
                    }

                    if (string.IsNullOrEmpty(LDS_BackGround_Summary))
                    {
                        try
                        {
                            LDS_BackGround_Summary = HttpHelper.GetDataWithTagValueByTagAndAttributeNameWithId(stringSource, "div", "summary-item-view");
                            LDS_BackGround_Summary = Regex.Replace(LDS_BackGround_Summary, "<.*?>", string.Empty).Replace(",", "").Replace("\n", "").Replace("<![CDATA[", "").Trim();
                        }
                        catch { }
                    }
                }
                catch { }

                #endregion

                #region Education
                try
                {
                    string[] str_UniversityName = Regex.Split(stringSource, "link__school_name");
                    foreach (string item in str_UniversityName)
                    {
                        try
                        {
                            string School = string.Empty;
                            string Degree = string.Empty;
                            string SessionEnd = string.Empty;
                            string SessionStart = string.Empty;
                            string Education = string.Empty;
                            if (stringSource.Contains("link__school_name"))
                            {
                                if (!item.Contains("<!DOCTYPE html>"))
                                {
                                    try
                                    {
                                        try
                                        {
                                            int startindex = item.IndexOf("fmt__school_highlight");
                                            string start = item.Substring(startindex).Replace("fmt__school_highlight", "");
                                            int endindex = start.IndexOf(",");
                                            School = start.Substring(0, endindex).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("_highlight", string.Empty);
                                        }
                                        catch { }

                                        try
                                        {
                                            int startindex1 = item.IndexOf("degree");
                                            string start1 = item.Substring(startindex1).Replace("degree", "");
                                            int endindex1 = start1.IndexOf(",");
                                            Degree = start1.Substring(0, endindex1).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("_highlight", string.Empty);
                                        }
                                        catch { }

                                        try
                                        {
                                            int startindex2 = item.IndexOf("enddate_my");
                                            string start2 = item.Substring(startindex2).Replace("enddate_my", "");
                                            int endindex2 = start2.IndexOf(",");
                                            SessionEnd = start2.Substring(0, endindex2).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("_highlight", string.Empty);
                                        }
                                        catch { }

                                        try
                                        {
                                            int startindex3 = item.IndexOf("startdate_my");
                                            string start3 = item.Substring(startindex3).Replace("startdate_my", "");
                                            int endindex3 = start3.IndexOf(",");
                                            SessionStart = start3.Substring(0, endindex3).Replace("\\u002d", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty);
                                        }
                                        catch { }

                                        if (SessionStart == string.Empty && SessionEnd == string.Empty)
                                        {
                                            Education = " [" + School + "] Degree: " + Degree;
                                        }
                                        else
                                        {
                                            Education = " [" + School + "] Degree: " + Degree + " Session: " + SessionStart + "-" + SessionEnd;
                                        }
                                        //University = item.Substring(item.IndexOf(":"), (item.IndexOf(",", item.IndexOf(":")) - item.IndexOf(":"))).Replace(":", string.Empty).Replace("\\u002d", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                                    }
                                    catch { }
                                    EducationList.Add(Education);

                                }
                            }
                            else
                            {

                                str_UniversityName = Regex.Split(stringSource, "<div class=\"education");
                                foreach (string tempItem in str_UniversityName)
                                {
                                    try
                                    {
                                        if (!tempItem.Contains("<!DOCTYPE html>"))
                                        {
                                            List<string> lstSchool = HttpHelper.GetTextDataByTagAndAttributeName(tempItem, "h4", "summary fn org");
                                            List<string> lstDegree = HttpHelper.GetTextDataByTagAndAttributeName(tempItem, "span", "degree");
                                            List<string> lstSession = HttpHelper.GetTextDataByTagAndAttributeName(tempItem, "span", "education-date");

                                            if (lstSession.Count == 0)
                                            {
                                                Education = " [" + lstSchool[0] + "] Degree: " + lstDegree[0];
                                            }
                                            else
                                            {
                                                Education = " [" + lstSchool[0] + "] Degree: " + lstDegree[0] + " Session: " + lstSession[0].Replace("&#8211;", "-").Replace(",", "").Trim();
                                            }

                                            EducationList.Add(Education);
                                        }
                                    }
                                    catch { }
                                }
                            }
                        }
                        catch { }

                    }

                    EducationList = EducationList.Distinct().ToList();

                    foreach (string item in EducationList)
                    {
                        if (string.IsNullOrEmpty(EducationCollection))
                        {
                            EducationCollection = item.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                        }
                        else
                        {
                            EducationCollection = EducationCollection + "  -  " + item.Replace("}", "").Replace("]", "").Replace("&amp;", "&");
                        }
                    }
                    // string University1 = 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).Replace(":", string.Empty).Trim();

                }

                catch { }

                #endregion Education

                #region Email
                try
                {
                    if (stringSource.Contains("mailto:"))
                    {
                        string[] str_Email = Regex.Split(stringSource, "mailto:");
                        USERemail = stringSource.Substring(stringSource.IndexOf("mailto:"), (stringSource.IndexOf(">", stringSource.IndexOf("mailto:")) - stringSource.IndexOf("mailto:"))).Replace("mailto:", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Trim();
                    }
                    else
                    {
                        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 UserContact
                try
                {
                    if (stringSource.Contains("<div id=\"phone-view\">"))
                    {
                        //string[] str_Contact = Regex.Split(stringSource, "<div id=\"phone-view\">");
                        LDS_UserContact = stringSource.Substring(stringSource.IndexOf("<div id=\"phone-view\">"), (stringSource.IndexOf("</li>", stringSource.IndexOf("<div id=\"phone-view\">")) - stringSource.IndexOf("<div id=\"phone-view\">"))).Replace("<div id=\"phone-view\">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace("<ul><li>", string.Empty).Replace("&nbsp;", "").Trim();
                    }
                    else
                    {
                        //string[] str_Email = Regex.Split(stringSource, "<div id=\"phone-view\">");
                        LDS_UserContact = stringSource.Substring(stringSource.IndexOf("<div id=\"phone-view\">"), (stringSource.IndexOf("</li>", stringSource.IndexOf("<div id=\"phone-view\">")) - stringSource.IndexOf("<div id=\"phone-view\">"))).Replace("<div id=\"phone-view\">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace("<ul><li>", string.Empty).Replace("&nbsp;", "").Trim();

                    }
                }
                catch (Exception ex)
                {

                }
                #endregion Email

                #region Website
                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).Replace("]", string.Empty).Trim();
                }
                catch { }
                if (string.IsNullOrEmpty(Website))
                {
                    try
                    {

                        Website = HttpHelper.GetDataWithTagValueByTagAndAttributeNameWithId(stringSource, "div", "website-view");
                        Website = Regex.Replace(Website, "<[^>]*>", String.Empty).Replace("\n", "").Replace("\r", "").Replace(" ", " ").Trim();
                        Website = Regex.Replace(Website, @"\s+", " ").Replace(",", " ").Trim();
                    }
                    catch { }
                }
                #endregion Website

                #region location
                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();
                    int startindex = stringSource.IndexOf("fmt_location");
                    string start = stringSource.Substring(startindex).Replace("fmt_location\":\"", "");
                    int endindex = start.IndexOf("\"");
                    string end = start.Substring(0, endindex).Replace("\u002d", string.Empty);
                    location = end;
                }
                catch (Exception ex)
                {

                }
                if (string.IsNullOrEmpty(location))
                {
                    try
                    {
                        List<string> lstLocation = HttpHelper.GetTextDataByTagAndAttributeName(stringSource, "span", "locality");
                        if (lstLocation.Count > 0)
                        {
                            location = lstLocation[lstLocation.Count - 1].Trim();
                        }
                    }
                    catch { }
                }
                #endregion location

                #region Country
                try
                {
                    int startindex = stringSource.IndexOf("\"geo_region\":");
                    if (startindex > 0)
                    {
                        string start = stringSource.Substring(startindex).Replace("\"geo_region\":", "");
                        int endindex = start.IndexOf("\"i18n_geo_region\":\"Location\"");
                        string end = start.Substring(0, endindex);
                        country = end;

                        string[] array = Regex.Split(end, "\"name\":\"");
                        array = array.Skip(1).ToArray();
                        foreach (string item in array)
                        {
                            try
                            {
                                int startindex1 = item.IndexOf("\",\"");
                                string strat1 = item.Substring(0, startindex1);
                                country = strat1;
                                break;
                            }
                            catch (Exception ex)
                            {

                            }
                        }

                    }
                }
                catch (Exception ex)
                {

                }
                if (country == string.Empty)
                {
                    try
                    {
                        string[] countLocation = location.Split(',');

                        if (countLocation.Count() == 2)
                        {
                            country = location.Split(',')[1];
                        }
                        else if (countLocation.Count() == 3)
                        {
                            country = location.Split(',')[2];
                        }

                    }
                    catch { }

                }
                #endregion

                #region Industry
                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("\"", string.Empty).Replace("</strong>", string.Empty).Replace("&amp;", "&");
                        if (end.Contains("strong class"))
                        {
                            Industry = end.Split('>')[1];
                        }
                        else
                        {
                            Industry = end;
                        }
                    }
                }
                catch (Exception ex)
                {
                }

                if (string.IsNullOrEmpty(Industry))
                {
                    try
                    {
                        List<string> lstIndustry = HttpHelper.GetTextDataByTagAndAttributeName(stringSource, "dd", "industry");
                        if (lstIndustry.Count > 0)
                        {
                            Industry = lstIndustry[0].Replace(",", ":").Trim();
                        }
                    }
                    catch { }
                }
                #endregion Industry

                #region Connection
                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)
                {
                }

                if (string.IsNullOrEmpty(Connection))
                {
                    try
                    {
                        List<string> lstConnection = HttpHelper.GetTextDataByTagAndAttributeName(stringSource, "div", "member-connections");
                        if (lstConnection.Count > 0)
                        {
                            Connection = lstConnection[0].Replace(",", ":").Trim();
                        }
                    }
                    catch { }
                }
                #endregion Connection

                #region Recommendation

                try
                {
                    string RecomnedUrl = string.Empty;
                    try
                    {
                        int startindex = stringSource.IndexOf("endorsements?id=");
                        string start = stringSource.Substring(startindex);
                        int endIndex = start.IndexOf("\"mem_pic\":");
                        if (endIndex < 0)
                        {
                            endIndex = start.IndexOf(">");
                        }
                        RecomnedUrl = (start.Substring(0, endIndex).Replace(",", string.Empty).Replace("\"", string.Empty).Replace(":", string.Empty));

                    }
                    catch { }

                    string PageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/profile-v2-" + RecomnedUrl + ""));
                    string[] arrayRecommendedName = Regex.Split(PageSource, "headline");

                    if (arrayRecommendedName.Count() == 1)
                    {
                        arrayRecommendedName = Regex.Split(PageSource, "fmt__recommendeeFullName");
                    }

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

                    foreach (var itemRecomName in arrayRecommendedName)
                    {
                        try
                        {
                            if (!itemRecomName.Contains("Endorsements"))
                            {
                                string Heading = string.Empty;
                                string Name = string.Empty;

                                try
                                {

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

                                try
                                {
                                    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));
                                }
                                catch { }

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

                                ListRecommendationName.Add(Name + " : " + Heading);

                            }
                        }
                        catch { }

                    }

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

                }
                catch { }

                #endregion

                #region Following

                #endregion

                #region Experience
                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;
                        if (stringSource.Contains("title_highlight"))
                        {
                            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 { }
                                        if ((exp.Contains("strong class")) || (exp.Contains("highlight")) || (string.IsNullOrEmpty(exp)))
                                        {
                                            try
                                            {
                                                int startindex1 = itemGrps.IndexOf("\"title\":");
                                                string start1 = itemGrps.Substring(startindex1).Replace("\"title\":", string.Empty);
                                                int endIndex1 = start1.IndexOf(",");
                                                exp = (start1.Substring(0, endIndex1).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 { }
                            }

                        }
                        else
                        {
                            array = Regex.Split(stringSource, "<header>");
                            foreach (string tempItem in array)
                            {
                                try
                                {
                                    if (!tempItem.Contains("<!DOCTYPE html>"))
                                    {

                                        List<string> lstExp = objChilkat.GetDataTag(tempItem, "h4");
                                        List<string> lstComp = objChilkat.GetDataTag(tempItem, "h5");
                                        if (lstExp.Count > 0)
                                        {
                                            exp = lstExp[0];
                                        }
                                        if (lstComp.Count > 0)
                                        {
                                            comp = lstComp[0];
                                            if (string.IsNullOrEmpty(comp))
                                            {
                                                comp = lstComp[1];
                                            }
                                        }
                                        if (titlecurrent == string.Empty)
                                        {
                                            titlecurrent = lstExp[0];
                                        }

                                        if (companycurrent == string.Empty)
                                        {
                                            companycurrent = lstComp[0];
                                        }

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

                                    }
                                }
                                catch { }
                            }

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

                    }

                    catch { }

                    try
                    {
                        if (string.IsNullOrEmpty(titlecurrent))
                        {
                            int StartIndex = stringSource.IndexOf("trk=prof-0-ovw-curr_pos\">");
                            string Start = stringSource.Substring(StartIndex).Replace("trk=prof-0-ovw-curr_pos\">", string.Empty);
                            int EndIndex = Start.IndexOf("</a>");
                            string End = Start.Substring(0, EndIndex).Replace("</a>", string.Empty);
                            titlecurrent = End.Trim();
                        }
                    }
                    catch
                    { }

                }

                #endregion

                #region Group

                try
                {
                    string GroupUrl = string.Empty;
                    try
                    {
                        int startindex = stringSource.IndexOf("templateId\":\"profile_v2_connections");
                        string start = stringSource.Substring(startindex);
                        //int endIndex = start.IndexOf("vsrp_people_res_name");
                        int endIndex = start.IndexOf("}");
                        GroupUrl = (start.Substring(0, endIndex).Replace(",", string.Empty).Replace("\"", string.Empty).Replace("templateId:profile_v2_connectionsurl:", string.Empty));

                    }
                    catch { }

                    string PageSource = HttpHelper.getHtmlfromUrl1(new Uri(GroupUrl));

                    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 item in ListGroupName)
                    {
                        if (groupscollectin == string.Empty)
                        {
                            groupscollectin = item;
                        }
                        else
                        {
                            groupscollectin += "  -  " + item;
                        }
                    }

                }
                catch { }

                if (string.IsNullOrEmpty(groupscollectin))
                {
                    List<string> lstGroupData = new List<string>();
                    string[] array1 = Regex.Split(stringSource, "link_groups_settings\":?");
                    array1 = array1.Skip(1).ToArray();
                    foreach (string item in array1)
                    {
                        string _item = Utils.getBetween(item, "name\":", ",").Replace("name\":", "").Replace(":", "").Replace("\"", "");
                        lstGroupData.Add(_item);
                    }

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

                if (string.IsNullOrEmpty(groupscollectin))
                {
                    List<string> lstGroupData = new List<string>();
                    string tempResponse = Utils.getBetween(stringSource, "<div id=\"groups\"", "<div>");
                    lstGroupData = HttpHelper.GetDataTag(tempResponse, "strong");

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

                #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 item in strarr_skill)
                        {
                            try
                            {
                                if (!item.Contains("!DOCTYPE html"))
                                {
                                    try
                                    {
                                        //string Grp = item.Substring(item.IndexOf("<"), (item.IndexOf(">", item.IndexOf("<")) - item.IndexOf("<"))).Replace("<", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("\"u002", "-").Trim();
                                        string Grp = item.Substring(item.IndexOf(">"), (item.IndexOf("<", item.IndexOf(">")) - item.IndexOf(">"))).Replace(">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("\"u002", "-").Trim();
                                        checkgrplist.Add(Grp);
                                        checkgrplist.Distinct().ToList();
                                    }
                                    catch { }
                                }

                            }
                            catch { }
                        }

                        foreach (string item in checkgrplist)
                        {
                            if (string.IsNullOrEmpty(Skill))
                            {
                                Skill = item.Replace("\"u002", "-").Trim();
                            }
                            else
                            {
                                Skill = Skill + "  -  " + item;
                            }
                        }
                    }
                    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 item in checkgrplist)
                                {
                                    if (string.IsNullOrEmpty(Skill))
                                    {
                                        Skill = item;
                                    }
                                    else
                                    {
                                        Skill = Skill + "  -  " + item;
                                    }
                                }
                            }
                            catch (Exception ex)
                            {

                            }
                        }
                    }
                }
                catch (Exception ex)
                {

                }
                Skill = Skill.Replace("a href=\";edu", "").Trim();
                #endregion

                #region Pasttitle
                string[] pasttitles = Regex.Split(stringSource, "title_highlight");
                string pstTitlesitem = string.Empty;
                pasttitles = pasttitles.Skip(1).ToArray();
                foreach (string item in pasttitles)
                {
                    try
                    {

                        if (!item.Contains("<!DOCTYPE html>") && !item.Contains("Tip: You can also search by keyword"))
                        {

                            try
                            {
                                string[] Past_Ttl = Regex.Split(item, ",");
                                pstTitlesitem = Past_Ttl[0].Replace(":", string.Empty).Replace("\"", string.Empty).Replace("\\u002d", "-").Replace("&amp;", "&");
                            }
                            catch { }
                            if ((pstTitlesitem.Contains("strong class")) || (pstTitlesitem.Contains("highlight")) || (string.IsNullOrEmpty(pstTitlesitem)))
                            {
                                try
                                {
                                    int startindex1 = item.IndexOf("\"title\":");
                                    string start1 = item.Substring(startindex1).Replace("\"title\":", string.Empty);
                                    int endIndex1 = start1.IndexOf(",");
                                    pstTitlesitem = (start1.Substring(0, endIndex1).Replace("\"", string.Empty).Replace(":", string.Empty).Replace("&amp", "&").Replace(";", string.Empty).Replace("\\u002d", "-").Replace("name:", string.Empty));
                                }
                                catch
                                { }
                            }

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

                        }

                    }
                    catch
                    {
                    }
                }
                #endregion

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

                            int startindex1 = item.IndexOf("summary_lb\":\"");
                            if (startindex > 0)
                            {
                                string start1 = item.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).Replace("\\", string.Empty).Replace("&#xf0a7;", "@").Replace("&#x2019;", "'").Replace("&#x2022", "@").Replace("&#x25cf;", "@");

                                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 AccountType
                try
                {
                    if (stringSource.Contains("has a Premium Account") || stringSource.Contains("Account Holder"))
                    {
                        AccountType = "Premium Account";
                    }
                    else
                    {
                        AccountType = "Basic Account";
                    }
                }
                catch (Exception ex)
                {

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

                    LDS_UserProfileLink = Url;
                    //  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 = SearchCriteria.LoginID;
                if (string.IsNullOrEmpty(firstname))
                {
                    firstname = "Linkedin Member";
                }

                string endName = firstname + " " + lastname;
                //GroupStatus.GroupSpecMem.Add(GroupMemId, endName);
                if (firstname == string.Empty) firstname = "LinkedIn";
                if (lastname == string.Empty) lastname = "Member";
                if (Company == string.Empty) Company = "--";
                if (titlecurrent == string.Empty) titlecurrent = "--";
                if (companycurrent == string.Empty) companycurrent = "--";
                if (LDS_Desc_AllComp == string.Empty) LDS_Desc_AllComp = "--";
                if (LDS_BackGround_Summary == string.Empty) LDS_BackGround_Summary = "--";
                if (Connection == string.Empty) Connection = "--";
                if (recomandation == string.Empty) recomandation = "--";
                if (Skill == string.Empty) Skill = "--";
                if (LDS_Experience == string.Empty) LDS_Experience = "--";
                if (EducationCollection == string.Empty) EducationCollection = "--";
                if (groupscollectin == string.Empty) groupscollectin = "--";
                if (USERemail == string.Empty) USERemail = "--";
                if (LDS_UserContact == string.Empty) LDS_UserContact = "--";
                if (LDS_PastTitles == string.Empty) LDS_PastTitles = "--";
                if (AllComapny == string.Empty) AllComapny = "--";
                if (location == string.Empty) location = "--";
                if (country == string.Empty) country = "--";
                if (Industry == string.Empty) Industry = "--";
                if (Website == string.Empty) Website = "--";

                string LDS_FinalData = TypeOfProfile + "," + LDS_UserProfileLink + "," + firstname + "," + lastname + "," + Company.Replace(",", ";") + "," + titlecurrent.Replace(",", ";") + "," + companycurrent.Replace(",", ";") + "," + CurrentCompSite.Replace(",", ";") + "," + 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(",", ";") + "," + location.Replace(",", ";") + "," + country.Replace(",", ";") + "," + Industry.Replace(",", ";") + "," + Website.Replace(",", ";") + "," + LDS_LoginID + "," + AccountType;

                if (!string.IsNullOrEmpty(firstname))
                {
                    //Log("[ " + DateTime.Now + " ] => [ Data : " + LDS_FinalData + " ]");
                }
                else
                {
                    AddToLogger("[ " + DateTime.Now + " ] => [ No Data For URL : " + Url + " ]");
                    GlobusFileHelper.AppendStringToTextfileNewLineWithCarat(Url, Globals.DesktopFolder + "\\UnScrapedList.txt");
                }

                if (SearchCriteria.starter)
                {
                    //string tempFinalData = LDS_FinalData.Replace(";", "").Replace(LDS_UserProfileLink, "").Replace(TypeOfProfile, "").Replace(",", "").Replace(LDS_LoginID, "").Trim();

                    //if (!string.IsNullOrEmpty(tempFinalData))
                    {
                        //if (CheckEmployeeScraper)
                        //{
                        //    string FileName = "CompanyEmployeeScraper";
                        //    AppFileHelper.AddingLinkedInDataToCSVFileCompanyEmployeeScraper(LDS_FinalData, FileName);
                        //    return true;
                        //}
                        //else if (CampaignScraper)
                        {
                            AppFileHelper.AddingLinkedInDataToCSVFile(LDS_FinalData, FileName);
                            return true;
                        }
                        //else
                        //{
                        //    AppFileHelper.AddingLinkedInDataToCSVFile(LDS_FinalData, SearchCriteria.FileName);
                        //    return true;
                        //}
                    }
                }
            }
            catch { }
            return false;
        }
Ejemplo n.º 14
0
        public Dictionary<string, string> AddSpecificGroupUserWithExcelInput(ref GlobusHttpHelper HttpHelper, string UserID, 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 csrfToken = string.Empty;
            string pageSource = string.Empty;
            string[] RgxSikValue = new string[] { };
            string[] RgxPageNo = new string[] { };
            string sikvalue = string.Empty;
            int counter = 0;
            #endregion

            try
            {
                GroupSpecMem.Clear();
                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();
                }

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

                    foreach (string[] itemArr in msgGroupMem_excelData)
                    {
                        try
                        {
                            pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/groups?viewMembers=&gid=" + gid));
                        }
                        catch { }

                        string group = string.Empty;
                        string mem = string.Empty;

                        try
                        {
                            group = itemArr[0].ToString();
                            mem = itemArr[1].ToString();
                            endKey = itemArr[1].ToString();
                        }
                        catch { }

                        if (!string.IsNullOrEmpty(group) || !string.IsNullOrEmpty(mem))
                        {

                            try
                            {
                                RgxSikValue = System.Text.RegularExpressions.Regex.Split(pageSource, "sik");
                            }
                            catch { }

                            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 postdata = "csrfToken=" + csrfToken + "&searchField=" + Uri.EscapeDataString(mem) + "&searchMembers=submit&searchMembers=Search&gid=" + gid + "&goback=.gna_" + gid + "";

                            #region Commented old code
                            try
                            {
                                pageSource = HttpHelper.postFormDataRef(new Uri("http://www.linkedin.com/groups"), postdata, "http://www.linkedin.com/groups?viewMembers=&gid=" + gid + "&sik=" + sikvalue + "&split_page=1&goback=%2Egna_" + gid + "", "", "");
                            }
                            catch { }

                            if (pageSource.Contains("Sorry, we found 0 members matching your search."))
                            {
                                Loggergrppmem("[ " + DateTime.Now + " ] => [ Sorry, we found 0 members matching your search : " + mem + " ]");
                                continue;
                            }

                            if (counter > 1)
                            {
                                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&goback=%2Egna_" + gid + "";

                                try
                                {
                                    pageSource = HttpHelper.getHtmlfromUrl(new Uri(getdata));
                                }
                                catch { }
                            }

                            try
                            {
                                RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"member\" id=\"");
                            }
                            catch { }
                            #endregion

                            string Url = endKey;
                            //var GrpUser = HttpHelper.getHtmlfromUrl(new Uri(Url));
                            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;
                                        }

                                        try
                                        {
                                            #region Name
                                            try
                                            {
                                                try
                                                {
                                                    endName = GrpUser.Substring(GrpUser.IndexOf("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\""), (GrpUser.IndexOf("i18n__expand_your_network_to_see_more", GrpUser.IndexOf("\"See Full Name\",\"i18n_Edit\":\"Edit\",\"fmt__full_name\":\"")) - GrpUser.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
                                                    {
                                                        endName = GrpUser.Substring(GrpUser.IndexOf("fmt__full_name\":"), (GrpUser.IndexOf(",", GrpUser.IndexOf("fmt__full_name\":")) - GrpUser.IndexOf("fmt__full_name\":"))).Replace("fmt__full_name\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim();

                                                    }
                                                    catch { }
                                                }

                                                if (string.IsNullOrEmpty(endName))
                                                {
                                                    try
                                                    {
                                                        //endName = Utils.getBetween(GrpUser, "<span class=\"full-name\">", "</span>");
                                                        endName = GrpUser.Substring(GrpUser.IndexOf("<span class=\"full-name\">"), (GrpUser.IndexOf("</span><span></span></span></h1></div></div><div id=\"headline-container\" data-li-template=\"headline\">", GrpUser.IndexOf("</span><span></span></span></h1></div></div><div id=\"headline-container\" data-li-template=\"headline\">")) - GrpUser.IndexOf("<span class=\"full-name\">"))).Replace("<span class=\"full-name\">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim();
                                                    }
                                                    catch
                                                    { }
                                                }

                                                if (string.IsNullOrEmpty(endName))
                                                {
                                                    try
                                                    {
                                                        //endName = Utils.getBetween(GrpUser, "<span class=\"full-name\">", "</span>");
                                                        endName = GrpUser.Substring(GrpUser.IndexOf("data-li-fullName="), (GrpUser.IndexOf(">Send message</a>", GrpUser.IndexOf(">Send message</a>")) - GrpUser.IndexOf("data-li-fullName="))).Replace("data-li-fullName=", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("\n", string.Empty).Trim();
                                                    }
                                                    catch
                                                    { }
                                                }
                                                //anetppl_profile">Christian A. Kenyeres</a>
                                            }
                                            catch { }

                                            #endregion
                                        }
                                        catch
                                        {

                                        }

                                        //Deegree connection
                                        try
                                        {
                                            int startindex = GrpUser.IndexOf("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("\n",string.Empty).Replace("class=\"degree-icon", string.Empty).Replace("\"",string.Empty).Replace(">",string.Empty).Trim().ToString();

                                                if (DeegreeConn == "1")
                                                {
                                                    DeegreeConn = DeegreeConn + "st";
                                                }
                                                else if (DeegreeConn == "2")
                                                {
                                                    DeegreeConn = DeegreeConn + "nd";
                                                }
                                                else if (DeegreeConn == "3")
                                                {
                                                    DeegreeConn = DeegreeConn + "rd";
                                                }
                                                else if (DeegreeConn == "")
                                                {
                                                    DeegreeConn = "3rd";
                                                }
                                            }
                                            else
                                            {
                                                startindex = GrpUser.IndexOf("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);

                                                }
                                                else
                                                {
                                                    DeegreeConn = "3rd";
                                                }

                                            }

                                        }

                                        catch { }

                                        try
                                        {
                                            //endKey = Utils.getBetween(GrpUser, "view?id=", "&").Replace("view?id=", "");
                                            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
                                        {
                                            string endNamedisp = endName;
                                            endName = Uri.EscapeDataString(endName);
                                            GroupSpecMem.Add(endKey, endNamedisp + " (" + DeegreeConn + ")");

                                            if (WithGroupSearch == true)
                                            {
                                                Loggergrppmem("[ " + DateTime.Now + " ] => [ Added Group Member : " + endNamedisp + " (" + DeegreeConn + ") with Search keyword : " + SearchKeyword + " ]");
                                            }
                                            else
                                            {
                                                Loggergrppmem("[ " + DateTime.Now + " ] => [ Added Group Member : " + endNamedisp + " ]");
                                            }
                                            endKey = "";
                                            endName = "";
                                        }
                                        catch { }
                                    }
                                    else
                                    {

                                    }
                                }
                                catch { }
                            }
                        }
                    }

                return GroupSpecMem;
            }
            catch { }
            return GroupSpecMem;
        }
Ejemplo n.º 15
0
        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;
        }
Ejemplo n.º 16
0
        public void LoginHttpHelper_Checker(ref GlobusHttpHelper HttpHelper)
        {
            try
            {
                this.HttpHelper = HttpHelper;

                //Log("[ " + DateTime.Now + " ] => [ Logging In With Account : " + SearchCriteria.LoginID + " ]");
                Log("[ " + DateTime.Now + " ] => [ Logging In With Account : " + accountUser + " ]");
                Log("[ " + DateTime.Now + " ] => [ Login Process is Running... ]");
                Url = "https://www.linkedin.com/";
                string pageSrcLogin = string.Empty;
                int ProxyPort = 0;
                if (!string.IsNullOrEmpty(proxyPort) && NumberHelper.ValidateNumber(proxyPort))
                {
                    ProxyPort = int.Parse(proxyPort);
                }
                pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, ProxyPort, proxyUserName, proxyPassword);

                string postdata = string.Empty;
                string postUrl = string.Empty;
                string ResLogin = string.Empty;
                string csrfToken = string.Empty;
                string regCsrfParam = string.Empty;
                string sourceAlias = string.Empty;

                if (pageSrcLogin.Contains("csrfToken"))
                {
                    try
                    {
                        int startIndex = pageSrcLogin.IndexOf("name=\"csrfToken\"");
                        string start = pageSrcLogin.Substring(startIndex).Replace("name=\"csrfToken\"", "");
                        int endIndex = start.IndexOf("\" ");
                        string end = start.Substring(0, endIndex).Replace("value=\"", "").Trim();
                        csrfToken = end;
                        //csrfToken = csrfToken;
                    }
                    catch (Exception ex)
                    {

                    }

                }

                try
                {
                    if (csrfToken.Contains("&"))
                    {
                        string[] Arr = csrfToken.Split('&');
                        csrfToken = Arr[0].Replace("\"", string.Empty);

                    }

                }
                catch { }

                if (pageSrcLogin.Contains("sourceAlias"))
                {
                    sourceAlias = pageSrcLogin.Substring(pageSrcLogin.IndexOf("sourceAlias"), 100);
                    string[] Arr = sourceAlias.Split('"');
                    sourceAlias = Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty).Trim();
                }

                try
                {
                    int SourceAliasStart = pageSrcLogin.IndexOf("regCsrfParam");
                    if (SourceAliasStart > 0)
                    {
                        try
                        {

                            regCsrfParam = pageSrcLogin.Substring(pageSrcLogin.IndexOf("regCsrfParam"), 100);
                            string[] Arr = regCsrfParam.Split('"');
                            regCsrfParam = Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty);
                        }
                        catch
                        {
                        }
                    }

                }
                catch { }

                postUrl = "https://www.linkedin.com/uas/login-submit";
                postdata = "isJsEnabled=true&source_app=&tryCount=&session_key=" + Uri.EscapeDataString(accountUser) + "&session_password="******"&signin=Sign%20In&session_redirect=&loginCsrfParam=" + regCsrfParam + "&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;

                try
                {
                    ResLogin = HttpHelper.postFormDataProxy(new Uri(postUrl), postdata, proxyAddress, ProxyPort, proxyUserName, proxyPassword);//HttpHelper.postFormDataRef(new Uri(postUrl), postdata, "http://www.linkedin.com/uas/login?goback=&trk=hb_signin", "", "");
                }
                catch { }

                //if (GroupStatus.GrouppageSourcewithProxy == string.Empty)
                //{
                //    GroupStatus.GrouppageSourcewithProxy = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/grp/"));
                //}

                string ImageUrl = string.Empty;
                string captchaText = string.Empty;
                string captchachallengeid = string.Empty;
                string dts = string.Empty;
                string origActionAlias = string.Empty;
                string origSourceAlias = string.Empty;
                string irhf = string.Empty;
                string submissionID = string.Empty;
                string CAPTCHAfwdcsrftoken = string.Empty;
                string CAPTCHAfwdsignin = string.Empty;
                string CAPTCHAfwdsession_password = string.Empty;
                string CAPTCHAfwdsession_key = string.Empty;
                string CAPTCHAfwdisJsEnabled = string.Empty;
                string CAPTCHAfwdloginCsrfParam = string.Empty;

                if (ResLogin.Contains("Security Verification"))
                {
                    string dataforcapctha = HttpHelper.getHtmlfromUrl1(new Uri("https://www.google.com/recaptcha/api/noscript?k=6LcnacMSAAAAADoIuYvLUHSNLXdgUcq-jjqjBo5n"));
                    if (!string.IsNullOrEmpty(dataforcapctha))
                    {
                        int startindex = dataforcapctha.IndexOf("id=\"recaptcha_challenge_field\"");
                        if (startindex > 0)
                        {
                            string start = dataforcapctha.Substring(startindex).Replace("id=\"recaptcha_challenge_field\"", "");
                            int endindex = start.IndexOf("\">");
                            string end = start.Substring(0, endindex).Replace("value=", string.Empty).Replace("\"", string.Empty).Trim();
                            ImageUrl = "https://www.google.com/recaptcha/api/image?c=" + end;
                            System.Net.WebClient webclient = new System.Net.WebClient();
                            byte[] args = webclient.DownloadData(ImageUrl);
                            string[] arr1 = new string[] { Globals.CapchaLoginID, Globals.CapchaLoginPassword, "" };
                            captchaText = DecodeDBC(arr1, args);
                        }

                        if (ResLogin.Contains("name=\"security-challenge-id\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"security-challenge-id\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"security-challenge-id\"", "").Replace("value=\"", "");
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                captchachallengeid = end.Replace("\"", string.Empty).Trim();
                            }
                        }

                        if (ResLogin.Contains("name=\"dts\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"dts\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"dts\"", "").Replace("value=\"", "");
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                dts = end.Replace("\"", string.Empty).Trim();
                            }
                        }

                        if (ResLogin.Contains("name=\"origActionAlias\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"origActionAlias\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"origActionAlias\"", "").Replace("value=\"", "");
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                origActionAlias = end.Replace("\"", string.Empty).Trim();
                            }
                        }

                        if (ResLogin.Contains("name=\"submissionId\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"submissionId\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"submissionId\"", string.Empty).Replace("value=\"", string.Empty);
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                submissionID = end.Replace("\"", string.Empty).Trim();
                            }
                        }
                        if (ResLogin.Contains("name=\"CAPTCHA-fwd-csrfToken\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"CAPTCHA-fwd-csrfToken\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"CAPTCHA-fwd-csrfToken\"", string.Empty).Replace("value=\"", string.Empty);
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                CAPTCHAfwdcsrftoken = end.Replace("\"", string.Empty).Trim();
                            }
                        }
                        if (ResLogin.Contains("name=\"CAPTCHA-fwd-signin\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"CAPTCHA-fwd-signin\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"CAPTCHA-fwd-signin\"", string.Empty).Replace("value=\"", string.Empty);
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                CAPTCHAfwdsignin = end.Replace("\"", string.Empty).Trim();
                            }
                        }
                        if (ResLogin.Contains("name=\"CAPTCHA-fwd-session_password\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"CAPTCHA-fwd-session_password\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"CAPTCHA-fwd-session_password\"", string.Empty).Replace("value=\"", string.Empty);
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                CAPTCHAfwdsession_password = end.Replace("\"", string.Empty).Trim();
                            }
                        }
                        if (ResLogin.Contains("name=\"CAPTCHA-fwd-session_key\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"CAPTCHA-fwd-session_key\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"CAPTCHA-fwd-session_key\"", string.Empty).Replace("value=\"", string.Empty);
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                CAPTCHAfwdsession_key = end.Replace("\"", string.Empty).Trim();
                            }
                        }
                        if (ResLogin.Contains("name=\"CAPTCHA-fwd-isJsEnabled\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"CAPTCHA-fwd-isJsEnabled\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"CAPTCHA-fwd-isJsEnabled\"", string.Empty).Replace("value=\"", string.Empty);
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                CAPTCHAfwdisJsEnabled = end.Replace("\"", string.Empty).Trim();
                            }
                        }
                        if (ResLogin.Contains("name=\"CAPTCHA-fwd-loginCsrfParam\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"CAPTCHA-fwd-loginCsrfParam\"");
                            if (startindexnew > 0) ;
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"CAPTCHA-fwd-loginCsrfParam\"", string.Empty).Replace("value=\"", string.Empty);
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                CAPTCHAfwdloginCsrfParam = end.Replace("\"", string.Empty).Trim();
                            }
                        }

                        if (ResLogin.Contains("name=\"origSourceAlias\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"origSourceAlias\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"origSourceAlias\"", "").Replace("value=\"", "");
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                origSourceAlias = end.Replace("\"", string.Empty).Trim();
                            }
                        }

                        if (ResLogin.Contains("name=\"irhf\""))
                        {
                            int startindexnew = ResLogin.IndexOf("name=\"irhf\"");
                            if (startindexnew > 0)
                            {
                                string start = ResLogin.Substring(startindexnew).Replace("name=\"irhf\"", "").Replace("value=\"", "");
                                int endindex = start.IndexOf("\"");
                                string end = start.Substring(0, endindex);
                                irhf = end.Replace("\"", string.Empty).Trim();
                            }
                        }

                        if (!string.IsNullOrEmpty(ImageUrl) && !string.IsNullOrEmpty(captchaText))
                        {
                            postdata = "recaptcha_challenge_field=" + ImageUrl.Replace("https://www.google.com/recaptcha/api/image?c=", string.Empty) + "&recaptcha_response_field=" + captchaText.Replace(" ", "+") + "&irhf=" + irhf + "&dts=" + dts + "&security-challenge-id=" + captchachallengeid + "&submissionId=" + submissionID + "&CAPTCHA-fwd-csrfToken=" + CAPTCHAfwdcsrftoken + "&CAPTCHA-fwd-isJsEnabled=" + CAPTCHAfwdisJsEnabled + "&CAPTCHA-fwd-signin=" + CAPTCHAfwdsignin + "&CAPTCHA-fwd-loginCsrfParam=" + CAPTCHAfwdloginCsrfParam + "&CAPTCHA-fwd-session_password="******"&CAPTCHAfwd-session_key=" + CAPTCHAfwdsession_key + "&session_password="******"&session_key=" + Uri.EscapeDataString(accountUser) + "&origSourceAlias=" + origSourceAlias + "&origActionAlias=" + origActionAlias + "&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;
                            postdata = postdata.Replace(" ", string.Empty);
                            ResLogin = HttpHelper.postFormDataRef(new Uri("https://www.linkedin.com/uas/captcha-submit"), postdata, "https://www.linkedin.com/uas/login-submit", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);
                        }
                        else
                        {
                            ResLogin = string.Empty;
                        }

                        if (ResLogin.Contains("The text you entered does not match the characters in the security image. Please try again with this new image") || string.IsNullOrEmpty(ResLogin))
                        {
                            Log("[ " + DateTime.Now + " ] => [ " + accountUser + "  Cannot Login because of Capctcha ]");
                            GlobusFileHelper.WriteStringToTextfile(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.pathCapcthaLogin);
                            SearchCriteria.loginREsponce = string.Empty;
                            //FrmScrapGroupMember.ChangeToNextAccount = true;
                        }
                    }
                }

                string CheckedAccount = accountUser + ":" + accountPass;

                if (ResLogin.Contains("Sign Out") || ResLogin.Contains("class=\"signout\"") || ResLogin.Contains("Cerrar sesión"))
                {
                    IsLoggedIn = true;
                    Log("[ " + DateTime.Now + " ] => [ Logged In With Account : " + accountUser + " ]");
                    GlobusFileHelper.AppendStringToTextfileNewLine(CheckedAccount, Globals.Path_WorkingAccount_AccountChecker);
                }
                else if (ResLogin.Contains("logout?session_full_logout"))
                {
                    SearchCriteria.loginREsponce = string.Empty;
                    IsLoggedIn = true;
                    string Search = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/search?trk=advsrch"));
                    SearchCriteria.loginREsponce = Search;
                }
                else if (ResLogin.Contains("Sign-In Verification"))
                {
                    Log("[ " + DateTime.Now + " ] => [ Verification required : " + accountUser + " ]");
                }
                else if (ResLogin.Contains("Your LinkedIn account has been temporarily restricted"))
                {
                    Log("[ " + DateTime.Now + " ] => [ Your LinkedIn account : " + accountUser + " has been temporarily restricted ]");
                    //FrmScrapGroupMember.ChangeToNextAccount = true;
                }
                else
                {
                    Log("[ " + DateTime.Now + " ] => [ NotLogged In With Account : " + accountUser + " ]");
                    //FrmScrapGroupMember.ChangeToNextAccount = true;
                    GlobusFileHelper.AppendStringToTextfileNewLine(CheckedAccount, Globals.Path_NonWorkingAccount_AccountChecker);
                }

            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 17
0
        public void PostAttachLinkGroupUpdate(ref GlobusHttpHelper HttpHelper, List<string> selectedItems, object parameter, int mindelay, int maxdelay)
        {
            string postdata = string.Empty;
             string referal = string.Empty;
             string postUrl = string.Empty;
             string ResLogin = string.Empty;
             string csrfToken = string.Empty;
             string sourceAlias = string.Empty;
             string ReturnString = string.Empty;
             string PostGrpAttachLink = string.Empty;
             string PostGrpKey = string.Empty;
             string Poststatus = string.Empty;

             try
             {
                 string MessageText = string.Empty;
                 string PostedMessage = string.Empty;
                 string pageSource = string.Empty;

                 Array paramsArray = (Array)parameter;

                 string user = string.Empty;
                 try
                 {
                     user = paramsArray.GetValue(1).ToString();
                 }
                 catch { }

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

                 if (pageSource.Contains("csrfToken"))
                 {
                     string pattern = @"\";
                     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);
                     csrfToken = csrfToken.Replace(pattern, string.Empty.Trim());
                 }

                 if (pageSource.Contains("sourceAlias"))
                 {
                     string pattern1 = @"\";
                     sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100);
                     string[] Arr = sourceAlias.Split('"');
                     sourceAlias = Arr[2];
                     sourceAlias = sourceAlias.Replace(pattern1, string.Empty.Trim());
                 }

                 try
                 {
                     int counter = 0;
                     foreach (var Itegid in selectedItems)
                     {
                         counter = counter + 1;
                         try
                         {

                                 lock (Locked_Que_GrpAttachLink_Post)
                                 {
                                     if (Que_GrpAttachLink_Post.Count > 0)
                                     {
                                         try
                                         {
                                             PostGrpAttachLink = Que_GrpAttachLink_Post.Dequeue();
                                         }
                                         catch { }
                                     }
                                     else
                                     {
                                         PostGrpAttachLink = AttachLink_Post;
                                     }

                                 }

                             string[] grpDisplay = Itegid.Split(':');
                             string GrpName = Itegid.ToString().Replace(",", ":").Replace("[", string.Empty).Replace("]", string.Empty).Trim();
                             string[] PostGid = GrpName.Split(':');
                             string Gid = string.Empty;

                             try
                             {
                                 if (NumberHelper.ValidateNumber(PostGid[1].Trim()))
                                 {
                                     Gid = PostGid[1].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[2].Trim()))
                                 {
                                     Gid = PostGid[2].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[3].Trim()))
                                 {
                                     Gid = PostGid[3].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[4].Trim()))
                                 {
                                     Gid = PostGid[4].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[5].Trim()))
                                 {
                                     Gid = PostGid[5].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[6].Trim()))
                                 {
                                     Gid = PostGid[6].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[7].Trim()))
                                 {
                                     Gid = PostGid[7].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[8].Trim()))
                                 {
                                     Gid = PostGid[8].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[9].Trim()))
                                 {
                                     Gid = PostGid[9].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[10].Trim()))
                                 {
                                     Gid = PostGid[10].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[11].Trim()))
                                 {
                                     Gid = PostGid[11].Trim();
                                 }
                                 else if (NumberHelper.ValidateNumber(PostGid[12].Trim()))
                                 {
                                     Gid = PostGid[12].Trim();
                                 }
                             }
                             catch { }

                     string ReqUrl = PostGrpAttachLink;
                     ReqUrl = ReqUrl.Replace(":", "%3A").Replace("//", "%2F%2F");
                     referal = "http://www.linkedin.com/groups/" + grpDisplay[2].Replace(" ", "-") + "-" + Gid + "?goback=%2Egmr_" + Gid;
                     string GetStatus = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/share?getPreview=&url=" + PostGrpAttachLink), referal);

                     string ImgCount = string.Empty;
                     try
                     {
                         int StartinImgCnt = GetStatus.IndexOf("current");
                         string startImgCnt = GetStatus.Substring(StartinImgCnt);
                         int EndIndexImgCnt = startImgCnt.IndexOf("</span>");
                         string EndImgCnt = startImgCnt.Substring(0, EndIndexImgCnt).Replace("value\":", "").Replace("\"", "");
                         ImgCount = EndImgCnt.Replace("current", string.Empty).Replace(">", string.Empty);
                     }
                     catch
                     {
                         ImgCount = "0";
                     }

                     string LogoUrl = string.Empty;
                     try
                     {
                         int StartinImgUrl = GetStatus.IndexOf("url");
                         string startImgUrl = GetStatus.Substring(StartinImgUrl);
                         int EndIndexImgUrl = startImgUrl.IndexOf("border=");
                         string EndImgUrl = startImgUrl.Substring(0, EndIndexImgUrl).Replace("value\":", "").Replace("\"", "");
                         LogoUrl = EndImgUrl.Replace("url=", string.Empty).Trim();
                     }
                     catch
                     {
                         LogoUrl = "false";
                     }

                     string EntityId = string.Empty;
                     try
                     {
                         int StartinEntityId = GetStatus.IndexOf("data-entity-id");
                         string startEntityId = GetStatus.Substring(StartinEntityId);
                         int EndIndexEntityId = startEntityId.IndexOf("data-entity-url");
                         string EndEntityId = startEntityId.Substring(0, EndIndexEntityId).Replace("value\":", "").Replace("\"", "");
                         EntityId = EndEntityId.Replace("\"", string.Empty).Replace("data-entity-id", string.Empty).Replace("=", string.Empty).Trim();
                     }
                     catch { }

                     string contentTitle = string.Empty;
                     try
                     {
                         int StartinContent = GetStatus.IndexOf("share-view-title");
                         string startContent = GetStatus.Substring(StartinContent);
                         int EndIndexContent = startContent.IndexOf("</h4>");
                         string EndContent = startContent.Substring(0, EndIndexContent).Replace("value\":", "").Replace("\"", "");
                         contentTitle = EndContent.Replace("\"", string.Empty).Replace("\n", string.Empty).Replace("share-view-title", string.Empty).Replace("id=", string.Empty).Replace(">", string.Empty).Replace("&", "and").Replace("amp;", string.Empty).Trim();

                         if (contentTitle.Contains("#"))
                         {
                             contentTitle = contentTitle.Replace("and", "&");
                             contentTitle = Uri.EscapeDataString(contentTitle);
                         }

                     }
                     catch { }

                     string contentSummary = string.Empty;
                     try
                     {
                         int StartinConSumm = GetStatus.IndexOf("share-view-summary\">");
                         string startConSumm = GetStatus.Substring(StartinConSumm);
                         int EndIndexConSumm = startConSumm.IndexOf("</span>");
                         string EndConSumm = startConSumm.Substring(0, EndIndexConSumm).Replace("value\":", "").Replace("\"", "");
                         contentSummary = EndConSumm.Replace("\"", string.Empty).Replace("\n", string.Empty).Replace("share-view-summary", string.Empty).Replace("id=", string.Empty).Replace(">", string.Empty).Replace("</span<a href=#", string.Empty).Trim();
                         contentSummary = contentSummary.Replace(",", "%2C").Replace(" ", "%20");

                         if (contentSummary.Contains("#"))
                         {
                             contentSummary = contentSummary.Replace("and", "&");
                             contentSummary = Uri.EscapeDataString(contentSummary);
                         }
                     }
                     catch { }

                     string PostAttachLink = string.Empty;
                     string ResponseStatusMsg = string.Empty;

                     try
                     {
                         PostAttachLink = "csrfToken=" + csrfToken + "&postTitle=&postText=&pollChoice1-ANetPostForm=&pollChoice2-ANetPostForm=&pollChoice3-ANetPostForm=&pollChoice4-ANetPostForm=&pollChoice5-ANetPostForm=&pollEndDate-ANetPostForm=0&contentImageCount=" + ImgCount + "&contentImageIndex=0&contentImage=" + LogoUrl + "&contentEntityID=" + EntityId + "&contentUrl=" + ReqUrl + "&contentTitle=" + contentTitle + "&contentSummary=" + contentSummary + "&contentImageIncluded=true&%23=&gid=" + Gid + "&postItem=&ajax=true&tetherAccountID=&facebookTetherID=";
                         ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groups"), PostAttachLink);
                     }
                     catch { }

                             string CSVHeader = "UserName" + "," + "HeaderPost" + "," + "Details Post" + "," + "ToGroup";

                             if (ResponseStatusMsg.Contains("SUCCESS") || ResponseStatusMsg.Contains("Accept  the description According to you"))
                             {
                                 Log("[ " + DateTime.Now + " ] => [ Attach Link : " + PostGrpAttachLink + " Added Successfully on Group : " + grpDisplay[2] + " ]");

                                 string CSV_Content = user + "," + PostGrpAttachLink + "," + PostGrpAttachLink + "," + grpDisplay[2];
                                 CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_GroupUpdates);

                             }
                             else if (ResponseStatusMsg.Contains("Your request to join is still pending"))
                             {
                                 Log("[ " + DateTime.Now + " ] => [ Your membership is pending approval on a Group:" + grpDisplay[2] + " ]");
                                 Log("[ " + DateTime.Now + " ] => [ Attach Link : " + PostGrpAttachLink + " Not Posted on Group:" + grpDisplay[2] + " Because Your membership is pending for approval. ]");

                                 GlobusFileHelper.AppendStringToTextfileNewLine("Your membership is pending approval on a Group:" + grpDisplay[2], Globals.path_GroupUpdate);
                                 GlobusFileHelper.AppendStringToTextfileNewLine("Message Header: " + PostGrpAttachLink + " Not Posted on Group:" + grpDisplay[2] + " Because Your membership is pending for approval. ", Globals.path_GroupUpdate);
                                 GlobusFileHelper.AppendStringToTextfileNewLine("Message More Details: " + PostGrpAttachLink + " Not Posted on Group:" + grpDisplay[2] + " Because Your membership is pending for approval. ", Globals.path_GroupUpdate);
                             }
                             else if (ResponseStatusMsg.Contains("Your post has been submitted for review"))
                             {
                                 Log("[ " + DateTime.Now + " ] => [ Message Header Posted : " + PostGrpAttachLink + " Successfully on Group : " + grpDisplay[2] + " ]");
                                 Log("[ " + DateTime.Now + " ] => [ Your post has been submitted for review ]");
                                 string CSV_Content = user + "," + PostGrpAttachLink + "," + PostGrpAttachLink + "," + grpDisplay[2];

                             }

                             else if (ResponseStatusMsg.Contains("Error"))
                             {
                                 Log("[ " + DateTime.Now + " ] => [ Error in Post ]");
                                 GlobusFileHelper.AppendStringToTextfileNewLine("Error in Post", Globals.path_GroupUpdate);

                             }
                             else
                             {
                                 Log("[ " + DateTime.Now + " ] => [ Message Not Posted ]");
                                 GlobusFileHelper.AppendStringToTextfileNewLine("Message Not Posted", Globals.path_GroupUpdate);
                             }

                             if (counter < selectedItems.Count())
                             {
                                 int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                                 Log("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                                 Thread.Sleep(delay * 1000);
                             }

                         }
                         catch (Exception ex)
                         {
                             GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update --> cmbGroupUser_SelectedIndexChanged() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + "    Stack Trace >>> " + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                             Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");
                         }
                     }
                 }
                 catch (Exception ex)
                 {
                     GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update --> cmbGroupUser_SelectedIndexChanged() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                     GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update --> cmbGroupUser_SelectedIndexChanged() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                     Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");
                 }

             }
             catch (Exception ex)
             {
                 GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update --> cmbGroupUser_SelectedIndexChanged() ---2--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                 GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update --> cmbGroupUser_SelectedIndexChanged() ---2--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
             }
        }
Ejemplo n.º 18
0
        public void UrlShare(ref GlobusHttpHelper objGlobusHttpHelper, string username, string password, string proxyAddress, string proxyPort, string proxyUserName, string proxyPassword, string webUrlAndText)
        {
            try
            {
                if (_isStop_Share)
                {
                    return;
                }
                lstShareThread.Add(Thread.CurrentThread);
                lstShareThread = lstShareThread.Distinct().ToList();
                Thread.CurrentThread.IsBackground = true;

                AddLoggerShare("[ " + DateTime.Now + " ] => [ Starting process to share the link on account : " + username + " ]");

                string getResponseWebUrl = string.Empty;
                string shareUrl = string.Empty;
                string csrfToken = string.Empty;
                string contentId = string.Empty;
                string contentUrl = string.Empty;
                string contentResolvedUrl = string.Empty;
                string contentType = string.Empty;
                string contentTitle = string.Empty;
                string contentDescription = string.Empty;
                string mentions = "%5B%5D";
                string shareText = string.Empty;
                string webUrl = string.Empty;
                string distNetwork = string.Empty;
                try
                {
                    if (webUrlAndText.Contains(";"))
                    {
                        string[] url_Text_Split = Regex.Split(webUrlAndText, ";");
                        webUrl = url_Text_Split[0];
                        shareText = url_Text_Split[1];
                    }
                    else
                    {
                        webUrl = webUrlAndText;
                    }

                }
                catch
                { }

                try
                {
                    if (!webUrl.Contains("http"))
                    {
                        webUrl = "http://" + webUrl;
                    }
                }
                catch
                { }

                getResponseWebUrl = objGlobusHttpHelper.getHtmlfromUrl(new Uri(webUrl));
                shareUrl = "https://www.linkedin.com/sharing/share?url=" + Uri.EscapeDataString(webUrl) + "&trk=LI_BADGE";
                string getResponseShareUrl = objGlobusHttpHelper.getHtmlfromUrl(new Uri(shareUrl));
                if (!getResponseShareUrl.Contains("csrfToken"))
                {
                    Thread.Sleep(3000);
                    getResponseShareUrl = objGlobusHttpHelper.getHtmlfromUrl(new Uri(shareUrl));
                    if (!getResponseShareUrl.Contains("csrfToken"))
                    {
                        Thread.Sleep(3000);
                        getResponseShareUrl = objGlobusHttpHelper.getHtmlfromUrl(new Uri(shareUrl));
                    }
                }
                csrfToken = getBetween(getResponseShareUrl, "\"csrfToken\":\"", "\"");
                contentId = getBetween(getResponseShareUrl, "name=\"content.id\" value=\"", "\"");
                contentUrl = getBetween(getResponseShareUrl, "name=\"content.url\" value=\"", "\"");
                contentResolvedUrl = getBetween(getResponseShareUrl, "name=\"content.resolvedUrl\" value=\"", "\"");
                contentType = getBetween(getResponseShareUrl, "name=\"contentType\" value=\"", "\"");
                contentTitle = getBetween(getResponseShareUrl, "name=\"content.title\" value=\"", "\"");
                distNetwork = "PUBLIC";

                string webActionTrackUrl = "https://www.linkedin.com/lite/web-action-track?csrfToken=" + Uri.EscapeDataString(csrfToken);
                string webActionPostData = "pkey=cws-share-widget&tcode=shr-unwnd-sccss&plist=";
                string postResponseWebAction = objGlobusHttpHelper.postFormData(new Uri(webActionTrackUrl), webActionPostData);

                string postResponseInfluencer = objGlobusHttpHelper.postFormData(new Uri("https://www.linkedin.com/nhome/influencer-entitlement"), string.Empty);

                string finalPostUrl = "https://www.linkedin.com/sharing/share?trk=LI_BADGE";
                string postDataFinalPost = "csrfToken=" + csrfToken + "&content.id=" + contentId + "&content.url=" + Uri.EscapeDataString(contentUrl) + "&content.resolvedUrl=" + Uri.EscapeDataString(contentResolvedUrl) + "&contentType=" + contentType + "&content.title=" + contentTitle + "&content.description=" + contentDescription + "&mentions=" + mentions + "&shareText=" + shareText.Replace(" ", "+") + "&dist.networks%5B0%5D=" + distNetwork;
                string responseFinalPost = objGlobusHttpHelper.postFormData(new Uri(finalPostUrl), postDataFinalPost);

                if (responseFinalPost.Contains("\"status\":\"SUCCESS\""))
                {
                    AddLoggerShare("[ " + DateTime.Now + " ] => [ Successfully shared URL" + shareUrl + " on the account : " + username + " ]");
                }
                else
                {
                    AddLoggerShare("[ " + DateTime.Now + " ] => [ Sharing unsuccessful URL" + shareUrl + " on the account : " + username + " ]");
                }

            }
            catch
            { }
        }
Ejemplo n.º 19
0
        public static void RequestJSCSSIMG(string pageSource, ref GlobusHttpHelper HttpHelper)
        {
            ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

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

            //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));
                            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));
                                    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));
                                        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));
                    string res = HttpHelper.getHtmlfromUrl(new Uri(item));
                }
                catch { };
            }
        }
Ejemplo n.º 20
0
        public Dictionary<string, string> PostAddMembers(ref GlobusHttpHelper HttpHelper, string user)
        {
            try
            {
                if (!Globals.IsStop)
                {
                    Globals.lstComposeMessageThread.Add(Thread.CurrentThread);
                    Globals.lstComposeMessageThread.Distinct().ToList();
                    Thread.CurrentThread.IsBackground = true;
                }
            }
            catch
            { }
            try
            {

                string MemId = string.Empty;
                string MemFName = string.Empty;
                string MemLName = string.Empty;
                string MemFullName = string.Empty;
                string Memfullname1 = string.Empty;
                string memID1 = string.Empty;
                string MemId1 = string.Empty;

                this.HttpHelper = HttpHelper;

                #region Commented Universal code

                string pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/contacts/api/contacts/?&sortOrder=recent&source=LinkedIn"));

                if (!pageSource.Contains("success"))
                {
                    for (int i = 1; i <= 2; i++)
                    {
                        Thread.Sleep(4000);
                        pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/contacts/api/contacts/?&sortOrder=recent&source=LinkedIn"));
                        if (pageSource.Contains("success"))
                        {
                            break;
                        }

                    }
                }

                string[] RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "{\"name\"");

                foreach (var Members in RgxGroupData)
                {
                    string Fname = string.Empty;
                    string Title = string.Empty;

                    if (Members.Contains("title"))
                    {
                        try
                        {
                            try
                            {
                                int startindex = Members.IndexOf(", \"id\": \"li_");
                                string start = Members.Substring(startindex).Replace(", \"id\": \"li_", string.Empty);
                                int endIndex = start.IndexOf("\"}");
                                MemId1 = start.Substring(0, endIndex).Replace("{[", string.Empty).Replace("}]", string.Empty).Trim();
                                MemId = user + ':' + MemId1;
                                Globals.groupStatusString = "withoutAPI because of li_";
                            }
                            catch
                            {
                                int startindex = Members.IndexOf(", \"id\":");
                                string start = Members.Substring(startindex).Replace(", \"id\":", string.Empty);
                                int endIndex = start.IndexOf("},");
                                MemId1 = start.Substring(0, endIndex).Replace("{[", string.Empty).Replace("},", string.Empty).Trim();
                                MemId = user + ':' + MemId1;

                                Globals.groupStatusString = "API";
                            }

                            int StartIndex1 = Members.IndexOf(": \"");
                            if (StartIndex1 == 0)
                            {
                                string Start = Members.Substring(StartIndex1).Replace(": \"", string.Empty);
                                int EndIndex = Start.IndexOf("\",");
                                string End = Start.Substring(0, EndIndex);
                                Fname = End.Replace(",",";").Replace("&#xe3;", "ã").Replace("&#xe7;", "ç").Replace("&#xf4;", "ô").Replace("&#xe9;", "é").Replace("&#xba;", "º").Replace("&#xc1;", "Á").Replace("&#xb4;", "'").Replace("&#xed;", "í").Replace("&#xf5;", "õ").Replace("&#xf3;", "ó").Replace("&#xe1;", "á").Replace("&#xea;", "ê").Replace("&#xe0;", "à").Replace("&#xfc;", "ü").Replace("&#xe4;", "ä").Replace("&#xf6;", "ö").Replace("&#xfa;", "ú").Replace("&#xf4;", "ô").Replace("&#xc9;", "É").Replace("&#xe2;", "â").Replace("&#x113;", "ē").Replace("&#xd3;", "Ó").Replace("&#xf1;", "ñ").Replace("&#x20ac;", "€").Replace("&#xd1;", "Ñ").Replace("&#xe8;", "è").Replace("&#xd3;", "Ó").Replace("&#xaa;", "ª").Replace("&#x2605;", "★").Replace("&#x2606;", "☆").Replace("&#xf1;", "ñ").Replace("&#xc0;", "À").Replace("&#x263a;", "☺").Replace("&#xbf;", "¿").Replace("\\u00ae", "®").Replace("{[", string.Empty).Replace("}]", string.Empty);
                            }

                            int StartIndextemp = Members.IndexOf("title\":");
                            if (StartIndextemp > 0)
                            {
                                string Start = Members.Substring(StartIndextemp).Replace("title\":", string.Empty);
                                int EndIndex = Start.IndexOf(",");
                                string End = Start.Substring(0, EndIndex).Replace("\"","").Trim();
                                Title = End.Replace(",", ";").Replace("&#xe3;", "ã").Replace("&#xe7;", "ç").Replace("&#xf4;", "ô").Replace("&#xe9;", "é").Replace("&#xba;", "º").Replace("&#xc1;", "Á").Replace("&#xb4;", "'").Replace("&#xed;", "í").Replace("&#xf5;", "õ").Replace("&#xf3;", "ó").Replace("&#xe1;", "á").Replace("&#xea;", "ê").Replace("&#xe0;", "à").Replace("&#xfc;", "ü").Replace("&#xe4;", "ä").Replace("&#xf6;", "ö").Replace("&#xfa;", "ú").Replace("&#xf4;", "ô").Replace("&#xc9;", "É").Replace("&#xe2;", "â").Replace("&#x113;", "ē").Replace("&#xd3;", "Ó").Replace("&#xf1;", "ñ").Replace("&#x20ac;", "€").Replace("&#xd1;", "Ñ").Replace("&#xe8;", "è").Replace("&#xd3;", "Ó").Replace("&#xaa;", "ª").Replace("&#x2605;", "★").Replace("&#x2606;", "☆").Replace("&#xf1;", "ñ").Replace("&#xc0;", "À").Replace("&#x263a;", "☺").Replace("&#xbf;", "¿").Replace("\\u00ae", "®").Replace("{[", string.Empty).Replace("}]", string.Empty);
                                if (Title == "null")
                                {
                                    Title = "N/A";
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 1 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 1 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddFriendsGroupErrorLogs);
                        }
                #endregion

                        MemFullName = Fname;

                        try
                        {

                            if (!string.IsNullOrEmpty(MemId1))
                            {
                                string MemUrl = "https://www.linkedin.com/contacts/view?id=" + MemId1; //"https://www.linkedin.com/profile/view?id=" + MemId1;
                                //string memResponse = HttpHelper.getHtmlfromUrl(new Uri(MemUrl));
                                //if (memResponse.Contains("is your connection"))
                                //{

                                    //if (!string.IsNullOrEmpty(Title))
                                    {
                                        MemberNameAndID.Add(MemId, MemFullName + ":" + Title);
                                    }

                                    GlobusFileHelper.AppendStringToTextfileNewLine(user + " : " + MemFullName, Globals.path_ComposeMessage_FriendList);
                                    Logger("[ " + DateTime.Now + " ] => [ Added member : " + MemFullName + " ]");

                                    string tempFinalData = user + "," + MemFullName + "," + MemId1 + "," + MemUrl + "," + Title;
                                    AddingLinkedInDataToCSVFile(tempFinalData);

                                    string Query = "INSERT INTO tb_endorsement (FriendName, FriendId,Username,Status) VALUES ('" + MemFullName + "', '" + MemId1 + "','" + user + "','0')";
                                    DataBaseHandler.InsertQuery(Query, "tb_endorsement");

                                    if (moduleLog == "endorsecamp")
                                    {
                                        Log_Endorse("[ " + DateTime.Now + " ] => [ Insert Member ID " + MemId1 + " of " + (MemFullName) + " ]");
                                    }
                               // }
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 2 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 2 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddFriendsGroupErrorLogs);
                        }
                    }
                }

                #region (Marry loadness) proxy issue

                // while (i < Convert.ToInt16(totalPageNumber))
                {
                    if (MemberNameAndID.Count() == 0)
                    {

                        #region commented
                        //string pageSource1 = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/contacts/api/contacts/?start=0&count=1"));
                        ////string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/contacts/api/contacts/?start="+i+"&count="+y));
                        //if (pageSource1.Contains("total"))
                        //{
                        //    int sIndex = pageSource1.IndexOf("\"total\"");
                        //    string _start = pageSource1.Substring(sIndex);
                        //    int eIndex = pageSource1.IndexOf(",");
                        //    totalPageNumber = _start.Substring(0, eIndex).Replace("last", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("total", string.Empty).Replace(",", string.Empty).Replace("}", string.Empty).Trim();
                        //}
                        //for (int start = 0; start < Convert.ToInt16(totalPageNumber); start += 10)
                        //{
                        //    pageSource1 = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/contacts/api/contacts/?start=" + start + "&count=10"));

                        //    string[] RgxGroupData1 = System.Text.RegularExpressions.Regex.Split(pageSource1, "{\"name\"");
                        //    foreach (var Members1 in RgxGroupData1)
                        //    {

                        //        if (Members1.Contains("title"))
                        //        {
                        //            string Fname1 = string.Empty;
                        //            try
                        //            {

                        //                int startindex2 = Members1.IndexOf(", \"id\"");
                        //                string start2 = Members1.Substring(startindex2);
                        //                int endIndex2 = start2.IndexOf("}");
                        //                // int endIndex2 = start2.IndexOf("class=");
                        //                //MemId = start2.Substring(0, endIndex2).Replace("\"", string.Empty).Trim().Replace(",", string.Empty);
                        //                MemId = start2.Substring(0, endIndex2).Replace("\"", string.Empty).Trim().Replace("li_", string.Empty).Replace(",", string.Empty).Split(':')[1];
                        //                MemId = user + ':' + MemId;

                        //                int StartIndex3 = Members1.IndexOf(":");
                        //                string Start3 = Members1.Substring(StartIndex3).Replace(":", string.Empty);
                        //                int EndIndex3 = Start3.IndexOf("title");
                        //                string End = Start3.Substring(0, EndIndex3).Replace("\"", string.Empty).Trim().Replace(",", string.Empty); ;
                        //                Fname1 = End;

                        //            }
                        //            catch (Exception ex)
                        //            {
                        //                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 3 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                        //                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 3 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddFriendsGroupErrorLogs);
                        //            }

                        //            MemFullName = Fname1;

                        //            try
                        //            {
                        //                MemberNameAndID.Add(MemId, MemFullName);
                        //            }
                        //            catch (Exception ex)
                        //            {
                        //                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 4 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                        //                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 4 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddFriendsGroupErrorLogs);
                        //            }

                        //        }
                        //    }
                        //}
                        #endregion

                        int pagenumber = 0;
                        //   string pagesource1 = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/people/conn-list-view?fetchConnsFromDB=true"));

                        string pagesource1 = string.Empty;
                        int tempcount = 0;
                        //  while(!((pagesource1.Contains("No se han encontrado contactos que coincidan con estos filtros") || (pagesource1.Contains("No contacts found")))

                        do
                        {
                            grpmem("[ " + DateTime.Now + " ] => [ Adding members from page " + (pagenumber+1)+ " ]");

                            pagesource1 = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/people/conn-list-view?fetchConnsFromDB=true&pageNum=" + pagenumber));
                            if (string.IsNullOrEmpty(pagesource1))
                            {
                                for (int i = 1; i <= 2; i++)
                                {
                                    Thread.Sleep(5000);
                                    pagesource1 = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/people/conn-list-view?fetchConnsFromDB=true&pageNum=" + pagenumber));
                                    if (pagesource1.Contains("conx-list"))
                                    {
                                        break;
                                    }

                                }
                            }
                            string[] RgxGroupData1 = System.Text.RegularExpressions.Regex.Split(pagesource1, "<li id=\"");
                            foreach (var members1 in RgxGroupData1)
                            {
                                string Fname1 = string.Empty;
                                string memID2 = string.Empty;
                                string title = string.Empty;
                                if (members1.Contains("<div class=\"conn-wrapper\">"))
                                {
                                    try
                                    {
                                        int startindex1 = members1.IndexOf("");
                                        string start1 = members1.Substring(startindex1);
                                        int endIndex = start1.IndexOf("\"");
                                        memID2 = start1.Substring(0, endIndex).Trim();
                                        string ID = memID2;
                                        memID1 = user + ':' + memID2;

                                        #region commented

                                        //int StartIndex2 = members1.IndexOf("conn-name_" + ID + "\"");

                                        //string Start = members1.Substring(StartIndex2).Replace(">", string.Empty);
                                        //int EndIndex = Start.IndexOf("<");
                                        //string End = Start.Substring(0, EndIndex).Replace("conn-name_", "").Replace(ID, "").Replace("\"", "");
                                        //Fname1 = End.Replace("&#xe3;", "ã").Replace("&#xe7;", "ç").Replace("&#xf4;", "ô").Replace("&#xe9;", "é").Replace("&#xba;", "º").Replace("&#xc1;", "Á").Replace("&#xb4;", "'").Replace("&#xed;", "í").Replace("&#xf5;", "õ").Replace("&#xf3;", "ó").Replace("&#xe1;", "á").Replace("&#xea;", "ê").Replace("&#xe0;", "à").Replace("&#xfc;", "ü").Replace("&#xe4;", "ä").Replace("&#xf6;", "ö").Replace("&#xfa;", "ú").Replace("&#xf4;", "ô").Replace("&#xc9;", "É").Replace("&#xe2;", "â").Replace("&#x113;", "ē").Replace("&#xd3;", "Ó").Replace("&#xf1;", "ñ").Replace("&#x20ac;", "€").Replace("&#xd1;", "Ñ").Replace("&#xe8;", "è").Replace("&#xd3;", "Ó").Replace("&#xaa;", "ª").Replace("&#x2605;", "★").Replace("&#x2606;", "☆").Replace("&#xf1;", "ñ").Replace("&#xc0;", "À").Replace("&#x263a;", "☺").Replace("&#xbf;", "¿");

                                        #endregion

                                        int StartIndex2 = members1.IndexOf("type=\"checkbox\" value=");

                                        string Start = members1.Substring(StartIndex2).Replace("type=\"checkbox\" value=", string.Empty);
                                        int EndIndex = Start.IndexOf("/>");
                                        string End = Start.Substring(0, EndIndex).Replace("conn-name_", "").Replace(ID, "").Replace("\"", "").Replace("\"","").Replace(">","");
                                        Fname1 = End.Replace(",", ";").Replace("&#xe3;", "ã").Replace("&#xe7;", "ç").Replace("&#xf4;", "ô").Replace("&#xe9;", "é").Replace("&#xba;", "º").Replace("&#xc1;", "Á").Replace("&#xb4;", "'").Replace("&#xed;", "í").Replace("&#xf5;", "õ").Replace("&#xf3;", "ó").Replace("&#xe1;", "á").Replace("&#xea;", "ê").Replace("&#xe0;", "à").Replace("&#xfc;", "ü").Replace("&#xe4;", "ä").Replace("&#xf6;", "ö").Replace("&#xfa;", "ú").Replace("&#xf4;", "ô").Replace("&#xc9;", "É").Replace("&#xe2;", "â").Replace("&#x113;", "ē").Replace("&#xd3;", "Ó").Replace("&#xf1;", "ñ").Replace("&#x20ac;", "€").Replace("&#xd1;", "Ñ").Replace("&#xe8;", "è").Replace("&#xd3;", "Ó").Replace("&#xaa;", "ª").Replace("&#x2605;", "★").Replace("&#x2606;", "☆").Replace("&#xf1;", "ñ").Replace("&#xc0;", "À").Replace("&#x263a;", "☺").Replace("&#xbf;", "¿");

                                        int starttemp = members1.IndexOf("<span class=\"company-name\">");
                                        string startonetemp = members1.Substring(starttemp).Replace("<span class=\"company-name\">", "");
                                        int endIndextemp = startonetemp.IndexOf("</span>");
                                        title = startonetemp.Substring(0, endIndextemp).Trim();

                                        if (title == "null")
                                        {
                                            title = "N/A";
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 1 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 1 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddFriendsGroupErrorLogs);
                                    }

                                }
                                //      #endregion

                                Memfullname1 = Fname1;

                                try
                                {

                                    if (!string.IsNullOrEmpty(memID2))
                                    {

                                        //if (!string.IsNullOrEmpty(title))
                                        {
                                            MemberNameAndID.Add(memID1, Memfullname1 + ":" + title);
                                        }

                                        GlobusFileHelper.AppendStringToTextfileNewLine(user + " : " + Fname1, Globals.path_ComposeMessage_FriendList);
                                        Globals.groupStatusString = "withoutAPI";
                                        string MemUrl = "https://www.linkedin.com/profile/view?id="+memID2;

                                        string tempFinalData = user + "," + Memfullname1 + "," + memID2 + "," + MemUrl + "," + title;
                                        AddingLinkedInDataToCSVFile(tempFinalData);

                                        string Query = "INSERT INTO tb_endorsement (FriendName, FriendId,Username,Status) VALUES ('" + Memfullname1 + "', '" + memID2 + "','" + user + "','0')";
                                        DataBaseHandler.InsertQuery(Query, "tb_endorsement");
                                        tempcount = 0;
                                        if (moduleLog == "endorsecamp")
                                        {
                                            Log_Endorse("[ " + DateTime.Now + " ] => [ Insert Member ID " + memID2 + " of " + (Memfullname1) + " ]");
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    tempcount++;
                                    if (tempcount == 15)
                                    {
                                        return MemberNameAndID;
                                    }
                                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 2 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 2 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddFriendsGroupErrorLogs);
                                }

                            }
                            #region comment
                            // string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/people/connections?trk=nav_responsive_sub_nav_network"));
                            //  pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/home?goback="));
                            //if (pageSource1.Contains("total"))
                            //{
                            //    int sIndex = pageSource1.IndexOf("\"total\"");
                            //    string _start = pageSource1.Substring(sIndex);
                            //    int eIndex = pageSource1.IndexOf(",");
                            //    totalPageNumber = _start.Substring(0, eIndex).Replace("last", string.Empty).Replace(":", string.Empty).Replace("\"", string.Empty).Replace("total", string.Empty).Replace(",", string.Empty).Replace("}", string.Empty).Trim();
                            //}
                            //for (int start = 0; start < Convert.ToInt16(totalPageNumber); start += 10)
                            /*   {
                                   //pageSource1 = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/contacts/api/contacts/?start=" + start + "&count=10"));

                                   string[] RgxGroupData1 = System.Text.RegularExpressions.Regex.Split(pageSource1, "memberId:");
                                   RgxGroupData1 = RgxGroupData1.Skip(1).ToArray();
                                   foreach (var Members1 in RgxGroupData1)
                                   {

                                       if (Members1.Contains("fullName"))
                                       {
                                           string Fname1 = string.Empty;
                                           try
                                           {

                                               int startindex2 = Members1.IndexOf("");
                                               string start2 = Members1.Substring(startindex2);
                                               int endIndex2 = start2.IndexOf(",");
                                               // int endIndex2 = start2.IndexOf("class=");
                                               //MemId = start2.Substring(0, endIndex2).Replace("\"", string.Empty).Trim().Replace(",", string.Empty);
                                               MemId = start2.Substring(0, endIndex2).Replace("\"", string.Empty).Trim().Replace("li_", string.Empty).Replace(",", string.Empty).Replace("'","");
                                               MemId = user + ':' + MemId;

                                               int StartIndex3 = Members1.IndexOf("fullName:");
                                               string Start3 = Members1.Substring(StartIndex3).Replace("fullName:", string.Empty);
                                               int EndIndex3 = Start3.IndexOf(",");
                                               string End = Start3.Substring(0, EndIndex3).Replace("\"", string.Empty).Trim().Replace(",", string.Empty).Replace("'","").Trim();
                                               Fname1 = End;

                                           }
                                           catch (Exception ex)
                                           {
                                               GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 3 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                               GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 3 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddFriendsGroupErrorLogs);
                                           }

                                           MemFullName = Fname1;

                                           try
                                           {
                                               MemberNameAndID.Add(MemId, MemFullName);
                                           }
                                           catch (Exception ex)
                                           {
                                               GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 4 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                               GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 4 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddFriendsGroupErrorLogs);
                                           }

                                       }
                                   }
                               } */
                            #endregion comment

                            pagenumber++;

                        } while (!(pagesource1.Contains("No se han encontrado contactos que coincidan con estos filtros") || (pagesource1.Contains("No contacts found")) || (pagesource1.Contains("No connections match your filter criteria"))));
                    }                   //if loop ends
                }
                #endregion

                return MemberNameAndID;
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 5 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 5 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddFriendsGroupErrorLogs);
                return MemberNameAndID;
            }
        }
Ejemplo n.º 21
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 { };
        }
Ejemplo n.º 22
0
        public Dictionary<string, string> PostaddMembersWithExcelInput(ref GlobusHttpHelper Httphelper, string user)
        {
            try
            {
                if (!Globals.IsStop)
                {
                    Globals.lstComposeMessageThread.Add(Thread.CurrentThread);
                    Globals.lstComposeMessageThread.Distinct().ToList();
                    Thread.CurrentThread.IsBackground = true;
                }
            }
            catch
            { }
            try
            {
                MemberNameAndID.Clear();

                this.HttpHelper = HttpHelper;
               // string pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/contacts/api/"));
                string pagesource = Httphelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/contacts/?filter=recent&trk=nav_responsive_tab_network#?filter=recent&trk=nav_responsive_tab_network"));

                foreach (string[] itemArr in Cmpmsg_excelData)
                {
                    string MemId = string.Empty;
                    string MemFName = string.Empty;
                    string MemLName = string.Empty;
                    string MemFullName = string.Empty;
                    string Memfullname1 = string.Empty;
                    string memID1 = string.Empty;
                    string Name = string.Empty;

                    if (user == itemArr.GetValue(0).ToString())
                    {
                        string URL = itemArr.GetValue(1).ToString();
                        if (!URL.Contains("https://www.linkedin.com/profile/"))
                        {
                            URL = "https://www.linkedin.com/profile/view?id=" + URL;
                        }
                        string PagesrcProfileExcel = Httphelper.getHtmlfromUrl(new Uri(URL));

                        try
                        {
                            int startindex = URL.IndexOf("?id=");
                            string start = URL.Substring(startindex).Replace("?id=", string.Empty);
                            int endindex = start.IndexOf("&");
                            string end = start.Substring(0, endindex).Replace("&", string.Empty);
                            MemId = end.Trim();

                            MemId = user + ":" + MemId;
                        }
                        catch
                        { }

                        if (string.IsNullOrEmpty(MemId))
                        {
                            if (URL.Contains("&id"))
                            {
                                try
                                {
                                    URL = URL + "&&*@";
                                    int startindex1 = URL.IndexOf("&id=");
                                    string start1 = URL.Substring(startindex1).Replace("&id=", string.Empty);
                                    int endindex1 = start1.IndexOf("&&*@");
                                    string end1 = start1.Substring(0, endindex1).Replace("&&*@", string.Empty);
                                    MemId = end1.Trim();
                                    MemId = user + ":" + MemId;
                                }
                                catch
                                { }
                            }
                        }

                        if (string.IsNullOrEmpty(MemId))
                        {
                            if (URL.Contains("?id="))
                            {
                                try
                                {

                                    MemId = URL.Split('=')[1].ToString();
                                    MemId = user + ":" + MemId;
                                }
                                catch
                                { }
                            }
                        }

                        try
                        {
                            int startindex1 = PagesrcProfileExcel.IndexOf("fmt__profileUserFullName\":\"");
                            string start1 = PagesrcProfileExcel.Substring(startindex1).Replace("fmt__profileUserFullName\":\"", string.Empty);
                            int endindex1 = start1.IndexOf(",");
                            string end1 = start1.Substring(0, endindex1).Replace("\"", string.Empty);
                            Name = end1.Trim();

                        }
                        catch
                        { }

                        if (string.IsNullOrEmpty(Name))
                        {
                            try
                            {
                                int startindex1 = PagesrcProfileExcel.IndexOf("span class=\"full-name\">");
                                string start1 = PagesrcProfileExcel.Substring(startindex1).Replace("span class=\"full-name\">", string.Empty);
                                int endindex1 = start1.IndexOf("</span>");
                                string end1 = start1.Substring(0, endindex1).Replace("</span>", string.Empty);
                                Name = end1.Trim();
                            }
                            catch
                            { }
                        }

                        //<span class="full-name" dir="auto">Karla (Keyser) Silver</span><span></span></span></h1>
                        if (string.IsNullOrEmpty(Name))
                        {
                            try
                            {
                                int StartIndex = PagesrcProfileExcel.IndexOf("<span class=\"full-name\"");
                                string Start = PagesrcProfileExcel.Substring(StartIndex).Replace("<span class=\"full-name\"", string.Empty);
                                int EndIndex = Start.IndexOf("</span>");
                                string End = Start.Substring(0, EndIndex).Replace("dir=\"auto\"", string.Empty).Replace(">", string.Empty).Replace(",", string.Empty).Trim();
                                Name = End.Trim();
                            }
                            catch
                            { }
                        }

                        Memfullname1 = Name;

                        try
                        {
                            if (!string.IsNullOrEmpty(Name))
                            {
                                MemberNameAndID.Add(MemId, Memfullname1);
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 2 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Friends Groups --> PostAddMembers() >> 2 >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddFriendsGroupErrorLogs);
                        }
                    }
                }
                return MemberNameAndID;

            }
            catch { return MemberNameAndID; }
        }
Ejemplo n.º 23
0
        public static List<string> GetAllFriends(ref GlobusHttpHelper globusHttpHelper, string userId)
        {
            List<string> finalList_Friends = new List<string>();

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

            try
            {
                string pgSource_Friends = globusHttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/profile.php?id=" + userId + "&sk=friends"));////fbProfileUrl = "https://www.facebook.com/profile.php?id=";

                string[] Friends = Regex.Split(pgSource_Friends, "user.php");

                ParseFriendIDs(Friends, finalList_Friends);

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

                // {"collection_token":"1220529617:2356318349:2","cursor":"MDpub3Rfc3RydWN0dXJlZDoxMDAwMDA5MjM1MTg5MjY=","tab_key":"friends","profile_id":1220529617,"overview":false,"ftid":null,"order":null,"sk":"friends"}


                string collection_token = "";
                string cursor = "";

                //check if all friends loaded
                string patternAllFriendsLoaded = "\"TimelineAppCollection\",\"setFullyLoaded\",[],[\"pagelet_timeline_app_collection_";

                int tempCount_AjaxRequests = 0;

                do //
                {
                    try
                    {
                        collection_token = "";
                        cursor = "";

                        string[] arry = Regex.Split(pgSource_Friends, "enableContentLoader");
                        if (arry.Length > 1)
                        {
                            try
                            {
                                string rawData = arry[1];

                                int startIndx_collection_token = rawData.IndexOf("pagelet_timeline_app_collection_") + "pagelet_timeline_app_collection_".Length;
                                int endIndx_collection_token = rawData.IndexOf("\"", startIndx_collection_token);
                                collection_token = rawData.Substring(startIndx_collection_token, endIndx_collection_token - startIndx_collection_token);

                                int startIndx_cursor = rawData.IndexOf(",\"", endIndx_collection_token) + ",\"".Length;
                                int endIndx_cursor = rawData.IndexOf("\"", startIndx_cursor);
                                cursor = rawData.Substring(startIndx_cursor, endIndx_cursor - startIndx_cursor);
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                            }

                        }

                        string raw_data = "{\"collection_token\":\"" + collection_token + "\",\"cursor\":\"" + cursor + "\",\"tab_key\":\"friends\",\"profile_id\":" + userId + ",\"overview\":false,\"ftid\":null,\"order\":null,\"sk\":\"friends\"}";
                        string encoded_raw_data = Uri.EscapeDataString(raw_data);

                        string getURL_MoreFriendsAjax = "https://www.facebook.com/ajax/pagelet/generic.php/AllFriendsAppCollectionPagelet?data=" + encoded_raw_data + "&__user="******"&__a=1&__dyn=7n8ahyj2qmudwNAEU&__req=2";
                        string res_getURL_MoreFriendsAjax = globusHttpHelper.getHtmlfromUrl(new Uri(getURL_MoreFriendsAjax));

                        pgSource_Friends = res_getURL_MoreFriendsAjax;

                        string[] arry_UserData = Regex.Split(pgSource_Friends, "user.php");

                        ParseFriendIDs(arry_UserData, finalList_Friends);                       

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

                } while ((collection_token != "" && cursor != "") || tempCount_AjaxRequests < 15 || pgSource_Friends.Contains(patternAllFriendsLoaded));



                finalList_Friends.ForEach(delegate(String friendID)
                {
                    if (friendID.Contains("&"))
                    {
                        friendID = friendID.Remove(friendID.IndexOf("&"));

                    }
                  
                    list_finalFriendsID.Add(friendID);
                });

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

            return list_finalFriendsID;
        }
Ejemplo n.º 24
0
        public Dictionary<string, string> PostCreateGroupNames(ref GlobusHttpHelper HttpHelper, string user)
        {
            try
            {
                 string 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 == "" || 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.getHtmlfromUrl1(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.getHtmlfromUrl1(new Uri("http://www.linkedin.com/myGroups?trk=nav_responsive_sub_nav_groups"));
                }

                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 + ':' + user;
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update1 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                    }

                                    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)
                                    {
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus2 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update2 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                    }

                                    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)
                                        {
                                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus3 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update3 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                        }
                                    }
                                    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 { }
                                }

                            }

                            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 + ':' + user;
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus4 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update4 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                    }

                                    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)
                                    {
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus5 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update5 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                    }

                                    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)
                                        {
                                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus6 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update6 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                        }
                                    }
                                    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("View More</span>"))
                    {
                        pageSource = Utils.getBetween(pageSource, "<ul class=\"group-list\">", "View More</span>");
                    }
                    else
                    {
                        pageSource = Utils.getBetween(pageSource, "<ul class=\"group-list\">", "<li class=\"find-more\">");
                    }
                    string[] RgxGroupData = Regex.Split(pageSource, "<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;","'");
                                        if (endName.Contains("<div group-activity"))
                                        {
                                            endIndex = endName.IndexOf("<h3");
                                            endName = endName.Substring(0, endIndex).Replace("<h3", "").Replace("<div group-activity", "");
                                        }
                                        endName = endName + ':' + user;
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update1 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                    }

                                    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)
                                    {
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus2 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update2 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                    }

                                    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)
                                        {
                                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus3 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update3 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                        }
                                    }
                                    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 { }
                    }
                }

                return GroupName;
            }
            catch (Exception ex)
            {
                return GroupName;
            }
        }
        public string ExtractIDUsingGraphAPI(string URL, ref GlobusHttpHelper HttpHelper)
        {
            string profileID = string.Empty;

            try
            {
                if (URL.Contains("id="))
                {
                    profileID = URL.Replace(URL.Remove(URL.IndexOf("id=") + "id=".Length), "");
                    return profileID;
                }

                int startIndx = URL.LastIndexOf("/");
                string name = URL.Substring(startIndx).Replace("/", "");

                string response = HttpHelper.getHtmlfromUrl(new Uri("https://graph.facebook.com/" + name));
                profileID = ParseJsonGraphAPI(response, "id");
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }

            return profileID;
        }
        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 bool AddaPicture(ref GlobusHttpHelper HttpHelper, string Username, string Password, string localImagePath, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, string targeturl, string message, ref string status, string pageSource_Home, string xhpc_targetid, string xhpc_composerid, string message_text, string fb_dtsg, string UsreId)
       {

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



           bool isSentPicMessage = false;
           //string fb_dtsg = string.Empty;
           string photo_id = string.Empty;
           //string UsreId = string.Empty;
           //xhpc_composerid = string.Empty;
           //xhpc_targetid = string.Empty;
           //message_text = string.Empty;

           try
           {
               #region commentedCode


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

               //UsreId = GlobusHttpHelper.GetParamValue(pageSource_Home, "user");
               //if (string.IsNullOrEmpty(UsreId))
               //{
               //    UsreId = GlobusHttpHelper.ParseJson(pageSource_Home, "user");
               //}

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


               //string pageSource_HomeData = HttpHelper.getHtmlfromUrl(new Uri(targeturl));
               //xhpc_composerid = GlobusHttpHelper.GetParamValue(pageSource_HomeData, "composerid");
               //xhpc_targetid = GlobusHttpHelper.GetParamValue(pageSource_HomeData, "xhpc_targetid"); 
               #endregion

               string composer_session_id = "";

               string tempresponse1 = "";
               ///temp post
               {
                   string source = "";
                   string profile_id = "";
                   string gridID = "";
                   string qn = string.Empty;

                   try
                   {
                       string Url = "https://upload.facebook.com/ajax/composerx/attachment/media/saveunpublished?target_id=139180732957326&__user=100007423262870&__a=1&__dyn=7n88Oq9ccmqDxl2u5Fa8HzCqm5Aqbx2mbAKGiBAGm&__req=1t&fb_dtsg=AQCehhQg&__rev=1062230";
                       string posturl1 = "fb_dtsg=" + fb_dtsg + "&composerid=" + xhpc_composerid + "&targetid=" + xhpc_targetid + "&loaded_components[0]=maininput&loaded_components[1]=cameraicon&loaded_components[2]=withtaggericon&loaded_components[3]=placetaggericon&loaded_components[4]=mainprivacywidget&loaded_components[5]=cameraicon&loaded_components[6]=mainprivacywidget&loaded_components[7]=withtaggericon&loaded_components[8]=placetaggericon&loaded_components[9]=maininput&nctr[_mod]=pagelet_group_composer&__user="******"&__a=1&__dyn=7n88QoAMNoBwXAw&__req=i&phstamp=16581688688747595501";    //"fb_dtsg=" + fb_dtsg + "&composerid=" + xhpc_composerid + "&targetid=" + xhpc_targetid + "&istimeline=1&timelinelocation=composer&loaded_components[0]=maininput&loaded_components[1]=mainprivacywidget&loaded_components[2]=mainprivacywidget&loaded_components[3]=maininput&loaded_components[4]=explicitplaceinput&loaded_components[5]=hiddenplaceinput&loaded_components[6]=placenameinput&loaded_components[7]=hiddensessionid&loaded_components[8]=withtagger&loaded_components[9]=backdatepicker&loaded_components[10]=placetagger&loaded_components[11]=withtaggericon&loaded_components[12]=backdateicon&loaded_components[13]=citysharericon&nctr[_mod]=pagelet_timeline_recent&__user="******"&__a=1&__dyn=7n88QoAMNoBwXAw&__req=18&phstamp=1658168111112559866679";
                       // string PostUrl = "city_id=" + CityIDS1 + "&city_page_id=" + city_page_id + "&city_name=" + CityName1 + "&is_default=false&session_id=1362404125&__user="******"&__a=1&__dyn=798aD5z5ynU&__req=z&fb_dtsg=" + fb_dtsg + "&phstamp=1658168111112559866165";
                       string res11 = pageSource_Home;//HttpHelper.postFormData(new Uri(Url), posturl1);


                       try
                       {
                           source = res11.Substring(res11.IndexOf("source\":"), (res11.IndexOf(",", res11.IndexOf("source\":")) - res11.IndexOf("source\":"))).Replace("source\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
                       }
                       catch { }
                       try
                       {
                           profile_id = res11.Substring(res11.IndexOf("profile_id\":"), (res11.IndexOf("}", res11.IndexOf("profile_id\":")) - res11.IndexOf("profile_id\":"))).Replace("profile_id\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
                           if (profile_id.Contains(","))
                           {
                               profile_id = ParseEncodedJson(res11, "profile_id");
                           }
                           //"gridID":
                       }
                       catch { }
                       try
                       {
                           gridID = res11.Substring(res11.IndexOf("gridID\":"), (res11.IndexOf(",", res11.IndexOf("gridID\":")) - res11.IndexOf("gridID\":"))).Replace("gridID\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
                       }
                       catch { }
                       try
                       {
                           composer_session_id = res11.Substring(res11.IndexOf("composer_session_id\":"), (res11.IndexOf("}", res11.IndexOf("composer_session_id\":")) - res11.IndexOf("composer_session_id\":"))).Replace("composer_session_id\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
                       }
                       catch { }

                       try
                       {
                           if (string.IsNullOrEmpty(composer_session_id))
                           {
                               composer_session_id = res11.Substring(res11.IndexOf("composerID\":"), (res11.IndexOf("}", res11.IndexOf("composerID\":")) - res11.IndexOf("composerID\":"))).Replace("composerID\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();

                           }
                       }
                       catch { }

                       try
                       {
                           qn = getBetween(res11, "qn\\\" value=\\\"", "\\\" \\/>");
                       }
                       catch { }
                   }
                   catch { }

                   NameValueCollection nvc1 = new NameValueCollection();
                   try
                   {
                       //message = Uri.EscapeDataString(message);
                   }
                   catch { }

                   //xhpc_composerid = GlobusHttpHelper.GetParamValue(pageSource_HomeData, "composerid");
                   //xhpc_targetid = GlobusHttpHelper.GetParamValue(pageSource_HomeData, "xhpc_targetid");
                   //-------------------------------
                   //nvc1.Add("fb_dtsg", fb_dtsg);
                   //nvc1.Add("source", source);
                   //nvc1.Add("profile_id", profile_id);
                   //nvc1.Add("grid_id", gridID);
                   //nvc1.Add("upload_id", "1024");
                   //-----------------------------------
                   nvc1.Add("fb_dtsg", fb_dtsg);
                   nvc1.Add("source", source);
                   nvc1.Add("profile_id", profile_id);
                   nvc1.Add("grid_id", gridID);
                   nvc1.Add("upload_id", "1024");
                   nvc1.Add("qn", qn);

                   //nvc1.Add("fb_dtsg", fb_dtsg);
                   //nvc1.Add("source", source);
                   //nvc1.Add("profile_id", profile_id);
                   //nvc1.Add("grid_id", gridID);
                   //nvc1.Add("upload_id", "1024");
                   //nvc1.Add("qn", qn);

                   string _rev = getBetween(pageSource, "svn_rev", ",");
                   _rev = _rev.Replace("\":", string.Empty);


                   string uploadURL = "https://upload.facebook.com/ajax/composerx/attachment/media/saveunpublished?target_id=139180732957326&__user=100007423262870&__a=1&__dyn=7n88Oq9ccmqDxl2u5Fa8HzCqm5Aqbx2mbAKGiBAGm&__req=1t&fb_dtsg=AQCehhQg&__rev=1062230";
                   tempresponse1 = HttpUploadFile_UploadPic_temp(ref HttpHelper, UsreId, uploadURL, "composer_unpublished_photo[]", "image/jpeg", localImagePath, nvc1, "", proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

                   //string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "https://upload.facebook.com/ajax/timeline/cover/upload/", "pic", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

                   //string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "http://upload.facebook.com/media/upload/photos/composer/?__a=1&__adt=3&__iframe=true&__user="******"file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

                   tempresponse1 = HttpUploadFile_UploadPic_temp(ref HttpHelper, UsreId, "https://upload.facebook.com/ajax/composerx/attachment/media/saveunpublished?target_id=" + xhpc_targetid + "&__user="******"&__a=1&__dyn=7n88QoAMNoBwXAw&__req=l&fb_dtsg=" + fb_dtsg + "", "composer_unpublished_photo[]", "image/jpeg", localImagePath, nvc1, "", proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

               }

               NameValueCollection nvc = new NameValueCollection();
               try
               {
                   //message = Uri.EscapeDataString(message);
               }
               catch { }
               nvc.Add("fb_dtsg", fb_dtsg);
               nvc.Add("xhpc_targetid", xhpc_targetid);
               nvc.Add("xhpc_context", "profile");
               nvc.Add("xhpc_ismeta", "1");
               nvc.Add("xhpc_fbx", "1");
               nvc.Add("xhpc_timeline", "");
               nvc.Add("xhpc_composerid", xhpc_composerid);
               nvc.Add("xhpc_message_text", message);
               nvc.Add("xhpc_message", message);
               //nvc.Add("name", "file1");
               //nvc.Add("Content-Type:", "image/jpeg");
               //nvc.Add("filename=", "");



               string composer_unpublished_photo = "";
               string start_composer_unpublished_photo = Regex.Split(tempresponse1, "},\"")[1];// 
               int startIndex_composer_unpublished_photo = start_composer_unpublished_photo.IndexOf(",\"") + ",\"".Length;
               int endIndex_composer_unpublished_photo = start_composer_unpublished_photo.IndexOf("\"", startIndex_composer_unpublished_photo + 1);

               composer_unpublished_photo = start_composer_unpublished_photo.Substring(startIndex_composer_unpublished_photo, endIndex_composer_unpublished_photo - startIndex_composer_unpublished_photo);

               ///New test upload pic post
               string waterfallid = GlobusHttpHelper.ParseJson(pageSource_Home, "waterfallID");

               string newpostURL = "https://upload.facebook.com/media/upload/photos/composer/?__user="******"&__a=1&__dyn=7n88QoAMNoBwXAw&__req=r&fb_dtsg=" + fb_dtsg + "";
               string newPostData = "";


               NameValueCollection newnvc = new NameValueCollection();
               try
               {
                   //message = Uri.EscapeDataString(message);
               }
               catch { }
               newnvc.Add("fb_dtsg", fb_dtsg);
               newnvc.Add("xhpc_targetid", xhpc_targetid);
               newnvc.Add("xhpc_context", "profile");
               newnvc.Add("xhpc_ismeta", "1");
               newnvc.Add("xhpc_fbx", "1");
               newnvc.Add("xhpc_timeline", "");
               newnvc.Add("xhpc_composerid", xhpc_composerid);
               newnvc.Add("xhpc_message_text", message);
               newnvc.Add("xhpc_message", message);

               newnvc.Add("composer_unpublished_photo[]", composer_unpublished_photo);
               newnvc.Add("album_type", "128");
               newnvc.Add("is_file_form", "1");
               newnvc.Add("oid", "");
               newnvc.Add("qn", waterfallid);
               newnvc.Add("application", "composer");
               newnvc.Add("is_explicit_place", "");
               newnvc.Add("composertags_place", "");
               newnvc.Add("composertags_place_name", "");
               newnvc.Add("composer_session_id", composer_session_id);
               newnvc.Add("composertags_city", "");
               newnvc.Add("vzdisable_location_sharing", "false");
               newnvc.Add("composer_predicted_city", "");

               // string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "https://upload.facebook.com/ajax/timeline/cover/upload/", "pic", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

               // string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "http://upload.facebook.com/media/upload/photos/composer/?__a=1&__adt=3&__iframe=true&__user="******"file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

               string response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, newpostURL, "file1", "image/jpeg", localImagePath, newnvc, targeturl, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);//HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "http://upload.facebook.com/media/upload/photos/composer/?__user="******"&__a=1&__dyn=7n88O49ccm9o-2Ki&__req=1c&fb_dtsg=" + fb_dtsg + "", "file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);



               //http://upload.facebook.com/media/upload/photos/composer/?__a=1&__adt=3&__iframe=true&__user=100004608395129
               if (string.IsNullOrEmpty(response))
               {
                   try
                   {
                       //response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "https://upload.facebook.com/media/upload/photos/composer/?__a=1&__adt=3&__iframe=true&__user="******"file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);
                       response = HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "https://upload.facebook.com/media/upload/photos/composer/?__user="******"&__a=1&__dyn=7n88O49ccm9o-2Ki&__req=1c&fb_dtsg=" + fb_dtsg + "", "file1", "image/jpeg", localImagePath, nvc, targeturl, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

                   }
                   catch { }
               }
               string posturl = "https://www.facebook.com/ajax/places/city_sharer_reset.php";
               string postdata = "__user="******"&__a=1&fb_dtsg=" + fb_dtsg + "&phstamp=1658167761111108210145";
               string responsestring = HttpHelper.postFormData(new Uri(posturl), postdata);
               try
               {
                   string okay = HttpHelper.getHtmlfromUrl(new Uri("https://3-pct.channel.facebook.com/pull?channel=p_" + UsreId + "&seq=3&partition=69&clientid=70e140db&cb=8p7w&idle=8&state=active&mode=stream&format=json"));
               }
               catch
               {
               }

               if (!string.IsNullOrEmpty(response) && response.Contains("photo.php?fbid="))
               {

                   #region PostData_ForCoverPhotoSelect
                   //fb_dtsg=AQCLSjCH&photo_id=130869487061841&profile_id=100004163701035&photo_offset=0&video_id=&save=Save%20Changes&nctr[_mod]=pagelet_main_column_personal&__user=100004163701035&__a=1&phstamp=165816776831066772182 
                   #endregion

                   try
                   {

                       if (!response.Contains("errorSummary") || !response.Contains("error"))
                       {
                           isSentPicMessage = true;
                       }
                       if (response.Contains("Your post has been submitted and is pending approval by an admin"))
                       {
                           GlobusLogHelper.log.Debug("Your post has been submitted and is pending approval by an admin." + "GroupUrl >>>" + targeturl);
                           GlobusLogHelper.log.Info("Your post has been submitted and is pending approval by an admin." + "GroupUrl >>>" + targeturl);
                       }
                   }
                   catch { }
                   #region CodeCommented
                   //    string photo_idValue = response.Substring(response.IndexOf("photo.php?fbid="), response.IndexOf(";", response.IndexOf("photo.php?fbid=")) - response.IndexOf("photo.php?fbid=")).Replace("photo.php?fbid=", string.Empty).Trim();
                   //    string[] arrphoto_idValue = Regex.Split(photo_idValue, "[^0-9]");

                   //    foreach (string item in arrphoto_idValue)
                   //    {
                   //        try
                   //        {
                   //            if (item.Length > 6)
                   //            {
                   //                photo_id = item;
                   //                break;
                   //            }
                   //        }
                   //        catch
                   //        {
                   //        }
                   //    }

                   //   // string postData = "fb_dtsg=" + fb_dtsg + "&photo_id=" + photo_id + "&profile_id=" + UsreId + "&photo_offset=0&video_id=&save=Save%20Changes&nctr[_mod]=pagelet_main_column_personal&__user="******"&__a=1&phstamp=165816776831066772182 ";
                   //   // string postResponse = HttpHelper.postFormData(new Uri("https://www.facebook.com/ajax/timeline/cover_photo_select.php"), postData);

                   //    //if (!postResponse.Contains("error"))
                   //    //{
                   //    //    //string ok = "ok";
                   //    //    isSentPicMessage = true;
                   //    //}
                   //    //if (string.IsNullOrEmpty(postResponse) || string.IsNullOrWhiteSpace(postResponse))
                   //    //{
                   //    //    status = "Response Is Null !";
                   //    //}
                   //    //if (postResponse.Contains("errorSummary"))
                   //    //{
                   //    //    string summary = GlobusHttpHelper.ParseJson(postResponse, "errorSummary");
                   //    //    string errorDescription = GlobusHttpHelper.ParseJson(postResponse, "errorDescription");

                   //    //    status = "Posting Error: " + summary + " | Error Description: " + errorDescription;
                   //    //    //FanPagePosterLogger("Posting Error: " + summary + " | Error Description: " + errorDescription);
                   //    //}
                   //}
                   //catch
                   //{
                   //} 
                   #endregion
               }
           }
           catch
           {
           }
           return isSentPicMessage;
       }
Ejemplo n.º 28
0
        public Dictionary <string, string> PostAddMembers(ref GlobusHttpHelper HttpHelper, string user)
        {
            try
            {
                string MemId       = string.Empty;
                string MemFName    = string.Empty;
                string MemLName    = string.Empty;
                string MemFullName = string.Empty;
                string pageSource  = string.Empty;
                string Name        = string.Empty;
                int    start1      = 0;
                #region old code
                //MemberDtl.Clear();
                //string pageGetreq = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/groups?gid=28410&csrfToken=ajax%3A1826913778783200924"));
                //http://www.linkedin.com/connections2?displayFilteredConns=&fetchConnsFromDB=false
                #endregion

                //string pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/connections2?displayFilteredConns"));
                //string pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/connections"));
                //string pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/contacts/api/contacts/?start=0&count=10"));
                do
                {
                    pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/contacts/api/contacts/?start=" + start1 + "&count=10"));
                    //string[] RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "{&quot;");
                    string[] RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "{\"name\":");

                    foreach (var Members in RgxGroupData)
                    {
                        try
                        {
                            if (Members.Contains(", \"id\":"))
                            {
                                int    startindex = Members.IndexOf(", \"id\":");
                                string start      = Members.Substring(startindex);
                                int    endIndex   = start.IndexOf("}");
                                MemId = start.Substring(0, endIndex).Replace("&quot;", string.Empty).Replace("id", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("li_", string.Empty).Replace(", \"title\"", string.Empty).Replace("\"", string.Empty).Trim();
                                MemId = user + ':' + MemId;
                                string Fname = string.Empty;
                                string Lname = string.Empty;
                                try
                                {
                                    int StartIndex = Members.IndexOf("&quot;firstName&quot;:&quot;");
                                    if (StartIndex > 0)
                                    {
                                        string Start    = Members.Substring(StartIndex).Replace("&quot;firstName&quot;:&quot;", "");
                                        int    EndIndex = Start.IndexOf("&quot;,");
                                        string End      = Start.Substring(0, EndIndex);
                                        Fname = End;
                                    }
                                }
                                catch (Exception ex)
                                {
                                }
                                try
                                {
                                    int StartIndex = Members.IndexOf("&quot;lastName&quot;:&quot;");
                                    if (StartIndex > 0)
                                    {
                                        string Start    = Members.Substring(StartIndex).Replace("&quot;lastName&quot;:&quot;", "");
                                        int    EndIndex = Start.IndexOf("&quot;,");
                                        string End      = Start.Substring(0, EndIndex);
                                        Lname = End;
                                    }
                                }
                                catch (Exception ex)
                                {
                                }
                                try
                                {
                                    int StartIndex = Members.IndexOf("\"");
                                    if (StartIndex > 0)
                                    {
                                        string Start    = Members.Substring(StartIndex).Replace("&quot;firstName&quot;:&quot;", "");
                                        int    EndIndex = Start.IndexOf(", \"title\"");
                                        string End      = Start.Substring(0, EndIndex).Replace(", \"title\"", string.Empty).Replace("\"", string.Empty).Trim();
                                        Name = End;
                                    }
                                }
                                catch (Exception ex)
                                {
                                }

                                //MemFullName = Fname + " " + Lname;
                                MemFullName = Name;

                                #region old code
                                //int startindex1 = Members.IndexOf("formattedName");
                                //string start1 = Members.Substring(startindex1);
                                //int endIndex1 = start1.IndexOf("}");
                                //MemFullName = start1.Substring(0, endIndex1).Replace("formattedName", string.Empty).Replace("&quot;", string.Empty).Replace(":", string.Empty).Trim();

                                //.Replace("&quot;", string.Empty).Replace(":", string.Empty).Replace(",", string.Empty).Trim();

                                //&quot;:&quot;agrawal, gaurav&quot;
                                //int startindex2 = Members.IndexOf("lastName");
                                //string start2 = Members.Substring(startindex2);
                                //int endIndex2 = start2.IndexOf("company\":\"");
                                //MemLName = start2.Substring(0, endIndex1).Replace("lastName", string.Empty).Replace("&quot", string.Empty).Replace(";",string.Empty).Replace(":", string.Empty).Replace(",", string.Empty).Replace("&quo",string.Empty).Trim();

                                //MemFullName = MemFName +":" + MemLName;
                                #endregion
                                try
                                {
                                    MemberNameAndID.Add(MemId, MemFullName);
                                }
                                catch (Exception ex)
                                {
                                }
                            }
                        }
                        catch
                        {
                        }
                    }
                    start1++;
                } while (pageSource.Contains("name"));
                return(MemberNameAndID);
            }
            catch (Exception ex)
            {
                return(MemberNameAndID);
            }
        }
        public bool AddaCover(ref GlobusHttpHelper HttpHelper, string Username, string Password, string localImagePath, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, ref string status)
        {
            bool isAddaCover = false;
            string fb_dtsg = string.Empty;
            string photo_id = string.Empty;
            string UsreId = string.Empty;

            try
            {

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

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

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

                NameValueCollection nvc = new NameValueCollection();

                nvc.Add("fb_dtsg", fb_dtsg);
                //nvc.Add("filename=", fb_dtsg);
                nvc.Add("Content-Type:", "image/jpeg");

                string response = HttpUploadFile_AddaCover(ref HttpHelper, UsreId, "https://upload.facebook.com/ajax/timeline/cover/upload/", "pic", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

                try
                {
                    string okay = HttpHelper.getHtmlfromUrl(new Uri("http://3-pct.channel.facebook.com/pull?channel=p_" + UsreId + "&seq=3&partition=69&clientid=70e140db&cb=8p7w&idle=8&state=active&mode=stream&format=json"));
                }
                catch
                {
                }

                if (!string.IsNullOrEmpty(response) && response.Contains("photo.php?fbid="))
                {
                    #region PostData_ForCoverPhotoSelect
                    //fb_dtsg=AQCLSjCH&photo_id=130869487061841&profile_id=100004163701035&photo_offset=0&video_id=&save=Save%20Changes&nctr[_mod]=pagelet_main_column_personal&__user=100004163701035&__a=1&phstamp=165816776831066772182 
                    #endregion
                    try
                    {
                        string photo_idValue = response.Substring(response.IndexOf("photo.php?fbid="), response.IndexOf(";", response.IndexOf("photo.php?fbid=")) - response.IndexOf("photo.php?fbid=")).Replace("photo.php?fbid=", string.Empty).Trim();
                        string[] arrphoto_idValue = Regex.Split(photo_idValue, "[^0-9]");

                        foreach (string item in arrphoto_idValue)
                        {
                            try
                            {
                                if (item.Length > 6)
                                {
                                    photo_id = item;
                                    break;
                                }
                            }
                            catch
                            {
                            }
                        }

                        string postData = "fb_dtsg=" + fb_dtsg + "&photo_id=" + photo_id + "&profile_id=" + UsreId + "&photo_offset=0&video_id=&save=Save%20Changes&nctr[_mod]=pagelet_main_column_personal&__user="******"&__a=1&phstamp=165816776831066772182 ";
                        string postResponse = HttpHelper.postFormData(new Uri("https://www.facebook.com/ajax/timeline/cover_photo_select.php"), postData);

                        if (!postResponse.Contains("error"))
                        {
                            //string ok = "ok";
                            isAddaCover = true;
                        }
                        if (string.IsNullOrEmpty(postResponse) || string.IsNullOrWhiteSpace(postResponse))
                        {
                            status = "Response Is Null !";
                        }
                        if (postResponse.Contains("errorSummary"))
                        {
                            string summary = GlobusHttpHelper.ParseJson(postResponse, "errorSummary");
                            string errorDescription = GlobusHttpHelper.ParseJson(postResponse, "errorDescription");

                            status = "Posting Error: " + summary + " | Error Description: " + errorDescription;
                            //FanPagePosterLogger("Posting Error: " + summary + " | Error Description: " + errorDescription);
                        }
                    }
                    catch
                    {
                    }
                }
                else
                {
                    if (response.Contains("Please choose an image that"))
                    {
                        status = "Please choose an image that's at least 399 pixels wide";
                    }

                }
            }
            catch
            {
            }
            return isAddaCover;
        }
Ejemplo n.º 30
0
        public void PostCommentLikerUpdate(ref GlobusHttpHelper HttpHelper, List<string> selectedItems, object parameter, int mindelay, int maxdelay)
        {
            string postdata = string.Empty;
             string referal = string.Empty;
             string postUrl = string.Empty;

             try
             {
                 string MessageText = string.Empty;
                 string PostedMessage = string.Empty;
                 string pageSource = string.Empty;
                 Array paramsArray = (Array)parameter;

                 string user = string.Empty;
                 try
                 {
                     user = paramsArray.GetValue(1).ToString();
                     //user = paramsArray.GetValue(0).ToString();
                 }
                 catch { }

                 pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=nav_responsive_tab_home"));
                 string[] RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "<li class=\"feed-item");

                 foreach (var GrpName in RgxGroupData)
                 {
                     try
                     {
                         if (GrpName.Contains("<!DOCTYPE html>"))
                         {
                             continue;
                         }

                         if (GrpName.Contains("<li class=\"feed-like\">"))
                         {
                             string UpdateLikerUrl = string.Empty;

                             try
                             {
                                 int startindexLiker = GrpName.IndexOf("data-li-like-url=");
                                 string startliker = GrpName.Substring(startindexLiker);
                                 int endliker = startliker.IndexOf("Click to like this update");
                                 UpdateLikerUrl = startliker.Substring(0, endliker).Replace("data-li-like-url=", string.Empty).Replace("\"", "").Replace("&amp;", "&").Replace("title=", string.Empty).Trim();

                                 if (!UpdateLikerUrl.Contains("www.linkedin.com"))
                                 {
                                     UpdateLikerUrl = "http://www.linkedin.com" + UpdateLikerUrl;
                                 }

                                 LikeUrl.Add(UpdateLikerUrl);
                             }
                             catch { }
                         }
                     }
                     catch { }
                 }

                 try
                 {
                     string[] CommentDisplay = new string[] { };
                     int counter = 0;
                     foreach (var Itegid in selectedItems)
                     {
                         try
                         {
                             counter = counter + 1;
                             string Gid = string.Empty;
                             try
                             {
                                 CommentDisplay = Itegid.Split('#');
                                 string[] PostGid = CommentDisplay[1].Replace("]",string.Empty).Split(',');

                                 if (NumberHelper.ValidateNumber(PostGid[1].Trim()))
                                 {
                                     Gid = PostGid[1].Trim();
                                 }

                             }
                             catch { }

                             foreach (var liker in LikeUrl)
                             {
                                 if (liker.Contains(Gid))
                                 {

                                     string ResponseStatusMsg = string.Empty;
                                     try
                                     {
                                         referal = "http://www.linkedin.com/home?trk=nav_responsive_tab_home";
                                         ResponseStatusMsg = HttpHelper.getHtmlfromUrl(new Uri(liker), referal);
                                     }
                                     catch { }

                                     string CSVHeader = "UserName" + "," + "StatusUpdate";

                                     if (ResponseStatusMsg.Contains("You"))
                                     {
                                         Log("[ " + DateTime.Now + " ] => [ Comment : " + CommentDisplay[2] + " Liked Successfully ]");

                                         string CSV_Content = user + "," + CommentDisplay[2];
                                         CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_ComentLiker);
                                         break;

                                     }
                                     else if (ResponseStatusMsg.Contains("Error"))
                                     {
                                         Log("[ " + DateTime.Now + " ] => [ Error in Comment Like ]");
                                         GlobusFileHelper.AppendStringToTextfileNewLine("Error in Post", Globals.path_ComentLiker);

                                     }

                                     if (counter < selectedItems.Count())
                                     {
                                         int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                                         Log("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                                         Thread.Sleep(delay * 1000);
                                     }
                                 }
                             }
                         }
                         catch (Exception ex)
                         {
                             GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Comment Liker --> ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + "    Stack Trace >>> " + ex.StackTrace, Globals.Path_LinkedinCommentLikerErrorLogs);
                             //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");
                         }
                     }

                 }
                 catch (Exception ex)
                 {
                     GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Comment Liker --> ---2--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                     GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Comment Liker --> ---2--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinCommentLikerErrorLogs);
                     //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");
                 }

             }
             catch (Exception ex)
             {
                 GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Comment Liker --> ---3--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                 GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Comment Liker --> ---3--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinCommentLikerErrorLogs);
             }
        }
Ejemplo n.º 31
0
        public void startJobScrapingDetails(ref GlobusHttpHelper httpHelper , List<string> lstUrlJobScraper)
        {
            try
            {
                int countPageNum = 1;
                int pageCount = 0;
                int i = 1;
                bool IsCheckCount = true; ;
                foreach (string item in lstUrlJobScraper)
                {
                    string tempItem = string.Empty;
                    if (item.Contains("&page_num=1"))
                    {
                    StartAgain:
                        tempItem = item.Replace("&page_num=1", "");
                        tempItem = tempItem + "&page_num=" + countPageNum;

                    string PageSource = httpHelper.getHtmlfromUrl(new Uri(tempItem));
                    string tempCount = string.Empty;
                    if (IsCheckCount)
                    {
                        tempCount = Utils.getBetween(PageSource, "resultCount\":", ",");

                        try
                        {
                            pageCount = int.Parse(tempCount);

                            Log("[ " + DateTime.Now + " ] => [ Total Results :  " + pageCount + " ]");

                        }
                        catch (Exception)
                        {

                        }

                        pageCount = (pageCount / 25) + 1;

                        if (pageCount == -1)
                        {
                            pageCount = 2;
                        }

                        if (pageCount == 1)
                        {
                            pageCount = 2;
                        }

                    }

                    if (pageCount >= 1)
                    {
                        _HttpHelper = httpHelper;

                            new Thread(() =>
                            {
                                if (IsCheckCount)
                                {
                                    finalUrlCollectionForRecruter();
                                }

                            }).Start();

                    }

                        while (i <= pageCount)
                        {
                            if (true)
                            {

                                if (PageSource.Contains("&jobId="))
                                {
                                    try
                                    {
                                        List<string> PageSerchUrl = GettingAllUrl(PageSource);
                                        PageSerchUrl.Distinct();

                                        if (PageSerchUrl.Count == 0)
                                        {
                                            Log("[ " + DateTime.Now + " ] => [ On the basis of your Account you can able to see " + RecordURL.Count + " Results ]");
                                            break;
                                        }

                                        foreach (string tempitem in PageSerchUrl)
                                        {
                                            if (true)
                                            {
                                                if (tempitem.Contains("jobs2/view/"))
                                                {
                                                    try
                                                    {
                                                        string urlSerch = tempitem;
                                                        if (urlSerch.Contains("jobs2/view/"))
                                                        {
                                                            RecordURL.Add(urlSerch);
                                                            if (!queRecordUrl.Contains(urlSerch))
                                                            {
                                                                queRecordUrl.Enqueue(urlSerch);
                                                            }
                                                            RecordURL = RecordURL.Distinct().ToList();
                                                        }

                                                        try
                                                        {
                                                            Log("[ " + DateTime.Now + " ] => [ " + urlSerch + " ]");
                                                        }
                                                        catch { }
                                                    }
                                                    catch { }
                                                }
                                            }
                                        }

                                        if (i == pageCount)
                                        {
                                            IsCheckCount = true;
                                            break;
                                        }

                                        countPageNum ++ ;
                                        i++;
                                        Thread.Sleep(4000);
                                        IsCheckCount = false;
                                        goto StartAgain;
                                    }
                                    catch { }
                                }

                            }
                        }

                    }
                }
            }
            catch { }
        }
Ejemplo n.º 32
0
        public Dictionary<string, string> PostCreateGroupNames(ref GlobusHttpHelper HttpHelper, string user)
        {
            try
             {

                 string pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/grp/"));

                 if (pageSource == "")
                 {
                     Thread.Sleep(2000);
                     pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/myGroups?trk=nav_responsive_sub_nav_groups"));
                 }

                 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 + ':' + user;
                                }
                                catch (Exception ex)
                                {
                                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update1 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                }

                                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)
                                    {
                                        //;gid=846797&
                                        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)
                                {
                                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus2 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update2 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                }

                                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)
                                    {
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus3 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update3 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                    }
                                }
                                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
                                {
                                    GroupName.Add(endName, endKey);
                                }
                                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 + ':' + user;
                                }
                                catch (Exception ex)
                                {
                                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus4 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update4 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                }

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

                                    if (endKey == string.Empty)
                                    {
                                        try
                                        {
                                            endKey = endKey.Split(' ')[0].Trim();
                                        }
                                        catch { }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus5 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update5 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                }

                                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)
                                    {
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus6 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update6 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
                                    }
                                }
                                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
                                {
                                    GroupName.Add(endName, endKey);
                                }
                                catch { }
                            }

                        }
                    }
                    catch { }
                }
                return GroupName;

             }
             catch (Exception ex)
             {
                 return GroupName;
             }
        }
Ejemplo n.º 33
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 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
                                         {
                                         }
                                     }

                                     if (mesg_with_tag == true)
                                     {
                                         if (string.IsNullOrEmpty(FName))
                                         {
                                             tempBody = body.Replace("<Insert Name>", ContactName);
                                         }
                                         else
                                         {
                                             tempBody = body.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 ='" + grpId + "'";
                                             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(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);
                                                     }
                                                 }
                                             }
                                         }
                                         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 : " + msg + " ]");
                                             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 + "," + msg + "," + 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);
             }
        }
Ejemplo n.º 34
0
        public bool CrawlingLinkedInPageRecruiter(string Url, ref GlobusHttpHelper HttpHelper)
        {
            bool isscraped = false;
            string Jobtitle = string.Empty;
            string Location = string.Empty;
            string PersonUrlLink = string.Empty;
            string FirstName = string.Empty;
            string LastName = string.Empty;
            string specialites = string.Empty;
            string Website = string.Empty;
            string Industry = string.Empty;
            string ProfileUrl = string.Empty;
            string strFamilyName = string.Empty;
            string careerDetails = string.Empty;
            try
            {
                //Url = "https://www.linkedin.com/jobs2/view/38612041?trk=vsrp_jobs_res_name&trkInfo=VSRPsearchId%3A82134271427382117065%2CVSRPtargetId%3A38612041%2CVSRPcmpt%3Aprimary";
                string pagesource = HttpHelper.getHtmlfromUrl(new Uri(Url));

                if (!pagesource.Contains("Contact the job poster"))
                {
                    Log("[ " + DateTime.Now + " ] => [ No Data Found For Url "+Url+" ] ");
                    return false; ;
                }
                Jobtitle = Utils.getBetween(pagesource, "itemprop=\"title\">", "</h1>").Replace(",",";").Replace("&amp;","&");
                Location = Utils.getBetween(pagesource, "itemprop=\"description\">", "</span>").Replace(",", ";").Replace("&amp;", "&");
                if (string.IsNullOrEmpty(Location))
                {
                    Location = Utils.getBetween(pagesource, "location\":", ",").Replace(",", ";").Replace("&amp;", "&");
                }
                careerDetails = Utils.getBetween(pagesource, "companyPageNameLink\":", ",").Replace("\"", "").Replace(",", ";").Replace("&amp;", "&").Replace("careers?", "home?");
                string subPagedetails = HttpHelper.getHtmlfromUrl(new Uri(careerDetails));
                List<string> websiteAddress = HttpHelper.GetTextDataByTagAndAttributeName(subPagedetails, "li", "website");
                if (websiteAddress.Count > 0)
                {
                    Website = websiteAddress[0].Replace("Website", "").Replace(",", ";").Replace("&amp;", "&");
                }

                List<string> specialtiesAddress = HttpHelper.GetTextDataByTagAndAttributeName(subPagedetails, "div", "specialties");
                if (specialtiesAddress.Count > 0)
                {
                    specialites = specialtiesAddress[0].Replace("specialties", "").Replace(",", ";").Replace("&amp;", "&");
                }
                List<string> lstIndustry = HttpHelper.GetTextDataByTagAndAttributeName(subPagedetails, "li", "industry");
                if (lstIndustry.Count > 0)
                {
                    Industry = lstIndustry[0].Replace("Industry", "").Replace(",", ";").Replace("&amp;", "&");
                }

                string tempPagesource = Utils.getBetween(pagesource, "<div class=\"poster\"", "</div>");
                ProfileUrl = Utils.getBetween(tempPagesource, "<a href=", ">").Replace("\"", "").Trim();
                if (!string.IsNullOrEmpty(ProfileUrl))
                {
                    string pagesourceProfildetails = HttpHelper.getHtmlfromUrl(new Uri(ProfileUrl));

                    #region Name
                    try
                    {
                        try
                        {
                            try
                            {
                                int StartIndex = pagesourceProfildetails.IndexOf("<title>");
                                string Start = pagesourceProfildetails.Substring(StartIndex).Replace("<title>", string.Empty);
                                int EndIndex = Start.IndexOf("| LinkedIn</title>");
                                string End = Start.Substring(0, EndIndex).Replace(":", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Trim();
                                strFamilyName = End.Trim();
                            }
                            catch
                            { }
                        }
                        catch
                        {
                            try
                            {
                                strFamilyName = pagesourceProfildetails.Substring(pagesourceProfildetails.IndexOf("fmt__full_name\":"), (pagesourceProfildetails.IndexOf(",", pagesourceProfildetails.IndexOf("fmt__full_name\":")) - pagesourceProfildetails.IndexOf("fmt__full_name\":"))).Replace("fmt__full_name\":", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim();

                            }
                            catch { }
                        }

                        if (string.IsNullOrEmpty(strFamilyName))
                        {
                            try
                            {
                                strFamilyName = pagesourceProfildetails.Substring(pagesourceProfildetails.IndexOf("<span class=\"full-name\">"), (pagesourceProfildetails.IndexOf("</span><span></span></span></h1></div></div><div id=\"headline-container\" data-li-template=\"headline\">", pagesourceProfildetails.IndexOf("</span><span></span></span></h1></div></div><div id=\"headline-container\" data-li-template=\"headline\">")) - pagesourceProfildetails.IndexOf("<span class=\"full-name\">"))).Replace("<span class=\"full-name\">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(",", string.Empty).Trim();
                            }
                            catch
                            { }
                        }

                        if (string.IsNullOrEmpty(strFamilyName))
                        {
                            try
                            {
                                int StartIndex = pagesourceProfildetails.IndexOf("<span class=\"full-name\">");
                                string Start = pagesourceProfildetails.Substring(StartIndex).Replace("<span class=\"full-name\">", string.Empty);
                                int EndIndex = Start.IndexOf("</span>");
                                string End = Start.Substring(0, EndIndex).Replace("</span>", string.Empty);
                                strFamilyName = End.Trim();
                            }
                            catch
                            { }
                        }

                        if (string.IsNullOrEmpty(strFamilyName) && pagesourceProfildetails.Contains("<span class=\"full-name\""))
                        {
                            try
                            {
                                int StartIndex = pagesourceProfildetails.IndexOf("<span class=\"full-name\"");
                                string Start = pagesourceProfildetails.Substring(StartIndex).Replace("<span class=\"full-name\"", string.Empty);
                                int EndIndex = Start.IndexOf("</span>");
                                string End = Start.Substring(0, EndIndex).Replace("</span>", string.Empty);
                                strFamilyName = End.Replace("dir=\"auto\">", "").Replace("\"", "").Trim();
                            }
                            catch
                            { }
                        }

                        if (string.IsNullOrEmpty(strFamilyName))
                        {
                            try
                            {
                                int StartIndex = pagesourceProfildetails.IndexOf("<title>");
                                string Start = pagesourceProfildetails.Substring(StartIndex).Replace("</title>", string.Empty);
                                int EndIndex = Start.IndexOf("| LinkedIn Recruiter</title>");
                                string End = Start.Substring(0, EndIndex).Replace(":", string.Empty).Replace("'", string.Empty).Replace(",", string.Empty).Trim();
                                strFamilyName = End.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];
                    }
                    catch { }

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

                    }
                    catch { }
                    #endregion

                    if (string.IsNullOrEmpty(FirstName)) FirstName = "--";
                    if (string.IsNullOrEmpty(LastName)) LastName = "--";
                    if (string.IsNullOrEmpty(ProfileUrl)) ProfileUrl = "--";
                    if (string.IsNullOrEmpty(Jobtitle)) Jobtitle = "--";
                    if (string.IsNullOrEmpty(Location)) Location = "--";
                    if (string.IsNullOrEmpty(Website)) Website = "--";
                    if (string.IsNullOrEmpty(specialites)) specialites = "--";
                    if (string.IsNullOrEmpty(Industry)) Industry = "--";
                    if (string.IsNullOrEmpty(Website)) Website = "--";

                    string LDS_FinalData = Url.Replace(",", ";") + "," + Jobtitle.Replace(",", ";") + "," + Location.Replace(",", ";") + "," + FirstName.Replace(",", ";") + "," + LastName.Replace(",", ";") + "," + ProfileUrl.Replace(",", ";") + "," + Website.Replace(",", ";") + "," + specialites.Replace(",", ";") + "," + Industry.Replace(",", ";");
                    AddingLinkedInDataToCSVFileCompanyEmployeeScraper(LDS_FinalData);
                }

            }
            catch (Exception ex)
            {

            }
            return isscraped;
        }