Skip to content

Instantly share code, notes, and snippets.

@chris-gillatt
Last active May 22, 2024 07:03
Show Gist options
  • Save chris-gillatt/134f35e56d8ed531b0d715f98e1b6473 to your computer and use it in GitHub Desktop.
Save chris-gillatt/134f35e56d8ed531b0d715f98e1b6473 to your computer and use it in GitHub Desktop.
Fantasy Football: GSL Chip Checker
#!/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
@chris-gillatt
Copy link
Author

results show as follows:

./ff3.sh
Entry ID: 4117721
** no chips **
Grand Total Event Transfers: 0

Entry ID: 3547999
wildcard: 2023-11-06T18:27:13.516717Z
Grand Total Event Transfers: 0

Entry ID: 1773533
** no chips **
Grand Total Event Transfers: 0

Entry ID: 1775906
wildcard: 2023-11-09T22:14:17.902476Z
Grand Total Event Transfers: 0

Entry ID: 7861432
** no chips **
Grand Total Event Transfers: 0

Entry ID: 3591004
** no chips **
Grand Total Event Transfers: 0

Entry ID: 5436691
** no chips **
Grand Total Event Transfers: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment