Last active
January 6, 2020 01:41
-
-
Save Tehsurfer/50fe1a23febb5ce4f0b4bb588aecdaf3 to your computer and use it in GitHub Desktop.
tab-touch-table-scrape
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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