wdouban

DouBan SDK for node.js

Usage no npm install needed!

<script type="module">
  import wdouban from 'https://cdn.skypack.dev/wdouban';
</script>

README

wdouban

DouBan SDK for node.js

npm npm npm

Table of Contents generated with DocToc

安装

npm i --save wdouban
# or
yarn add wdouban

使用说明

参数

username

用户名,必须

type

类型,默认值 book ,可选:

  • book 图书
  • movie 电影
  • music 音乐

status

状态,默认值 mark,可选:

  • mark 想看
  • doing 在看
  • done 看过
  • attend 参与

page

页码,默认值 1

size

每页条数,默认值 50

示例:

const wdouban = require('wdouban');

wdouban({
  username: 'willinwang',
  type: 'book',
  status: 'mark',
  page: 1,
  size: 50
}).then((data) => {
  console.log(data);
});

响应

正确响应

示例:

{
  "status": 1,
  "total": 2,
  "page": 1,
  "pages": 1,
  "size": 50,
  "data": [
    {
      "comment": "",
      "rating": null,
      "sharing_text": "https://www.douban.com/doubanapp/dispatch?uri=/book/27153485/ 来自@豆瓣App",
      "tags": [
        "生活",
        "文学"
      ],
      "platforms": [],
      "create_time": "2018-02-28 16:52:21",
      "status": "mark",
      "id": 1333178450,
      "subject": {
        "rating": {
          "count": 221,
          "max": 10,
          "star_count": 4.5,
          "value": 9.1
        },
        "sharing_url": "https://www.douban.com/doubanapp/dispatch?uri=/book/27153485/",
        "pubdate": [
          "2017-10"
        ],
        "author": [
          "李青菜"
        ],
        "url": "https://book.douban.com/subject/27153485/",
        "pic": {
          "large": "https://qnmob3.doubanio.com/lpic/s29558324.jpg?imageView2/2/q/80/w/600/h/3000/format/webp",
          "normal": "https://qnmob3.doubanio.com/lpic/s29558324.jpg?imageView2/2/q/80/w/200/h/300/format/webp/sharpen/1"
        },
        "uri": "douban://douban.com/book/27153485",
        "is_released": true,
        "card_subtitle": "李青菜 / 2017 / 中信出版社",
        "has_ebook": false,
        "subtype": "book",
        "press": [
          "中信出版社"
        ],
        "title": "当喵星人有了门牌号",
        "type": "book",
        "id": "27153485",
        "null_rating_reason": ""
      }
    },
    {
      "comment": "",
      "rating": null,
      "sharing_text": "https://www.douban.com/doubanapp/dispatch?uri=/book/27073501/ 来自@豆瓣App",
      "tags": [
        "文学"
      ],
      "platforms": [],
      "create_time": "2018-02-28 16:51:17",
      "status": "mark",
      "id": 1333177806,
      "subject": {
        "rating": {
          "count": 316,
          "max": 10,
          "star_count": 4.5,
          "value": 9
        },
        "sharing_url": "https://www.douban.com/doubanapp/dispatch?uri=/book/27073501/",
        "pubdate": [
          "2017-8-1"
        ],
        "author": [
          "[英] 詹姆斯·伍德"
        ],
        "url": "https://book.douban.com/subject/27073501/",
        "pic": {
          "large": "https://qnmob3.doubanio.com/lpic/s29479379.jpg?imageView2/2/q/80/w/600/h/3000/format/webp",
          "normal": "https://qnmob3.doubanio.com/lpic/s29479379.jpg?imageView2/2/q/80/w/200/h/300/format/webp/sharpen/1"
        },
        "uri": "douban://douban.com/book/27073501",
        "is_released": true,
        "card_subtitle": "[英] 詹姆斯·伍德 / 2017 / 河南大学出版社",
        "has_ebook": false,
        "subtype": "book",
        "press": [
          "河南大学出版社"
        ],
        "title": "最接近生活的事物",
        "type": "book",
        "id": "27073501",
        "null_rating_reason": ""
      }
    }
  ]
}

报错响应

示例:

{
  "status": 0,
  "error": "Error Message"
}

License

Apache 2.0

通过支付宝捐赠:

qr