A Bash script to upload images to imgur.com automatically asking for new access_token

我是研究僧i 提交于 2019-12-23 01:54:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!