public string GetSpecialties()
        {
            var specialtiesRegex = new Regex(@"id=""profile-specialties(?:[\s\w><=""/]+)p(?:[\s\w><=""']+)>(?<Specialties>(([^<]|<[^/]|</[^p])*.{0,2}))</p", RegexOptions.Multiline);
            var specialties      = RegexUtilities.GetTokenString(specialtiesRegex.Match(pageSource), "Specialties");

            if (string.IsNullOrEmpty(specialties))
            {
                AddWarningError("Specialties");
            }
            return(specialties);
        }
        public string GetSummary()
        {
            var summaryRegex = new Regex(@"id=""profile-summary(?:[\s\w><=""/]+)p(?:[\s\w><=""']+)>(?<Summary>([^<]+))", RegexOptions.Multiline);
            var summary      = RegexUtilities.GetTokenString(summaryRegex.Match(pageSource), "Summary");

            if (string.IsNullOrEmpty(summary))
            {
                AddWarningError("Summary");
            }
            return(summary);
        }
Esempio n. 3
0
        public static string CleanCommitMessage(this string lastMessage)
        {
            if (string.IsNullOrEmpty(lastMessage))
            {
                return(null);
            }
            var cleanCommitMessage = new Regex(@""">(?<LastCommit>(([^<])*.{0,1}))<");
            var result             = RegexUtilities.GetTokenString(cleanCommitMessage.Match(lastMessage), "LastCommit");

            return(result);
        }
Esempio n. 4
0
        public static Project ParseDetails(this Project project, string pageSource)
        {
            var projectDecriptionRegex = new Regex(@"<a id=""project_summary_link""([^>]*)>(?<ProjectDescription>(([^<]|<[^/]|</[^a])*.{0,2}))</a");
            var projectDescription     = RegexUtilities.GetTokenString(projectDecriptionRegex.Match(pageSource), "ProjectDescription");

            if (!string.IsNullOrEmpty(projectDescription))
            {
                project.Description = projectDescription;
            }

            return(project);
        }
        private WebClient SignIn(string linkedInEmailAddress, string linkedInPassword)
        {
            webClient = new WebClientWithCookies();

            try
            {
                //Open the login page
                webClient.DownloadData(loginPageUri);

                //Find the sessionid for the login page
                var    sessionIdRegex = new Regex("JSESSIONID=(?<SessionId>[^;]+)");
                string sessionId      = RegexUtilities.GetTokenString(sessionIdRegex.Match(webClient.ResponseHeaders["Set-Cookie"]), "SessionId");
                if (sessionId == null)
                {
                    AddCriticalError("SessionId could not be found");
                }

                //Sign into the login page
                webClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
                byte[] response = webClient.UploadData(loginPageUri, "POST",
                                                       Encoding.UTF8.GetBytes(
                                                           "csrfToken=" + sessionId +
                                                           "&session_key=" + HttpUtility.UrlEncode(linkedInEmailAddress) +
                                                           "&session_login=Sign In" +
                                                           "&session_login="******"&session_password="******"&session_rikey="));

                //Check that we have logged in
                string result = Encoding.ASCII.GetString(response);
                if (!result.Contains("Redirecting..."))
                {
                    AddCriticalError("SignIn failed");
                }
            }
            catch (Exception ex)
            {
                AddCriticalError(ex.Message);
            }
            return(webClient);
        }
        public LinkedInResumeSniffer(string linkedInEmailAddress, string linkedInPassword, string firstnameLastname)
        {
            Errors = new List <KeyValuePair <string, string> >();

            SetAndValidateNames(firstnameLastname);

            if (Errors.Count == 0)
            {
                if (!isSignedIn)
                {
                    webClient = SignIn(linkedInEmailAddress, linkedInPassword);

                    isSignedIn = true;
                }

                try
                {
                    //Open search page, search for user by firstname and lastname
                    webClient.Headers.Remove("Content-Type");
                    string response = webClient.DownloadString(string.Format(searchPageUri, firstname, lastname));

                    //Find the first profile id from search results
                    var    profileIdRegex = new Regex("viewProfile=&key=(?<ProfileId>[^&]+)");
                    string profileId      = RegexUtilities.GetTokenString(profileIdRegex.Match(response), "ProfileId");
                    if (profileId == null)
                    {
                        AddCriticalError(string.Format("Profile for {0} {1} could not be found", firstname, lastname));
                    }

                    //Open resume page and set the page source
                    pageSource = webClient.DownloadString(string.Format(profilePageUri, profileId));
                }
                catch (Exception ex)
                {
                    AddCriticalError(ex.Message);
                }
            }
        }