Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //download matches page
- string matches = client.DownloadString("/match?timekey=1&matchOrderBy=SPECIAL_BLEND&use_prefs=1&discard_prefs=1&count=30");
- // convert to HTML document
- HtmlDocument matchesHtmlDoc = new HtmlDocument();
- matchesHtmlDoc.LoadHtml(matches);
- //get the xpath for the div of girls
- string matchesXpath = String.Format("//div[@id='{0}']/div", Constants.matchResultDivId);
- //select the match nodes and put it into a "people" node collection
- HtmlNodeCollection people = matchesHtmlDoc
- .DocumentNode
- .SelectNodes(matchesXpath);
- //loop through the girls and process them, skipping girls already seen
- foreach (HtmlNode person in people)
- {
- string matchCardXpath = String.Format("./div[contains(@class,'{0}')]", Constants.matchCardClass);
- string matchCardTextXpath = String.Format("{0}/div[@class='{1}']", matchCardXpath, Constants.matchCardText);
- string profileInfoXpath = String.Format("{0}/div[@class='profile_info']", matchCardTextXpath);
- string userInfoXpath = String.Format("{0}/div[@class='userinfo']", profileInfoXpath);
- // find person info, including name and link to picture
- string personLinkXpath = String.Format("{0}/a", matchCardXpath);
- HtmlNode personLinkNode = person.SelectSingleNode(personLinkXpath);
- string userName = personLinkNode.Attributes["data-username"].Value;
- //check if username is already in excel/DB or already processed and stored in the running list
- if (processedGirls.Contains(userName) || listOfGirls.Where(p => p.Username.Contains(userName)).FirstOrDefault() != null)
- {
- Console.WriteLine("{0} :: {1} :: Processed her... Skipping.",DateTime.Now.ToShortTimeString() ,userName);
- continue; //don't process her again
- }
- girlsProcessed++;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement