21 lines
583 B
Bash
Executable File
21 lines
583 B
Bash
Executable File
#!/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 --silent --location --output ${name} ${url}
|
|
local identification=$(file --extension ${name})
|
|
local extension=${${identification##*: }%%/*}
|
|
mv ${name} ${name}.${extension}
|
|
print "${name}.${extension} downloaded"
|