hzlzh

[Workflow]Shorten URL (support goo.gl/ bit.ly/ t.cn/ j.mp/ is.gd/ v.gd/)

78 posts in this topic

Shorten-URL-icon.png

Shorten URL (v1.1) - download here

 

Github Page:

https://github.com/hzlzh/Alfred-Workflows

 

This workflow support URL shortener like below. You can use Hotkey to trigger without open Alfred input window.

  • goo.gl/
  • bit.ly/
  • t.cn/
  • j.mp/
  • is.gd/
  • v.gd/

If you want more URL shortener services added, please let me know, :) .

 

How-To:

Choose some long links (e.g Command + A), then press `Command + Shift +L`, choose goo.gl and you will get the short link in your clipboard with notification center triggered.

 

Tips:

How to use this workflow without copy/paste?

Just use trigger HotKey, check out this wiki issue here:

https://github.com/h...kflows/issues/1

 

Screenshot:

 

Shorten-URL-trigger.png

 

Shorten-URL-notification.png

 

Shorten-URL-workflow.png

Edited by hzlzh
hzlzh, bcometa, jpmartin and 5 others like this

Share this post


Link to post

Hi, I'm new to Mac and have discovered Alfred and I'm in love with it. I'm not a developer but I can work out what scripts do but I've hit a brick wall! (after several hours of trying different things!)

 

I'm trying to expand a short url and show it in Alfred's result list. I was able to use shell script and curl to expand it and have it copied to the clipboard but I want it displayed as an action so that I can see it and then copy it but I can't for the life of me work out how to combine the script that expands the URL with the xml script filter! I am guessing I need to pass the result of script 1 to script 2 but not sure how to do that.

 

Can anyone help?

 

Many thanks

Share this post


Link to post

Hi, I'm new to Mac and have discovered Alfred and I'm in love with it. I'm not a developer but I can work out what scripts do but I've hit a brick wall! (after several hours of trying different things!)

 

I'm trying to expand a short url and show it in Alfred's result list. I was able to use shell script and curl to expand it and have it copied to the clipboard but I want it displayed as an action so that I can see it and then copy it but I can't for the life of me work out how to combine the script that expands the URL with the xml script filter! I am guessing I need to pass the result of script 1 to script 2 but not sure how to do that.

 

Can anyone help?

 

Many thanks

 

If you need this `short -> long` feature to be added, mybe I can focus on after work time.

 

Share this post


Link to post

Thanx for this! Can you add that if I have a url in the clipboard that the workflow will suggest to shorten it directly? So I won't have to paste it in?

Share this post


Link to post

There is no need to copy/paste URL, just use trigger HotKey, check out this wiki issue here:

https://github.com/hzlzh/Alfred-Workflows/issues/1

 

There are times when another hotkey is confusing, especially when there are tons of workflows installed, and each is with their own hotkey,

At those times, I'm sure I would go up to the address bar, copy the url, open alfred, and hit "shorten" and then realize I could have used the hotkey to do that.

For those times, if you add a url detection inside clipboard, it will save the hustle of pasting it :)

 

It's very easy with ruby, and I imagine it's equaly easy with python

url = URI.extract(`osascript -e "get the clipboard"`)

 

Share this post


Link to post

There are times when another hotkey is confusing, especially when there are tons of workflows installed, and each is with their own hotkey,

At those times, I'm sure I would go up to the address bar, copy the url, open alfred, and hit "shorten" and then realize I could have used the hotkey to do that.

For those times, if you add a url detection inside clipboard, it will save the hustle of pasting it :)

 

It's very easy with ruby, and I imagine it's equaly easy with python

url = URI.extract(`osascript -e "get the clipboard"`)

 

Good idea, I'll try as you said.

Share this post


Link to post

\nyway to use this with custom domains on bit.ly?

 

Never mind, got it to work. Thanks a lot for the workflow! :)

 

For those who are wondering how to do it, edit the shorten script in the workflow, find & replace:

'bit.ly' : {'api_url':'https://api-ssl.bitly.com/v3/shorten?format=json&login=yourusername&apiKey=yourlegacyapikey&longUrl=','title':'bit.ly','des':'http://targetdomain.com'},

 

Target domain must be added to your 'custom short domain name' in bit.ly settings.

shadowfax1 likes this

Share this post


Link to post

Love it! But, a request… is there any way to make it so that hitting the hotkey with a URL selected will pass the URL straight through to one service? (of my choosing in some sort of set up?)

 

I just want to use goo.gl and be done with it, I don't need a selection step. And I imagine most people probably have one service they prefer and use generally.

 

Thanks!

Share this post


Link to post

Can you add adf.ly? That would be extremely helpful.

adf.ly does not support API, so I can't add this service.

Edited by hzlzh

Share this post


Link to post

Love it! But, a request… is there any way to make it so that hitting the hotkey with a URL selected will pass the URL straight through to one service? (of my choosing in some sort of set up?)

 

I just want to use goo.gl and be done with it, I don't need a selection step. And I imagine most people probably have one service they prefer and use generally.

 

Thanks!

That's right,

I'll find some way to short an URL directly for some users, for now, you can edit some of the workflow's code to pass that step of choosing services maybe.

leefur likes this

Share this post


Link to post

Is it possible to set this up to use my account for any/each of these services?

Yes you can, just replace the API KEY below with your own.

 

a74ecc4cjw1e3qa2o4hz9j.jpg

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now