![如何从命令行将文件发布到 pastebin 或类似服务?](https://linux22.com/image/1343307/%E5%A6%82%E4%BD%95%E4%BB%8E%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%B0%86%E6%96%87%E4%BB%B6%E5%8F%91%E5%B8%83%E5%88%B0%20pastebin%20%E6%88%96%E7%B1%BB%E4%BC%BC%E6%9C%8D%E5%8A%A1%EF%BC%9F.png)
我希望能够从命令行粘贴到 pastebin(或类似程序),但似乎pastebinit
不再起作用了:
THIS API HAS BEEN DISABLED. Please use Pastebin's new API. http://pastebin.com/api
答案1
你可以。使用 GitHub gist。
curl -X POST \--data-binary '{"files": {"file1.txt": {"content": "Hello, SO"}}}' \https://api.github.com/gists
答案2
使用此脚本:
#!/bin/bash
api_key=xxxxxxx-my-dev-API-key-xxxxxxx
curl -d "api_paste_code=$(jq -sRr @uri)" \
-d "api_dev_key=$api_key" \
-d 'api_option=paste' 'https://pastebin.com/api/api_post.php'
echo # By default, there's no newline printed by curl