Blogger Hacks, Categories, Tips & Tricks

Sunday, June 10, 2007
Embiggen Those TinyURLs
If you use a lot of TinyURLs on your blog, you might want to checkout this new tool - Embiggen. It expands those cryptic TinyURLs (eg tinyurl.com/2dfmty) to their full version, allowing your readers to make an informed decision about following a link. (That's good URL etiquette.)

It's available as a button to insert into any page eg Blogger, but it's especially handy for micro-blogging services like Twitter. You can also get it as a bookmarklet for when you're browsing around and come across a mysterious TinyURL.

See demo and get buttons


The hack works by using Dapper to grab the URL from the TinyURL preview page and munging the resulting JSON object with regular expressions.

I cobbled this together as part of another project on URL manipulation and tagging, but thought it might be useful enough to release on its own. There's no reason why this approach couldn't be applied to other common-yet-cryptic URLs, like YouTube, so watch this space.

Any other suggestions, feedback, bug reports etc? Please leave a comment.

Filed in: , , ,
Posted at 3:46 AM by Greg.
21 Comments:
<    >
Awesome! Thanks. Hope you're well, btw.

<    >
Anonymous Anonymous said...
People who settle for less use tinyurl. It's even blocked in many countries by many ISPs. I use snipurl, or snipr.com in their new beta. Not only do they offer several more features for snipped URLs, they also have APIs that make this elongation of long urls trivial. Check them out.

<    >
Blogger Unknown said...
Cool as the underside of a pillow. Thanks.

<    >
Blogger pogue said...
TinyURL also includes a preview function when you generate a shrunken URL now too, which looks like http://preview.tinyurl.com/xxxxx. This takes the visitor to TinyURL's site and lets them view where they're going to first before they decide if they want to visit the redirect link. However, as Howard mention, there are a lot of other services out now that are similar to TinyURL and have more functions. You can find a directory of them at dmoz.org.

<    >
Blogger Greg said...
Yes, the preview service is a nice little earner: "look at our ads and you won't risk malware!".

Seriously though, there's a welter of competing services. I don't think I've ever seen one "in the wild" that isn't TinyURL. Maybe I'm not visiting the right pages, but I think we've got a classic first-adopter scenario whereby they garner 90% of marketshare.

Still, the basic Embiggen approach can be very readily re-purposed by those with sufficient interest thanks to the Creative Commons licensing. (And, of course, the unusually good code comments!)

<    >
Blogger Unknown said...
I find your blog very refreshing.

<    >
Anonymous Anonymous said...
Cool..thanks for sharing

<    >
Anonymous Anonymous said...
Sorry bothering you, i'd like to have the date on the same line with the post title, as you have on your blog. I searched on Hacs Wiki, but i didn't find nothing. Can you help me, or at least give me a link where i can find a guide.Thank you, niko nikok79@yahoo.it

<    >
Blogger Johan Sundström said...
I would whole-heartedly recommend the javascript module pattern for this kind of thing, to avoid leaking out too many global identifiers outside of your own turf. (You seem to try doing it to some extent already, but not quite have it down yet.)

So steps one and two in your case would be something like this -- and then supply "Embiggen.dapperCallback" for Dapper, instead of "procURL". (The junk on the last line is to keep your current config style, if you want to remain compatible with it.)

<    >
Blogger Johan Sundström said...
Today's silly FreshBlog frontpage "Firebug console one-liner" hack:

$x('//div[@class="OnePost"][div/div/div[@class="PermFooterPost" and not(contains(.,"by Greg"))]]').map(function(d){d.style.display="none"})

:-)

<    >
Blogger Greg said...
Thanks, Johan.

I've seen this approach before from del.icio.us and the benefits of encapsulation struck me immediately. The explanation provided on the YUI blog is great!

<    >
Blogger Shubham ~NeO~ said...
Sir , Just Love Ur Blog , I'm a regular reader of it and subscribed it on Google reader .

Want a serious help from u . I recently updated my template but it showed slow loading time . I tweaked it a bit by removing HTML images and all and time improved but still it is quite slow . I knw the theme is heavy , but still if u can tweak it for me would be gr8 . Pls help me out ...

I can mail u my XML , if u agree ... Waiting in anticipation .

<    >
Anonymous Anonymous said...
I am hoping you can help me. For some reason my date header and post title have switched. You can see what I mean here:

http://karenerickson.blogspot.com/

What did I do? How do I fix this?

<    >
Blogger Faizal R said...
no more update from this blog??

<    >
Anonymous Anonymous said...
Great service!
But it would be nice, if also TinyURLs, that aren't formated as links (plain text) would be expanded.

<    >
Blogger Greg said...
Good point- plain text URLs should also be picked up.

I'm thinking of adding other url redirection services, but I'm not sure where I should focus my efforts.

Which services should I target?

<    >
Anonymous Anonymous said...
Thx for your response on my suggestion! :)

It would be very great, if you could implement plain text url expansion into the bookmarklet in the next time. Because I know some news pages, where urls will not be formated after posting them there.

>I'm thinking of adding other url >redirection services, but I'm not >sure where I should focus my >efforts.

>Which services should I target?

That's a good question.
I never thought, that there could so many other redirection services exist. It would make sense to add the more popular ones (yeah, great proposition, I know :) )

Sadly, I don't know any of the listed services on that page. Only TinyURL.

Maybe it could help to make a poll anywhere.

Btw: Would it also be possible to implement a function, that all expanded urls will be displayed in their redirection-url form again by a second click on the Bookmarklet? It would be helpful and more comfortable in my eyes, if this would be possible. To have to reload a page to see a site in its unchanged form is a little bit annoying sometimes.

Thank you! :)

<    >
Anonymous Anonymous said...
I did something similar with Universal Redirect Revealer and figured it could support any redirect service, although sometimes you have to interrupt the chain of redirects to stop before authentication (see facebook, for example).

<    >
Anonymous sledge said...
Someone sent me a suspicious tinyurl to my gmail in response to one of my craigslist ads. Embiggen did not find any tinyurls on the page, however. Is it supposed to work in email?

<    >
Anonymous GolMol said...
I find your blog very Cool..
Thanks

<    >
Anonymous Kevin Blumer said...
im not really a fan of tiny urls because you cant tell what you are linking too


eXTReMe Tracker