Last active
May 22, 2024 07:03
-
-
Save chris-gillatt/134f35e56d8ed531b0d715f98e1b6473 to your computer and use it in GitHub Desktop.
Fantasy Football: GSL Chip Checker
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 | |
entry_ids=("4117721" "3547999" "1773533" "1775906" "7861432" "3591004" "5436691") | |
for entry_id in "${entry_ids[@]}"; do | |
response=$(curl -s "https://fantasy.premierleague.com/api/entry/$entry_id/history/") | |
echo "Entry ID: $entry_id" | |
chips=$(echo "$response" | jq '.chips') | |
if [ "$chips" = "[]" ]; then | |
echo "** no chips **" | |
else | |
echo "$chips" | jq -r '.[] | "\(.name): \(.time)"' | |
fi | |
# Calculate the grand total of event_transfers | |
total_transfers=$(echo "$response" | jq '[.current[].event_transfers] | add') | |
# Print the grand total of event_transfers | |
echo "Grand Total Event Transfers: $total_transfers" | |
echo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
results show as follows: