-
-
Save hjonessimple/3d583f54849785d3ea3bdb2cbf54cb1c to your computer and use it in GitHub Desktop.
Download all of your Team's custom Slack emojis.
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
#!/bin/bash -eo pipefail | |
# Log in to Slack in a web browser and open the network tools to inspect the traffic. | |
# Filter the requests with "/api/" and pick one to inspect. Click on the Headers tab and scroll down to see the request details. | |
# You need the xoxc token from the request body, and a copy of the cookies. It is the "d" cookie that is important, but you can copy all of them. | |
# Paste the values below. | |
# You need to have curl and jq installed. | |
SLACK_TOKEN="xoxc-...." | |
COOKIES="d=...." | |
data=$(curl -q -sS -b "$COOKIES" "https://slack.com/api/emoji.list?token=$SLACK_TOKEN") | |
if echo "$data" | jq -e '.error?' > /dev/null; then | |
echo "$data" | |
exit 1 | |
fi | |
echo "$data" > data.json | |
echo "$data" | jq -Mr '.emoji | to_entries | .[] | select(.value | startswith("http")) | "\(.key) \(.value)"' | sort | while read name url; do | |
fn="$name.${url##*.}" | |
[[ -f "$fn" ]] && continue | |
echo "$fn" | |
curl -q -sS -o "$fn" "$url" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment