Jump to content

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


Recommended Posts

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
Link to comment

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

Link to comment

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.

 

Link to comment
  • 2 weeks later...
  • 2 weeks later...

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"`)

 

Link to comment

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.

Link to comment

\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.

Link to comment

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!

Link to comment

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.

Link to comment

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
×
×
  • Create New...