Giter Site home page Giter Site logo

pin-it-node's Introduction

(Unofficial) "Pin It" Pinterest API

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.

Installation

From the command line

npm install pin-it-node

In package.json

{
	dependencies: {
		"pin-it-node": "~0.1.0"
	}
}

Usage

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

Getting the boardId

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)

Advanced Options

'request' module options

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.

debug mode

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
});

...

Versioning

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.

Unit tests

Not yet complete.

To run the tests...

$ cd tests/
$ npm install
$ node_modules/.bin/mocha pinItTests.js

Author

Ken Goldfarb http://www.kengoldfarb.com

License

MIT. Do whatever you want with it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.