1

I'm using Parsehub to scrape certain data from certain pages on a website into a google spreadsheet.

The issue I'm having is that a certain html element only displays on a certain date and I'm wondering if there is a way to set it up so Parsehub checks for the element and when it finally shows it scrapes it into google sheets.

The element I'm trying to get is the Sportsbet odds on each team or the class="match-odd__text match-odd__text--home"

Here is two pages with one showing and one not:

If anyone could help with that one I'd greatly appreciate it.

1 Answers1

1

To access odds and nickname, you have to parse a json contained in the web page. Assuming url is in A1, you can retrieve informations by

=whoAndOdds(importxml(A1,"//div[@id='vue-match-centre']//@q-data"))

with this custom function

function whoAndOdds(url){
  var data = JSON.parse(url.replace(/\n/g,''))
  return [[data.match.homeTeam.nickName,data.match.homeTeam.odds],[data.match.awayTeam.nickName,data.match.awayTeam.odds]]
}

If odds value don't exist, the cell will remain blank until a new importxml is activated (you can add a check box to do the activation)

Mike Steelson
  • 1,353
  • 2
  • 8