Last active
March 27, 2019 04:31
-
-
Save alexcu/cd4babc16d7fe9f90f6e5c43cac41fff to your computer and use it in GitHub Desktop.
Bitly link generator for macOS
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
#/usr/bin/env bash | |
# Refer to http://bit.ly/2TF7FU8 on how to find your Bearer and Group GUID | |
link=$(curl -s -X POST \ | |
https://api-ssl.bitly.com/v4/bitlinks \ | |
-H 'Authorization: Bearer XXXXXXXX' \ | |
-H 'Content-Type: application/json' \ | |
-d "{ | |
\"group_guid\": \"XXXXXXXX\", | |
\"long_url\": \"$1\" | |
}" | sed -E "s/^.+link\":\"([^\"]+).+$/\1/") | |
echo $link | pbcopy | |
echo $link has been copied to the keyboard |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment