Skip to content

Instantly share code, notes, and snippets.

@Tehsurfer
Last active January 6, 2020 01:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tehsurfer/50fe1a23febb5ce4f0b4bb588aecdaf3 to your computer and use it in GitHub Desktop.
Save Tehsurfer/50fe1a23febb5ce4f0b4bb588aecdaf3 to your computer and use it in GitHub Desktop.
tab-touch-table-scrape
// How to use this example:
// 1. Navigate to a race's odds page. This can be found by navigating to:
// https://www.tabtouch.com.au/racing/<today's date>/<meeting abbreviation>/1
// 2. Paste the code below into the chrome console and run
// Results: First horses name and odds should be printed to console
parent = document.querySelector("tr[data-starter='1']")
horseName = parent.querySelector("a[class='form-toggle form-toggle-name expand']").innerText
horseOdds = [...parent.querySelectorAll("span[class='dividend']")].map( el => el.innerText)
horseOdds = horseOdds.map( s => s.replace('\n','').replace('Arrow','').replace('Star',''))
console.log('Horse: ' + horseName) // Horse: DON'T LOOK NOW
console.log('Odds: ' + horseOdds) // Odds: 3.40,1.80,3.90,2.50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment