Ordered Lists of Links from delicious Using Yahoo Pipes
One of the things that I often use the delicious social bookmarking service for is to push lists of links into web pages, web dashboards, or the feedshow link presenter. However, sometimes it’s important to be able to push the links in a particular order (particularly for the link presenter) rather than the order in which the links were bookmarked (i.e. order by timestamp based on when the bookmark was saved).
So a couple of days ago it occurred to me that I should be able to do this with a simple Yahoo Pipe by using a tags to order the sequence of links and sorting on those. So for anyone who remembers programming in BASIC, and number the lines 10, 20, 30 (or 100, 200, 300) to give yourself “room” to insert additional lines, the following convention may be familiar…
STEP 1: tag your links according to the convention: ORDERLABEL:nnn. So for example, to provide raw testing material for my pipe I tagged three links with the following variants: orderA:1000, orderB:120, orderC:103; orderA:3000, orderB:110, orderC:102; and orderA:2000, orderB:130, orderC:101. It also makes sense to tag each item with just ORDERLABEL, so you can pull out just those items from delicious.
STEP 2: build the pipe. My idea here was to grab the list of tags for each link as a string, use a regular expression to just parse out the sequence number from the string, having been provided by the order label (e.g. orderA, orderB or orderC in my test case), and then sort the feed on those numbers…
Unfortunately, delicious doesn’t emit all the tags in a single element (at least, not as far as Yahoo! Pipes are concerned):
And even more unfortunately (for me at least), I don’t know an effective way of combining these sub-elements into a single element? (The Sub-element pipe operator will convert every item in each category subelement list to an element in it’s own right, but that’s not a lot of use as I don’t know how to copy the tilte, link and description elements into each category subelement…)
So what to do?
Well, it turns out you can use this sort of construction in a regular expression block:
${category.0.content}
which says “use the content of the 0′th category subelement”.
Which means in turn that if I refer to each of n tags explicitly (as in: ${category.n.content}), I can construct a single string containing all n categories (i.e. all the tags in a single string).
We copy the title element as an element of convenience to create an order element within the feed. The string block constructs a single replacement string for the regular expression that will replace the original contents of the order element with the content element from the first 16 category subelements. Following the regular expression replacement, the order element now contains up to the first 16 tags associated with the element in a single string.
The next step is to filter the feed so that we only pass elements that contain tags that are based on the ORDERLABEL root (in this case, I am sorting on things like orderA:1000, orderA:2000, etc):
(Remember that we could use another tag (I usedorderedfeedtest in this example) to pull in all the orderA:nnn tagged bookmarks.)
The appropriately order number tagged elements are then processed so that the order element is rewritten with just the “line number” for each feed item (so e.g. orderA:2000 would become 2000, and the items in the feed sorted using this element.
By specifying the appropriate ordering label, we can force the order in which feed items are displayed:
And then:
You can find the pipe here: delicious feed ordered by “tag line numbers”.
Written by Tony Hirst
April 22, 2009 at 12:30 am
Posted in Tinkering, Pipework, Radical Syndication
7 Responses
Subscribe to comments with RSS.







Sweet memories of BASIC. Very handy – thanks for this.
Carl Morris
April 22, 2009 at 2:42 pm
Wow, thanks for the graduate level Pipe class ;-) This definitely works; the downside of course is the cognitive overhead of tagging in such a prescribed order. But I can see perhaps a group project where people are expected to use but one order tag.
Alan
April 22, 2009 at 2:51 pm
@alan So the next step would be to build a UI mashup to delicious that will display the links from a particular tag combination feed (the links you want to appear in an ordered list), order them as required (drag’n'drop goodness) and then autotag them with ordering tags via the delicious API…?
Unfortunately, I have way too much on for the next few weeks to try this… :-(
A stop gap would be to do the editing in delicious, and create a greasemonkey script to just tweak the order/layout on the delicious page according to a specified ordering tag?
Tony Hirst
April 22, 2009 at 9:42 pm
Hey thanks for the tip about combining multiple elements into a single element. I was stuck trying to do this and Google lead me here!
stuartm
June 3, 2009 at 9:32 am
[...] Note: as the pipe stands, the order of items in the feed will correspond to the order in which they were bookmarked. It is possible to tag each bookmark with its desired position in the RSS feed, but that is a rather more advanced topic. (See a soon to be(?!)* deprecated solution to that problem here: Ordered Lists of Links from delicious Using Yahoo Pipes. [...]
Single Page RSS Feeds – So What? So this… « OUseful.Info, the blog…
July 9, 2009 at 12:59 pm
[...] Drag and Drop Ordered Links in Delicious? Published August 20, 2009 Thinkses Leave a Comment Tags: delicious, feedshow, jquery, ordered list, reading list One of the things I’ve been interested in for some time is how to use social bookmarking services like delicious as a database for ordered link collections (for example, Ordered Lists of Links from delicious Using Yahoo Pipes). [...]
Drag and Drop Ordered Links in Delicious? « OUseful.Info, the blog…
August 20, 2009 at 1:43 pm
Thanks so much for this! You got me past the ‘subitem’ issue and I created a general pipe for creating a feed for delicious bookmarks that receive more than a set number of saves with given tags:
http://pipes.yahoo.com/comprendia/deliciousbio
I think this may be useful for others as well, they can change the words in the ‘filter’ and customize it to see hot links in real time.
Thanks again!
Mary
Mary Canady
January 2, 2010 at 9:24 pm