blogSetomits

Welcome to blogSetomits

TinyURL Decoder

TinyURL を使って作られている URL をオリジナルの URL に戻すユーザースクリプトを書いてみました。Greasemonkey :: Firefox Add-onsから Graeasemonkey をインストールした上で
http://userscripts.org/scripts/show/40582
をインストールすると、
encoded by TinyURL
のように TinyURL で圧縮されている URL が
encoded by TinyURL
というように元の URL が表示されるようになります。
ちなみに同じようなものはいくつかあるようなのですが、このスクリプトでは GM_xmlhttpRequest() の onload の中でレスポンスの中の finarUrl を使っています。また、同じ URL の場合には何度も元 URL をチェックするのは無駄なので、連想配列で cache を持つようにしていています。このキャッシュの長さはデフォルトでは 100 個にしていますが、 about:config から greasemonkey.scriptvals.http://matatabi.homeip.net/TinyURL Decoder でフィルタをかけると maxlength というのがあるので、ここで 10 とか 1000 とか好きな値に変更することができます。
Posted at 10:16 by setomits
I have approached the problem a little differently. Check out a proposal i just wrote up:

http://sites.google.com/a/snaplog.com/wiki/short_url_hints

I would like to hear your thoughts.

r.S.
Posted at by Robert Spychala
Hi Robert,

I read your proposal and felt that it might be useful for some situations.
I have thought about the problem for a couple days.
There are several services to shoten URLs and their shortened URLs. I think it is good for us to have options which service we use.

Anyway, it may be good for us that there is only one canonical URL. So it might be helpful to use META with rel="canonical" proposed at Official Google Webmaster Central Blog: Specify your canonical.

Thank you.
Posted at by setomits
Does not seem to work with Greasemonkey using FF2 (v2.0.0.14 to be exact) but I appreciate the script nonetheless.
Posted at by skeeball
Hi skeeball,
Thank you for your report.
This script uses some Greasemonkey APIs like GM_setValue, GM_getValue, GM_log and GM_xmlhttpRequest, so the version of Greasemonkey might concern with your problem.
I'm not sure whether I try to solve it or not, but could you let me know the version?

Thanks.
Posted at by setomits
linkbee.com sometimes by some url's dont encode. Is it possible to make it more compatible?
Posted at by user1
Hi user1,
I will check it, so please wait for a while.
Thank you.
Posted at by setomits
The script doesn't work with query parameters like http://bit.ly/abcdef?foo=1=2
Please consider the following chages which work for me:
    function request_for(a) {
	var a_href = a.href;
	if (a_href.indexOf('?') > 0) {
		a_href = a_href.substring(0, a_href.indexOf('?'));
	}
then use a_href instead of a.href in the complete request_for function and
		    onload: function(resp) {
			finalUrl = extract_from_response(resp);
			if (_node.href.indexOf('?') > 0) {
				finalUrl = finalUrl + _node.href.substring(_node.href.indexOf('?'));
			}
			if (finalUrl) {
Thanks & Regards,
Andreas
Posted at by Andreas
Could u add support for this plz?

Thanx a lot!!
Nice script
Posted at by http://thecow.me/
Hi, thank you for your request.
I added TheCow in supported.
Enjoy it!
Posted at by setomits
Any plans for support for ht.ly? It's the same as ow.ly so should be easy to implement. ;)
Posted at by TW
Hi TW,

I just don't know the service.
I will support it.

Anyway, it looks good for me to use auto update scheme or such kind of things.
Posted at by setomits
Thank you for the script. Twitter should do this by default.

Please can you add support for t.co and goog.gl?
Posted at by Iain
Hi Iain,

Thank you for your comment.
I added t.co and checked the script after a long time.
Now lots of services are not run right now, and deleted them to be supported. Please reinstall it from http://userscripts.org/scripts/show/40582.

Anyway, that script looks work with goo.gl. If you have know any tweet URLs on which goo.gl are not decoded, please let me know.

Actually saying, I don't use the script any more. New Twitter UI decode the shortened URLs, and I basically use Mac app version. So I don't notice if the script works or not.
Posted at by setomits
The new Twitter UI does not decode them for me? I just checked in Chrome on Windows 7.

Anyway, thanks for listening. :o)
Posted at by Iain
Problems Where Target URL's contain "&"

function decode_shortened_url(_node) {
if (cache[_node.href]) {
/* cache[_node.href] = cache[_node.href].replace('&', '&'); */
if (GM_getValue('keep_text') === true) {

Please add the commented line, as it does not replace & in target URL
Posted at by Jatin
Can you add the support for youtu.be?

Thanks.
Posted at by Support For youtu.be
Hi Jatin,

When we talk about entity references on HTML based system, it should be complicated.
Could you email me?
If you have some examples which are not decoded well, please contain them.
My email address is setomits at gmail dot com.
Posted at by setomits
Unfortunately, I will not support youtu.be.
I started developing this Grease Monkey script because I hated that I have no idea where shortened URLs bring me unless I click them.

In the other hand, the youtu.be URLs must bring us to YouTube, right? It's the reason why I wont.
Posted at by setomits
Leave your comment