Skip to content

Instantly share code, notes, and snippets.

@absturztaube
Last active April 27, 2019 21:21
Show Gist options
  • Save absturztaube/74668d401b10c3f893e687605cb6d107 to your computer and use it in GitHub Desktop.
Save absturztaube/74668d401b10c3f893e687605cb6d107 to your computer and use it in GitHub Desktop.
bash script that fetches emojis from a given fediverse instance
#!/usr/bin/env bash
instance=$1
echo "[*] Grabbing emojilist from $instance"
json=$(curl -sL "https://$instance/api/v1/custom_emojis")
echo "[*] Setting up stuff"
index=0
mkdir -p "$instance/emoji/custom"
touch "$instance/custom_emojis.txt"
echo -n "" > "$instance/custom_emojis.txt"
echo "[>] Grabbing emojis"
echo $json | jq -r ".[].static_url" | while read emoji_url; do
shortcode=$(echo $json | jq -r ".[$index].shortcode")
echo "[*] grabbing $shortcode"
basename=$(basename "$emoji_url")
echo "$shortcode, emoji/custom/$basename" >> "$instance/custom_emojis.txt"
curl -sL "$emoji_url" > "$instance/emoji/custom/$basename"
((index++))
done
echo "[<] Got all emojis"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment