Skip to content
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.

hygkui/jd-book

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

what is jd-book

jd-book can help you get book's information from jd.com.

why

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

install

npm install jd-book

usage

var jdBook = require('jd-book');
jdBook.getbook(url,callback);

config

url:

the url of the book form jd.com

callback:

function (data) {
  // ...
}
  • data format:
{
  err: ;
  book: {
    ...
  }
}

example

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: ''
  }
}

test

npm test

or

node tests/getbook-test.js

About

search book from jd.com. using nodejs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published