Skip to content

Instantly share code, notes, and snippets.

@alenbasic
Last active May 26, 2017 09:47
Show Gist options
  • Save alenbasic/2c2733c9759e2ee7079c to your computer and use it in GitHub Desktop.
Save alenbasic/2c2733c9759e2ee7079c to your computer and use it in GitHub Desktop.
A simple hackish script that uploads pictures to imgur. Improve and expand from here.
screenshot="$1"
client_id="" # get your clientid here: https://api.imgur.com/oauth2/addclient
response=$(curl -silent -H "Authorization: Client-ID $client_id" -F "image=@${screenshot}" https://api.imgur.com/3/image.json)
url=$(echo $response | awk '{split($0,a,","); print a[48]}' | sed 's/\(\\\|"link":\|}\|"\)//g')
deletehash=$(echo $response | awk '{split($0,a,","); print a[46]}' | sed 's/\("deletehash":\|"\)//g')
echo "$url" | xclip -selection c # needs xclip installed, available most linux distros
echo "$url"
echo "deletion page: http://imgur.com/api/delete/${deletehash}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment