Posts Tagged ‘twitter’

Twitter: A microformat in lieu of a protocol

November 21, 2009

In May of this year I wrote about the problems of URLs for a given Twitter user’s profile, or for an individual post or “status” being different, depending the Twitter client in use. I suggested a new protocol for Twitter links. [You might want to read that, before the rest of this post]. I can’t believe I didn’t think of this simpler solution sooner!

The answer (in the short term) is to use a microformat (or a microformat-like “poshsformat”, if you prefer to call it that) for each case. Let’s say we use the classes twitter-user & twitter-status.

User-agents (that’s jargon for browsers) could then employ a script (such as those used by GreaseMonkey, or a Firefox extension) to ignore the encoded URL and substitute the equivalent for the user’s preferred Twitter client instead.

For links to user profiles:

<a
href="http://twitter.com/pigsonthewing">
Andy Mabbett
</a>

would become:

<a
class="twitter-user"
href= "http://twitter.com/pigsonthewing">
Andy Mabbett
</a>

and:

<a
href="http://accessibletwitter.com/app/user.php?uid=pigsonthewing">
Andy Mabbett</a>

would become:

<a
class="twitter-user"
href=" http://accessibletwitter.com/app/user.php?uid=pigsonthewing">
Andy Mabbett</a>

Likewise, for individual statuses:

<a
href="twitter.com/pigsonthewing/status/1828036334">
something witty</a>

would become:

<a
class="twitter-status"
href="twitter.com/pigsonthewing/status/1828036334">
something wittyg<a>

and:

<a
href="accessibletwitter.com/app/status.php?1828036334">
something witty<a>

would become:

<a
class="twitter-status"
href="accessibletwitter.com/app/status.php?1828036334">
something witty<a>

and:

<a
href="m.slandr.net/single.php?id=1828036334"
something witty</a>

would become:

<a
class="twitter-status"
href="m.slandr.net/single.php?id=1828036334">
something witty</a>

To simplify matters, the rules for extracting the user ID or the status update could be the same in both cases:

  1. Parse the value of the href attribute of the element to which the class applies.
  2. If there is a question mark, use everything after that.
  3. Otherwise, if there is an equals sign, use everything after that.
  4. Otherwise, use everything after the last slash.

That would deal with all the examples in my earlier post.

So, if you’re using a user-agent which is aware of this microformat, and find on a page:

<a
class="twitter-user"
href="http://twitter.com/pigsonthewing">
Andy Mabbett<a>
said
<a
class="twitter-status"
href="m.slandr.net/single.php?id=1828036334">
something witty<a>

but your preferred Twitter client is Dabr (one I recommend, BTW!) then your browser would treat (and possibly render) that as:

<a
href="dabr.co.uk/user/pigsonthewing">
Andy Mabbett<a>
said
<a
class="twitter-status"
href="dabr.co.uk/status/1828036334">
something witty<a>

Simples!

Triple-tag references to Twitter posts

May 30, 2009

Further to my post about a protocol for Twitter posts, you can also triple-tag blog posts, Flickr images and similar web utterances, which refer to a specific twitter post (or status) like this: twitter:status=1975532392 – and this post is tagged with that!

[Update: See also my Flickr screenshot of a Twitter post, triple tagged with #twitter:status=1828036334 to reference the same post.]

Twitter: canonical URLs and Protocols

May 17, 2009

On Twitter, I’m twitter.com/pigsonthewing, but in my preferred twitter client, Dabr, I’m dabr.co.uk/user/pigsonthewing. We might refer to the former as the “canonical” URL.

There are a number of other web-based Twitter clients, too, and people using them can find my twitter stream, variously, at:

Likewise each of my Twitter posts, or “tweets”, has a URL on each of some of those domains (though not on all, it seems). For example:

Twitter

Dabr

are all the same tweet. We can again regard the first of them, on twitter.com, as canonical.

Anyone using one of those services, and who wants to link to my profile or one of my tweets will either post the URL as it appears in their service, which isn’t much use to people not using that service, or expend time and effort translating the URL into the generic, canonical, Twitter format — which even then may not be of much use to someone using something else.

In the short term, we could do with some recognition of this fact from the above services, which might provide a link to the “standard” or canonical URL for that tweet; and when doing so on an individual page, should link to it using rel="alternate" and/ or rel="canonical".

Better still, there could be browser tools (such as FireFox plug-in or Greasemonkey script) to do that task, automagically.

Ultimately, though, as Twitter becomes ever more widespread, perhaps we need a pair of protocols for linking to Twitter profiles and posts. Using this, authors would be able to mark up links to me and my comments on Twitter as, say:

<a href="twitter:pigsonthewing">Andy Mabbett</a> said <a href="twitterpost:1827840116">something witty</a>.

Then, each reader could set their computer to open those links their choice of browser-based or desk-top/ mobile phone client. The setting to do could even be changed in the installation package for such tools, to aid non-technical users.

Footnote: if you know of another URL for my Twitter stream, please let me know!

Suggested method of publishing microformats in Twitter posts

January 5, 2008

Twitter posts like this one:

We’re still deep in the Sundarbans, near Tambulbunia, meeting experts on dolphins and tigers. l:Tambulbunia, Bangladesh=22.27722,89.71905

have a place- name and corresponding coordinates (indicated by the prefix “l:”). This has allowed them to be plotted on a map.

It should be possible for the poster to send, say:

We’re still deep in the Sundarbans, near Tambulbunia, meeting experts on dolphins and tigers. #hcard: fn+locality:Tambulbunia: country-name:Bangladesh: geo:22.27722,89.71905

using colons as delimiters and have Twitter render that comment marked up as an hCard.

In the short term, this could be achieved by a third-party site, like #hashtags .

UPDATE:  being more mindful of the 140 character limit than I have in the above example, perhaps class names might be abbreviated (“loc” for “locality”, “ctry” for “country-name”, and so on).