Monday, November 08, 2010 at 12:01 AM.
system.verbs.apps.FriendFeed.getUserOpml
on getUserOpml (username) { <<Changes <<12/24/08; 6:42:30 AM by DW <<Created. Return the user's subscription list in OPML format. <<http://www.opml.org/spec2#subscriptionLists <<Even though this doesn't appear to be documented, I'm assuming that the RSS feed is located here: <<http://friendfeed.com/api/feed/user/bret?format=rss <<Imho, this is a function that should be part of the FriendFeed API. local (profile); local (rssuserurltemplate = "http://friendfeed.com/api/feed/user/<user>?format=rss"); local (rssroomurltemplate = "http://friendfeed.com/api/feed/room/<user>?format=rss"); friendfeed.getuserprofile (username, @profile); <<scratchpad.profile = profile local (xmltext = "", indentlevel = 0, now = clock.now ()); on add (s) { xmltext = xmltext + string.filledstring ("\t", indentlevel) + s + "\r"}; on encode (s) { if system.environment.isMac { return (xml.entityEncode (latinToMac.macToLatin (s), true))} else { return (xml.entityEncode (s, true))}}; add ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); add (""); add ("<!-- Generated by " + frontier.getprogramname () + " on " + clock.now () + " Pacific -->"); add (""); add ("<opml version=\"2.0\" xmlns:ff=\"http://api.friendfeed.com/2008/03\">"); indentlevel++; bundle { //add <head> add ("<head>"); indentlevel++; add ("<title>FriendFeed subscriptions for \"" + username + "\"</title>"); <<add ("<dateCreated>" + date.netstandardstring (now) + "</dateCreated>") add ("<dateModified>" + date.netstandardstring (now) + "</dateModified>"); add ("</head>"); indentlevel--}; bundle { //add <body> on addsub (adrsub, urltemplate) { local (rssurl, name, prof, ffnickname); ffnickname = nameof (adrsub^); rssurl = string.replace (urltemplate, "<user>", ffnickname); name = encode (adrsub^.name); if defined (adrsub^.profileUrl) { prof = encode (adrsub^.profileUrl)} else { if defined (adrsub^.url) { prof = encode (adrsub^.url)}}; add ("<outline type=\"rss\" text=\"" + name + "\" xmlUrl=\"" + rssurl + "\" htmlUrl=\"" + prof + "\" title=\"" + name + "\" ff:nickname=\"" + ffnickname + "\" />")}; local (adrsub); add ("<body>"); indentlevel++; for adrsub in @profile.subscriptions { addsub (adrsub, rssuserurltemplate)}; for adrsub in @profile.rooms { addsub (adrsub, rssroomurltemplate)}; add ("</body>"); indentlevel--}; add ("</opml>"); indentlevel--; return (xmltext)}; bundle { //test code s3.newobject ("/static.opml.org/friendfeed/bret.opml", getUserOpml ("bret"), type:"text/plain")}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.