UPDATE: Improved Sharing and Twitter Bookmarklet | myopiclunacy.com
As you know I’m trying the whole Mini-Blog thing now as a way of microblogging my thoughts – mostly on links to pages/stories I come across. Using a Twitter account and a plug-in called Twitter Tools from Alex King, I can show my Mini Blog on the left side, and then all the mini-blog entries/tweets for the day (using GMT time, unfortunately) get posted into a daily blog entry the next day. It’s a real cool tool.
Using Twitter for microblogging has become popular especially because Twitter will take any link it finds in your tweet and HTMLize it. One problem that I came across, though, was the cumbersome way of getting links and context into the tweet – a lot of copying and pasting going on. Because of the 140 character limit, Twitter has some kind of feature where it uses TinyUrl to shorten the urls posted into the status, but I couldn’t find a bookmarklet that would include the page title and a selection of text. Reason being, probably, this isn’t a highly requested feature. So I tried writing my own.
I did it in a somewhat cumbersome way, by using a bookmarklet to get the page URL, title, and selected text and call a PHP form that uses JSON to connect to the urlTea url shortening service. It then autoposts the form to the Twitter status window ready to be updated. All of this in a pop-up window and, of course, assuming you’re already signed into Twitter. I let Twitter handle the character count and any additional editing – especially when the page title and selected text become too long. The page title, the urlTea shortened link, and any selected text are copied in that order separated by a space.
The bookmarklet is a simple link that contains javascript. You drag it to your link toolbar (or just bookmark it from the right-click menu) and click it whenever you want to microblog. (If you’re new to bookmarklets – they’re an awesome timesaver. Check out the other bookmarklets I use.) I’m sure this smacks of hackery and is rife with style infractions. I offer no appologies or warranties. Take it and make it yours if you like it. Or just use the bookmarklet here and let me know how it works.
Update (11/14/07): So after looking over a few pages, and the inexplicable problems I had with the JSON api, I’ve updated the script to use the regular API. Which I can switch to use TinyUrl if I need to. I suppose I could then have it use the twitter API but I want the intermediate editing step.
Update (1/17/09): Fixed issues with slashes and escaped code. Also added an option for using tr.im URL shortening service – which is shorter than tinyurl. Works much better. If you want to use tr.im, choose the TwrimIt bookmarklet. All this is pending an API key from the good folks at tr.im. BTW – urlTea is now defunct in case you were wondering!
The PHP page is real simple and portable:
<?php
$url = $_GET["url"];
$r1 = array(’”‘);
$r2 = array(”“”);
$title = str_replace($r1,$r2,stripslashes(htmlspecialchars(urldecode($_GET["title"]))));
$text = str_replace($r1,$r2,stripslashes(htmlspecialchars(urldecode($_GET["text"]))));
$urlt = file_get_contents(”http://tr.im/api/trim_simple?url=” . $url);
$urlt = file_get_contents(”http://tinyurl.com/api-create.php?url=” . $url);
// $urlt = file_get_contents(”http://tr.im/api/trim_simple?url=” . $url);
$status = “$title $urlt $text”
?><html>
<head>
<title>myopiclunacy.com’s Twitter TinuURl/tr.im submitter</title>
</head>
<body>
<form name=twit id=twit method=”get” action=”http://twitter.com/home”>
<input type=”hidden” name=”status” value=”<?php echo $status; ?>”>
</form>
<script type=”text/javascript”>
document.forms[0].submit();
</script>
</body>
If you’re looking for something for the Blackberry – check out this article from Tao of Mac.
Popularity: 7% [?]




































yeah … I’ve gone to TinyURL. need to figure out what’s wrong with urlTea.
Comment by webadmin — November 20, 2007 @ 10:26 pm
Could I get your bookmarklet and traslate it into spanish and offer it freely in my site????
Comment by Iulius — June 18, 2008 @ 5:27 am
yes – the code is right there so you can take it.
Comment by webadmin — June 21, 2008 @ 12:57 pm
It looks like AddThis has a Twitter bookmarklet too, but with a long URL you will run out of characters. It doesn’t tiny the URL before applying the character limit
Comment by Brendt — July 1, 2008 @ 12:00 pm
Hi. Is there something like this for snipurl.com? That’s the best shortner service and I would like the convenience of twitting directly. Thanks!
Comment by Dan Morter — July 31, 2008 @ 4:14 am
[...] post at myopiclunacy was promising, but turned out to require setting up a PHP page on a server. I was looking for a [...]
Pingback by Bookmarklets, Twitter, TinyURL, and bit.ly - Lessons Learned « Jim Breen’s Blather — September 10, 2008 @ 3:01 pm
You can use the TwitIt link here or you can take the code and modify it on your own site.
Comment by webadmin — September 10, 2008 @ 3:33 pm
Just a note, when you TwitIt something using the bookmarklet, it says “microblogging with URLTea” … but the link (to your site) in the post was a TinyURL … ?
Comment by Jennifer — December 1, 2008 @ 7:50 pm
Any idea why this is not working with Safari V. 3.2.1? Its working well with FF 3.0.4 other than the “microblogging with URLTea” text being tossed in.
Comment by Derek Lerner — December 19, 2008 @ 10:16 am
you can also try the bookmarklet for http://tr.im – it posts to twitter natively
Comment by webadmin — December 21, 2008 @ 8:15 pm
only thing is it doesn’t bring over the page title or a selection
Comment by webadmin — December 21, 2008 @ 8:16 pm
I have an idea that I think you might be interested in. It attempts to solve some of the problems associated with url shortening services (SPAM, Phising, viruses, etc). Please email me if you are interested. I cant seem to find a contact email on your blog
If you are interested, please email me at bryan (then the at sign) myomnisolutions.com
Thanks
Comment by Bryan — June 3, 2009 @ 11:46 am
check out http://twitlet.com. it’s the fastest and simplest twitter bookmarklet with a very unique feature: it doesn’t require you to type your login details. it shortens urls (is.gd, tinyurl) and copies your selection to input box. and simply using words “#this” or “#link” in your tweets you can share links (shortened again). it is using JS prompt window. some people find it ugly. some calls it genius. just try it. it’s free.
Comment by Can Basit — August 7, 2009 @ 8:41 pm
Excellent site, keep up the good work
Comment by Bill Bartmann — September 3, 2009 @ 7:38 pm
Microblogging is so addictive. I like to Twitter everyday with my friends and talk about just anything. I also have some blogs but i update frequently my Twitter more than my Wordpress blog.
Comment by detoxdietgirl — October 3, 2009 @ 3:15 am
[...] Since my last forays with Mini-blogging (or microblogging) and bookmarkletting, lots of things have changed. Specifically for this purpose, the url-shortening service urlTea was [...]
Pingback by Improved Sharing and Twitter Bookmarklet | myopiclunacy.com — November 15, 2009 @ 6:28 pm
updated here
Comment by webadmin — November 18, 2009 @ 6:53 pm
i love to Twitter my day to day activities to my friends and followers. Twitter is much better than blogging because it is direct to the point and does not require you to type so many unnecessary words.
1i
Comment by Cleothildee — November 24, 2009 @ 7:26 am
Twitter is some ways is much better than blogging. I love to Twitter my everyday activities on my friends and relatives.
***
Comment by Caramoan — December 25, 2009 @ 12:50 am
It is exact I was looking for. Thanks for sharing ! It is nice option run this script on my own website. Btw, selected text isn’t handled when there are frames. I modified shorten service to is.gd via curl. My edited files are at http://www.sweb.cz/tomi/trim.zip
Comment by tomas — December 26, 2009 @ 11:36 am
check the updated post on this – lots more options on url shortening
Comment by webadmin — December 29, 2009 @ 5:45 am
Wow! what an idea ! What a concept ! Beautiful .. Amazing …
Comment by jhon.lamad@gmail.com — December 29, 2009 @ 9:01 am
i always update my Twitter and i love to twitter my daily activities to my friends and loved ones. i also maintain a personal blog for entries which requires more detail.
Comment by Jake Gomez — February 21, 2010 @ 1:21 am
I love to use Twitter whenever i want to know the latest buzz about my friends. I also use Twitter to know the latest buzz from famous persons *
Comment by Wilson Ransberger — April 27, 2010 @ 11:04 am
microblogging is really useful when you want to broadcast short updates. i am still leaning towards traditional blogging.,’”
Comment by Avery Nelson — May 1, 2010 @ 1:15 pm
[...] This is the link for this awesome tool - http://myopiclunacy.com/2007/11/06/microblogging-with-urltea-my-twitter-bookmarklet [...]
Pingback by My Absolute Favorite and Most Useful Twitter Tool « Learn to Sell More Books — June 24, 2010 @ 4:11 pm