Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get the current number of triple doubles by player (NBA)
#!/bin/bash
# Data via https://www.espn.com/nba/statistics/player/_/stat/double-doubles/sort/tripleDouble
# Requires curl, pup, and jq
# Steps:
# 1. Download the html
# 2. Parse the html
# 3. Filter out the empty/zero rows
# 4. Parse out just the player names and triple double counts
curl -Ss "https://www.espn.com/nba/statistics/player/_/stat/double-doubles/sort/tripleDouble" \
| pup '#my-players-table .tablehead tr json{}' \
| jq 'map(select((.children[-1].text != null) and (.children[-1].text | tonumber > 0)))' \
| jq '[.[] | [.children[1].children[0].text, .children[-1].text]]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.