add misskey emoji downloader
This commit is contained in:
parent
b36c59c6c5
commit
91153abd6f
20
.config/zsh/functions/mk_dl_emoji
Executable file
20
.config/zsh/functions/mk_dl_emoji
Executable 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"
|
Loading…
Reference in New Issue
Block a user