Tuesday, August 18, 2009 at 7:52 PM.
godsTweetSuite.getListFromTwitterHolic
on getListFromTwitterHolic () { <<Changes <<5/4/09; 11:27:52 AM by DW <<Created. local (adrdata = godsTweetSuite.init (), description); adrdata^.stats.ctListUpdates++; adrdata^.stats.whenLastListUpdate = clock.now (); bundle { //get description local (url = "http://twitterholic.com/rss.xml", xstruct); xml.compile (tcp.httpreadurl (url), @xstruct); <<scratchpad.xstruct = xstruct local (adrrss = xml.getaddress (@xstruct, "rss")); local (adrchannel = xml.getaddress (adrrss, "channel")); local (adritem = xml.getaddress (adrchannel, "item")); description = xml.getvalue (adritem, "description")}; <<scratchpad.description = description local (s = description); local (adrtable = @adrdata^.userProfiles, rank = 1); <<new (tabletype, adrtable) bundle { //set all the ranks to 0 local (adr); for adr in adrtable { adr^.rank = 0}}; loop { local (searchfor = "http://twitterholic.com/"); local (ix = string.patternmatch (searchfor, s)); if ix == 0 { break}; s = string.delete (s, 1, ix + sizeof (searchfor) - 1); name = string.nthfield (s, '"', 1); local (adrprofile = godsTweetSuite.initProfile (name)); adrprofile^.rank = rank++}; <<adrtable^.[name] = rank++ bundle { //delete all the profiles whose rank is 0 local (i, adr); for i = sizeof (adrtable^) downto 1 { adr = @adrtable^ [i]; if adr^.rank == 0 { delete (adr)}}}}; bundle { //test code getListFromTwitterHolic ()}
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.