Created
April 5, 2017 16:21
-
-
Save loisaidasam/db83c28c38709bdc1d9c8db096139fbd to your computer and use it in GitHub Desktop.
Get the current number of triple doubles by player (NBA)
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
#!/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