Skip to content

Instantly share code, notes, and snippets.

@OddBloke
Created August 24, 2018 15:01
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 OddBloke/56f27c9d304e87b512dd85feab8c5ad2 to your computer and use it in GitHub Desktop.
Save OddBloke/56f27c9d304e87b512dd85feab8c5ad2 to your computer and use it in GitHub Desktop.
StubHub Ticket Counter
// 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