Friday, 12 May 2017

Web Scraping while meeting a condition

I am scraping some data from this site: https://masteroverwatch.com/profile/pc/us/calvin-1337, specifically span.summary-hero-name. This is my code to do so:

scrapeIt("https://masteroverwatch.com/profile/pc/us/calvin-1337",  {
  title: "span.summary-hero-name"
}).then(page => {
  console.log(page.title)
});

This returns McreeWidowmakerBastion which it should do, as there are 3 heros with the class summary-hero-name, but I only want the first one in the source code (which is the most used). If that is not possible then I would want to meet the condition where href is /profile/pc/us/Calvin-1337/heroes/6 (which IS the top one).



via Rusty

No comments:

Post a Comment