Jump to content
hzlzh

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

Recommended Posts

Thank you for this excellent workflow! I would just like to report one small bug: what is copied to the clipboard is not simply the shortened url, but it is the shortened url followed by a line break. Is there any way to fix this problem?

Share this post


Link to post

Thank you.

 

I just changed the API Key and the Login so I see my shortened URLs at bit.y

Nice tweak. Did you just change this section in the script filter? Just change the bolded pieces?

 

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

 

UPDATE: Yeah, that was it. Works now. Awesome.

Edited by roccitman

Share this post


Link to post

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.

 

Yeah, I was trying to think of a way to reorder them at least. I think that's all we'd have to do.

Share this post


Link to post

Yeah, I was trying to think of a way to reorder them at least. I think that's all we'd have to do.

Yes, re-order the API list is a nice way to speed up the action when shorting a long URL with this workflow.

cheers~

Share this post


Link to post

Thank you for this excellent workflow! I would just like to report one small bug: what is copied to the clipboard is not simply the shortened url, but it is the shortened url followed by a line break. Is there any way to fix this problem?

Link which contains some space like `http://google.com/xxx yyy/` can be changed by Firefox/Chrome into link like this `http://google.com/xxx%20yyy` when you copy it from the Firefox/Chrome location bar.

 

So just paste the URL in to Firefox/Chrome once before shorting it.

Share this post


Link to post

Yes, re-order the API list is a nice way to speed up the action when shorting a long URL with this workflow.

cheers~

Hmm, doesn't seem to do it. They're not appearing in the same order as listed in the script filter anyway: http://d.pr/i/JDt9

Share this post


Link to post

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.

 

Excellent. I looked but I'm way out of my depth here. I'm a designer, not a dev. I'm grateful for your work and I'll patiently wait. Thanks!

Share this post


Link to post

Hmm, doesn't seem to do it. They're not appearing in the same order as listed in the script filter anyway: http://d.pr/i/JDt9

Got it, I just update this workflow to new version v1.2 to let you change the services sort.

Check out the new version here:

https://github.com/hzlzh/Alfred-Workflows/raw/master/Downloads/Shorten-URL.alfredworkflow

the screenshot:

a74e55b4jw1e3tlvu7ldwj20gf08z75w.jpg

 

=====

cc @leefur

 

Excellent. I looked but I'm way out of my depth here. I'm a designer, not a dev. I'm grateful for your work and I'll patiently wait. Thanks!

check above, :)

Share this post


Link to post

Ooh, neat. Now if only I could narrow that list to just one thing, and then skip the whole selection step… :)


(Do people use different shorteners?)

Share this post


Link to post

Link which contains some space like `http://google.com/xxx yyy/` can be changed by Firefox/Chrome into link like this `http://google.com/xxx%20yyy` when you copy it from the Firefox/Chrome location bar.

 

So just paste the URL in to Firefox/Chrome once before shorting it.

 

Sorry, there seems to be some misunderstanding. I'm talking about the shortened url.

 

The expected output is:

 

"http://j.mp/11vfsSl"

 

But the actual output is:

 

"http://j.mp/11vfsSl

"
(there is a line break which I did not expect)
 
Am I making sense?

Share this post


Link to post

Sorry, there seems to be some misunderstanding. I'm talking about the shortened url.

 

The expected output is:

 

"http://j.mp/11vfsSl"

 

But the actual output is:

 

"http://j.mp/11vfsSl

"
(there is a line break which I did not expect)
 
Am I making sense?

Thanks for your notice, I got your idea this time,  fixed it and release the Short-URL v1.3, please have a check from the link below, re-install it.

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

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.

 

I would love this functionality. I've been able to cut things down to only one API, but cannot figure out what to change to make it go straight to shortened URL (gave up after an hour of trying). I like that if nothing is highlighted it would bring up a pop up to enter text. So maybe if there is a URL highlighted it shortens it, and otherwise it will pop up the box to enter the text?

 

Either way - loving this!

Share this post


Link to post

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

 

a74ecc4cjw1e3qa2o4hz9j.jpg

Can you provide some insight into how to implement the API key for Goo.gl? 

 

I've changed the Google entry as follows:

 

 

api = {
0 : {'api_url':'https://www.googleapis.com/urlshortener/v1/url?key=<my_actual_api_key>','title':'goo.gl','des':'http://goo.gl/'},
...
 
and I still get a shortened URL but it doesn't show up in my account so I don't think the association is being made.
 
Any idea what I'm doing wrong?
 
Thanks,
_alan_

Share this post


Link to post

Su.pr and Brb.bz are two of the best link shorteners on the market. (Along with bit.ly and goo.gl, which you already have.) It would be pretty cool to have those options as well.

 

Another request I could make is when using bit.ly if there could be a way to add notes (#tags) to the link while shortening (saving) it? Say I'd like to save (and shorten) a link to bit.ly using the workflow I could add some tags to make that link easily searchable when logged into the bit.ly website. I don't know if it's possible, but it could save me a bit of time of entering the tags manually. 

 

All in all this is one of the workflows I use the most on a daily basis. Keep up the good work and thanks in advance!! 

Edited by adrianfurlan

Share this post


Link to post

I would love this functionality. I've been able to cut things down to only one API, but cannot figure out what to change to make it go straight to shortened URL (gave up after an hour of trying). I like that if nothing is highlighted it would bring up a pop up to enter text. So maybe if there is a URL highlighted it shortens it, and otherwise it will pop up the box to enter the text?

 

Either way - loving this!

It's really need by some users to shorten URL just use only one service (e.g. goo.gl), so I thought to make another single workflow will solve this. I'll have a try.

Share this post


Link to post

 

Can you provide some insight into how to implement the API key for Goo.gl? 

 

I've changed the Google entry as follows:

 

 

api = {
0 : {'api_url':'https://www.googleapis.com/urlshortener/v1/url?key=<my_actual_api_key>','title':'goo.gl','des':'http://goo.gl/'},
...
 
and I still get a shortened URL but it doesn't show up in my account so I don't think the association is being made.
 
Any idea what I'm doing wrong?
 
Thanks,
_alan_

 

You can get an API key follow this post below:

https://developers.google.com/console/help/#generatingdevkeys

 

for more info, check goo.gl's docs:

https://developers.google.com/url-shortener/v1/getting_started#AboutAuthorization

Share this post


Link to post

Su.pr and Brb.bz are two of the best link shorteners on the market. (Along with bit.ly and goo.gl, which you already have.) It would be pretty cool to have those options as well.

 

Another request I could make is when using bit.ly if there could be a way to add notes (#tags) to the link while shortening (saving) it? Say I'd like to save (and shorten) a link to bit.ly using the workflow I could add some tags to make that link easily searchable when logged into the bit.ly website. I don't know if it's possible, but it could save me a bit of time of entering the tags manually. 

 

All in all this is one of the workflows I use the most on a daily basis. Keep up the good work and thanks in advance!! 

Thx, I've checked the two URL services Su.pr and Brb.bz.

 

you can change some code in this workflow so that it can work for su.pr,

 

so I made this for you: Shorten URL(with su.pr).alfredworkflow

 

----

since Brb.bz need an API key, you need to get one below:

 

http://www.brb.bz/page/developer

Share this post


Link to post

It's really need by some users to shorten URL just use only one service (e.g. goo.gl), so I thought to make another single workflow will solve this. I'll have a try.

hzizh, any update on the workflow for one service only?

Share this post


Link to post

I love this workflow, use it numerous times each and every day. 

 

Problem has cropped up, not sure if it's a Mavericks thing (I doubt it) but some of the services are throwing up blanks now ( e.g. You get the notification but it's blank and URL hasn't been shortened or copied to clipboard).

Hope it can be resolved. It may just be that the URLs for certain services have changed?
 

Cheers, 

Gary  

Share this post


Link to post

On my Mac, bit.ly and j.mp are not working. (They're the same company, so it's not surprising that the results are the same.) Like Gary mentioned above, there is a notification that the address was shortened and copied to the clipboard, but nothing is actually put on the clipboard.

 

All the others (j.mp, v.gd, etc.) are working fine.

 

I'm using OS X 10.8.5.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...