Last active
March 21, 2018 16:41
-
-
Save jostyee/b7826c495060462049230f41283252ca to your computer and use it in GitHub Desktop.
URL shortening via goo.gl
This file contains hidden or 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
| #!/bin/sh | |
| # Create credential at https://console.developers.google.com/apis/credentials | |
| echo -n $( curl "https://www.googleapis.com/urlshortener/v1/url?fields=id&key=$KEY" -H 'Content-Type: application/json' -d '{"longUrl": "$URL"}' -s | awk '/"id":/ {print substr($2, 2, length($2)-2)}' ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment