Skip to content

Instantly share code, notes, and snippets.

@maxmechanic
Last active December 14, 2015 21:09
Show Gist options
  • Save maxmechanic/5148852 to your computer and use it in GitHub Desktop.
Save maxmechanic/5148852 to your computer and use it in GitHub Desktop.
My Node.js script for pulling shownotes into Pinboard. Requires 'npm install' or a package.json for dependencies.
var Shownotes = require('shownotes');
var Pinboard = require('node-pinboard');
var _ = require( 'underscore' );
var api_token = 'user:NNNNNNN'; //Pinboard API token found in Settings -> Password
var shownotes = new Shownotes();
var pinboard = new Pinboard(api_token);
linksToPinboard('5by5','back to work', 102);
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
};
console.log(options);
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