问题
I was wondering if there's an already written Bash script which will be capable of uploading images to imgur.com along with automating the process of requesting new access token once it expire.
Searching for such a script I found a few which do not support OAuth2:
Quoted from Imgur's OAuth2.0 overview
The Imgur API uses OAuth 2.0 for authentication. OAuth 2.0 has four steps: registration, authorization, making the request, and getting new access_tokens after the initial one expired.
Searching in Imgur's uploading tools I found scripts that do not support OAuth2.0, therefore they are not relevant for my case.
Thank you!
回答1:
I wrote such a tool a few days ago: rugmi.
Here are a few usage examples:
Upload foo.png, bar.png, baz.png and print the result links to stdout.
$ rugmi -f foo.png -f bar.png -f baz.png
or
$ rugmi -- foo.png bar.png baz.png
Upload all JPEG files in a directory and print the result links to stdout.
$ find dir/ -type f -name '*.jpg' -print0 | rugmi -0
Upload foo.png and print an HTML type of link to be displayed as a medium thumbnail.
rugmi -f foo.png -t HTML -s MT
来源:https://stackoverflow.com/questions/37377029/a-bash-script-to-upload-images-to-imgur-com-automatically-asking-for-new-access