1
0
Fork 0

add misskey emoji downloader

This commit is contained in:
tastytea 2024-02-04 10:39:46 +01:00
parent b36c59c6c5
commit 91153abd6f
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
#!/usr/bin/env zsh
# download emojis from a misskey instance
setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL
autoload -U die
[[ ${ARGC} -ne 1 ]] && die 1 "Usage: ${0} <emoji name>"
local instance=very.tastytea.de
local name=${1}
local json=$(curl --silent --json '{"name": "'${name}'"}' \
https://${instance}/api/emoji)
local url=$(jq -r .url <<<${json})
curl --location --output --silent ${name} ${url}
local identification=$(file --extension ${name})
local extension=${${identification##*: }%%/*}
mv ${name} ${name}.${extension}
print "${name}.${extension} downloaded"