Last active
April 27, 2019 21:21
-
-
Save absturztaube/74668d401b10c3f893e687605cb6d107 to your computer and use it in GitHub Desktop.
bash script that fetches emojis from a given fediverse instance
This file contains hidden or 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
#!/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