Skip to content

Instantly share code, notes, and snippets.

@the-eric-kwok
Last active January 23, 2023 05:16
Show Gist options
  • Save the-eric-kwok/679785d0f51a49d5f61bfa2a5532f2cd to your computer and use it in GitHub Desktop.
Save the-eric-kwok/679785d0f51a49d5f61bfa2a5532f2cd to your computer and use it in GitHub Desktop.
Typora 使用 sm.ms 上传命令
#!/bin/bash
API_KEY="" # 这里填入 sm.ms 的 API key
for item in "$@"; do
curl -s -X POST \
-F "smfile=@${item}" \
-H "Content-Type: multipart/form-data" \
-H "Authorization: ${API_KEY}" \
https://smms.app/api/v2/upload \
| grep -o -E '"url":"(.*?)"|"images":"(.*?)"' \
| sed -E 's/("url":"|"images":"|"|\\)//g'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment