Skip to content

Instantly share code, notes, and snippets.

@loisaidasam
Created April 5, 2017 16:21
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 loisaidasam/db83c28c38709bdc1d9c8db096139fbd to your computer and use it in GitHub Desktop.
Save loisaidasam/db83c28c38709bdc1d9c8db096139fbd to your computer and use it in GitHub Desktop.
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