Is there a way for me to feed in the URL as a variable and get the shortened Google URL or TinyURL as a result saving it as a variable?
First thing is you need to get yourself an API key from Google.
I have made you a prompt in this example. I hope you're using a fairly newish mac that has python installed.
The script part for you. Careful with all the quotes
curl -s https://www.googleapis.com/urlshortener/v1/url?key=${KMVAR_urlShortnerApiKey} -H 'Content-Type:
application/json' -d '{"longUrl":"'"${KMVAR_urlShortnerUrl}"'"}' | \
python -c "import sys, json; print json.load(sys.stdin)['id']"
Hi, thank you for this really helpful and will resolve my problem.
I seem to get the following error message and do not know how to overcome it
Traceback (most recent call last):
File “”, line 1, in
KeyError: ‘id’
could you upload the Actions as it is please?
Thank you very much.
Hi, is there another API that would work now that Google is no longer offering the service?
I found a free API here but don't know how to convert their code to work with Maestro.
Would it be possible for someone to provide an updated macro with a working API?
thanks much!
Hi @mishamazor,
Personally, I use TinyURL: https://tinyurl.com/
The Keyboard Maestro macro is very simple:
Please can you share the macro?
Much obliged.