Skip to content

matiassingers/shelfies-amazon-linker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shelfies-amazon-linker Build Status Dependency Status

get markdown formatted string from book title

A quick CLI tool to get Markdown formatted strings to be used in the documentation of topshelfie.co. Want to help? Head over to the repo kyro/shelfies.

The final Markdown formatted string looks like this with the book sub/alternate title:

[Why Nations Fail](http://www.amazon.com/Why-Nations-Fail-Origins-Prosperity/dp/0307719227) - *The Origins of Power, Prosperity, and Poverty*

Install

$ npm install --save shelfies-amazon-linker

Usage

The Amazon Product Advertising API requires the following credentials to be passed with every single call:

  • AWS access key ID - AWS_ID
  • AWS secret access key - AWS_SECRET
  • Amazon associate tag - AWS_TAG

shelfies-amazon-linker looks for these values in environment variables named: AWS_ID, AWS_SECRET and AWS_TAG. Please ensure that these are set before running the package.

var shelfiesAmazonLinker = require('shelfies-amazon-linker');

shelfiesAmazonLinker('why nations fail', function(err, result){
  if(err){
    // handle the error
  }
  
  console.log(result);
  // => { url: 'http://www.amazon.com/Why-Nations-Fail-Origins-Prosperity/dp/0307719227',
  //      author: [ 'Daron Acemoglu', 'James Robinson' ],
  //      title: 'Why Nations Fail',
  //      subtitle: 'The Origins of Power, Prosperity, and Poverty',
  //      markdown: '[Why Nations Fail](http://www.amazon.com/Why-Nations-Fail-Origins-Prosperity/dp/0307719227) - *The Origins of Power, Prosperity, and Poverty*' }
});

CLI

$ npm install --global shelfies-amazon-linker

The command-line tool joins every parameter into a string, allows the user to omit quotes around the search term.

$ shelfies-amazon-linker --help

  Example
    shelfies-amazon-linker why nations fail
    
    Looking up: "why nations fail"
    Authors: [ 'Daron Acemoglu', 'James Robinson' ]
    [Why Nations Fail](http://www.amazon.com/Why-Nations-Fail-Origins-Prosperity/dp/0307719227) - *The Origins of Power, Prosperity, and Poverty*
    
    Copied to your clipboard
    

License

MIT © Matias Singers

About

get markdown formatted string from book title

Resources

License

Stars

Watchers

Forks

Packages

No packages published