Skip to content

Instantly share code, notes, and snippets.

@rentzsch
Created October 28, 2009 01:58
Show Gist options
  • Save rentzsch/220167 to your computer and use it in GitHub Desktop.
Save rentzsch/220167 to your computer and use it in GitHub Desktop.
// Store Twitter Replies in Yojimbo.jstalk
//
// Usage: select a subscription in NetNewsWire that contains a bunch of twitter replies you'd like to archive
// (often lazytweet replies). This script will gather all *unread* "headlines" (sadly I can't seem to just
// access selected headlines) and push them into one new Yojimbo note (all hyperlinked and stuff).
var nnw = [SBApplication application:"NetNewsWire"],
headlines = [[nnw selectedSubscription] headlines],
headlineIndex = 0,
headlineCount = [headlines count],
output = '<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body>\n',
headline,
outputFileURL = [NSURL fileURLWithPath:'/tmp/output.html' isDirectory:NO];
for (; headlineIndex < headlineCount; headlineIndex++) {
headline = [headlines objectAtIndex:headlineIndex];
if (![headline isRead]) {
output += '<p><a href="'+[headline URL]+'"><b>'+[headline creator]+':</b></a> '+[headline title]+'</p>\n';
}
}
output += '</body></html>';
output = [NSString stringWithString:output];
[output writeToURL:outputFileURL atomically:YES encoding:NSUTF8StringEncoding error:nil];
(function(){
var yojimbo = [SBApplication application:"Yojimbo"];
newNote = [yojimbo import:[NSArray arrayWithObject:outputFileURL]];
[newNote setName:'twitter imported replies'];
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment