jd-book can help you get book's information from jd.com.
Though jd.com has it's api system, it is difficult to use.
And I only want is the book's information from the book's url on jd.com
npm install jd-book
var jdBook = require('jd-book');
jdBook.getbook(url,callback);
the url of the book form jd.com
function (data) {
// ...
}
- data format:
{
err: ;
book: {
...
}
}
run this code:
var jdBook = require('jd-book');
var url = 'http://item.jd.com/11371982.html';
var show = function (data) {
if (!data.err)
console.log(data.book);
}
jdBook.getbook(url, show);
the result should be like this:
{ err: null,
book: {
skuid: '11371982',
name: '聪明豆绘本系列(第2辑)(套装共9册)',
url: undefined,
jqimg: 'http://img10.360buyimg.com/n0/g13/M04/11/0D/rBEhU1LTb8kIAAAAAAP8X7M6epEAAH3cwOFK2sAA_x3284.jpg',
price: '134.10',
buy_price: '103.10',
author: '',
pub: '',
pub_time: ''
}
}
npm test
or
node tests/getbook-test.js