Last active
January 23, 2023 05:16
-
-
Save the-eric-kwok/679785d0f51a49d5f61bfa2a5532f2cd to your computer and use it in GitHub Desktop.
Typora 使用 sm.ms 上传命令
This file contains 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 | |
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