Skip to content

Instantly share code, notes, and snippets.

@pajlada
Created May 31, 2023 09:14
Show Gist options
  • Save pajlada/cca19cda9c7211d08d512a1715e368bb to your computer and use it in GitHub Desktop.
Save pajlada/cca19cda9c7211d08d512a1715e368bb to your computer and use it in GitHub Desktop.
#!/bin/sh
twitch api get /chat/badges/global | jq '.' > global-badges.json
jq -r -c '.data[] | select(.set_id == "subscriber").versions[] | {id, image_url_1x, image_url_2x, image_url_4x, description, title}' global-badges.json | while read line; do
_id="$(echo "$line" | jq -rc '.id')"
_title="$(echo "$line" | jq -rc '.title')"
_description="$(echo "$line" | jq -rc '.description')"
_image_url_1x="$(echo "$line" | jq -rc '.image_url_1x')"
_image_url_2x="$(echo "$line" | jq -rc '.image_url_2x')"
_image_url_4x="$(echo "$line" | jq -rc '.image_url_4x')"
echo "[$_id] $_description"
echo "1x ${_image_url_1x}: $(curl -s --output - "$_image_url_1x" | file -)"
echo "2x ${_image_url_2x}: $(curl -s --output - "$_image_url_2x" | file -)"
echo "4x ${_image_url_4x}: $(curl -s --output - "$_image_url_4x" | file -)"
echo ""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment