Created
August 24, 2018 15:01
-
-
Save OddBloke/56f27c9d304e87b512dd85feab8c5ad2 to your computer and use it in GitHub Desktop.
StubHub Ticket Counter
This file contains hidden or 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
// This assumes that you are using Chrome, as it relies on the $x function in the development console | |
// 1) Scroll all the way down through the list of tickets, so that all of them are loaded on the page | |
// 2) Open the Chrome Developer Tools (Ctrl-Shift-J) | |
// 3) Paste the below in to the console and press return | |
// 4) Curse out the filthy scalpers | |
$x('//div[@class="ticketsText"]/text()').map(ticket_text => { | |
match = /(\d+) tick/.exec(ticket_text.textContent); | |
if (match) { | |
return parseInt(match[1], 10) | |
} else { | |
console.log(ticket_text); | |
return 0 | |
} | |
}).reduce((a, b) => a + b, 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment