Skip to content

Instantly share code, notes, and snippets.

@maxmechanic
Created March 17, 2013 14:36
Show Gist options
  • Save maxmechanic/5181800 to your computer and use it in GitHub Desktop.
Save maxmechanic/5181800 to your computer and use it in GitHub Desktop.
Command-line script to pull links from 5by5 shownotes into Pinboard.
var shownotes = require('shownotes');
var Pinboard = require('node-pinboard');
var _ = require( 'underscore' );
var argv = require('optimist').demand(['network', 'show', 'ep','token']).argv;
var pinboard = new Pinboard(argv.token);
linksToPinboard(argv.network, argv.show, argv.ep);
function linksToPinboard(network, show, episode) {
shownotes.get(network, show, episode, function (notes) {
var showTag = '';
_.each(show.split(' '), function(word) {
showTag += word;
});
_.each(notes.links, function(link) {
var options = {
url: link.url,
description: link.title,
tags: [network,showTag,episode].join(','),
extended: show + ': ' + notes.title + ' ' + notes.download
};
pinboard.add(options, function (res) {
console.log(res);
});
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment