public async void FacebookScrapeExecuted(object args) { // Display the loading screen IsLoading = true; // Get the LinkModel that we're tring to scrape details for FacebookLinkModel facebookLinkModel = args as FacebookLinkModel; SelectedFacebookLinkModel = facebookLinkModel; // Make a call to the target profile url and get the source var source = await ExternalBrowser.CallExternalBrowser(facebookLinkModel.TargetUrl); // Get the real name from the profile string realName = FacebookStuff.GetRealNameFromProfilePage(source); // Get the profile image from the profile facebookLinkModel.ProfileImage = FacebookStuff.GetProfilePhotoFromProfilePage(source); // Get all of the details from the profile page for parsing List <string> details = FacebookStuff.GetIntroFromAuthenticatedProfilePage(source); facebookLinkModel.TargetDetails = details; facebookLinkModel.ParsedDetails = new List <string>(); foreach (string detail in facebookLinkModel.TargetDetails) { string text = FacebookStuff.GetTextFromSingleDetailAuthenticated(detail); if (!String.IsNullOrEmpty(text) && !facebookLinkModel.ParsedDetails.Contains(FacebookStuff.GetTextFromSingleDetailAuthenticated(detail))) { facebookLinkModel.ParsedDetails.Add(FacebookStuff.GetTextFromSingleDetailAuthenticated(detail)); } } // If the name contains a space there's more than one name listed if (realName.Contains(' ')) { // If the name has two items in it then set index 0 to first name and index 1 to last name if (realName.Split(' ').Count() == 2) { facebookLinkModel.FirstName = realName.Split(' ')[0]; facebookLinkModel.LastName = realName.Split(' ')[1]; } // Otherwise they list a middle name or initial and set index 0 as first name and index 2 as last name else { facebookLinkModel.FirstName = realName.Split(' ')[0]; facebookLinkModel.LastName = realName.Split(' ')[2]; } } else { facebookLinkModel.FirstName = realName; } if (realName.Contains(',')) { facebookLinkModel.FirstName = realName.Split(',')[1]; facebookLinkModel.LastName = realName.Split(',')[0]; } foreach (string detail in facebookLinkModel.TargetDetails) { // lower the detail so we can identify it easier string lowerDetail = detail.ToLower(); // If the detail contains "lives in" or "current city" then we know this is the current city detail if (lowerDetail.Contains("lives in") || lowerDetail.Contains("current city")) { string cityState = FacebookStuff.GetTextFromSingleDetailAuthenticated(detail); if (cityState.Contains(',')) { facebookLinkModel.CurrentCity = cityState.Split(',')[0]; facebookLinkModel.CurrentState = cityState.Split(',')[1]; } else { facebookLinkModel.CurrentCity = cityState; } } // If the detail contains "studied" then it's the college detail if (lowerDetail.Contains("studied")) { facebookLinkModel.College = FacebookStuff.GetTextFromSingleDetailAuthenticated(detail); } // If the detail contains "went to" then it's the high school detail if (lowerDetail.Contains("went to")) { facebookLinkModel.HighSchool = FacebookStuff.GetTextFromSingleDetailAuthenticated(detail); } // If the detail contains "from" then this detail is for the origin city and state if (lowerDetail.Contains("from")) { string cityState = FacebookStuff.GetTextFromSingleDetailAuthenticated(detail); // If there's a comma then split on it and set index 0 as the city and index 1 as the state if (cityState.Contains(',')) { facebookLinkModel.OriginCity = cityState.Split(',')[0]; facebookLinkModel.OriginState = cityState.Split(',')[1]; } else { facebookLinkModel.OriginCity = cityState; } } // If the detail contains mairried to then it will list a spouse if (lowerDetail.Contains("married to")) { string spouseName = FacebookStuff.GetTextFromSingleDetailAuthenticated(detail); facebookLinkModel.MarriedTo = spouseName; // If the name contains a space there's more than one name listed if (spouseName.Contains(' ')) { // If the name has two items in it then set index 0 to first name and index 1 to last name if (spouseName.Split(' ').Count() == 2) { facebookLinkModel.SpouseFirstName = spouseName.Split(' ')[0]; facebookLinkModel.SpouseLastName = spouseName.Split(' ')[1]; } // Otherwise they list a middle name or initial and set index 0 as first name and index 2 as last name else { facebookLinkModel.SpouseFirstName = spouseName.Split(' ')[0]; facebookLinkModel.SpouseLastName = spouseName.Split(' ')[2]; } } else if (spouseName.Contains(',')) { facebookLinkModel.SpouseFirstName = spouseName.Split(',')[1]; facebookLinkModel.SpouseLastName = spouseName.Split(',')[0]; } } // This is the magic string for the little suitcase image next to the job detail text // It's a bad identifier and will likely break if (lowerDetail.Contains("sx_9deefd")) { if (facebookLinkModel.Jobs == null) { facebookLinkModel.Jobs = new List <string>(); } facebookLinkModel.Jobs.Add(FacebookStuff.GetTextFromSingleDetailAuthenticated(detail)); } } IsLoading = false; }