This is an unofficial interface to Pinterest's pin-it api. You can pin anything you want to your own boards programatically using nodejs!
Note: Pinterest could change their api at any time causing this library to break. You've been warned.
npm install pin-it-node
{
dependencies: {
"pin-it-node": "~0.1.0"
}
}
var PinIt = require('pin-it-node');
var pinIt = new PinIt({
username: 'MyUsername',
password: 'MySuperSecretPassword'
});
pinIt.pin({
boardId: '123',
url: 'http://www.kengoldfarb.com', // The click back link from pinterest
description: 'Wow. Such dev.',
media: 'http://www.kengoldfarb.com/images/pin-it.png' // The actual image that will be pinned
}, function(err, pinObj) {
if(err) {
// Uh-oh...handle the error
console.log(err);
return;
}
console.log('Success! New pin has been added to the board.');
console.log(pinObj);
})
Currently only pinning of images is supported
You can get the boardId by going to pinterest and inspecting the GET request to http://www.pinterest.com/resource/BoardResource/get/. You should see it listed in the "module_path" parameter of the request in the format: resource=BoardResource(board_id=1234567)
This module makes all it's http(s) requests using request. You can optionally pass in a set of options for this module when making a request.
For example...
var PinIt = require('pin-it-node');
var pinIt = new PinIt({
username: 'MyUsername',
password: 'MySuperSecretPassword',
requestDefaults: {
proxy:'http://127.0.0.1:8888',
strictSSL: false
}
});
pinIt.pin({
...
});
Consult the request module documentation for a full list of options.
When instantiating set options.debug = true
for more verbose log output.
var PinIt = require('pin-it-node');
var pinIt = new PinIt({
username: 'MyUsername',
password: 'MySuperSecretPassword',
debug: true
});
...
This project will follow the Semantic Versioning 2.0.0 guidelines once version 1.0.0 is released. Until that time, any updates might be backwards-incompatible changes.
Since this is an unofficial api, a "stable" version 1.0.0 will be released once this has been tested in the wild and includes reasonable unit testing.
Not yet complete.
To run the tests...
$ cd tests/
$ npm install
$ node_modules/.bin/mocha pinItTests.js
Ken Goldfarb http://www.kengoldfarb.com
MIT. Do whatever you want with it.