Last active
December 14, 2015 21:09
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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