{"id":36846511,"url":"https://github.com/acdzh/douban-book-api","last_synced_at":"2026-01-12T14:33:14.945Z","repository":{"id":40372035,"uuid":"398783291","full_name":"acdzh/douban-book-api","owner":"acdzh","description":"第三方豆瓣读书 api 接口","archived":false,"fork":false,"pushed_at":"2023-01-30T06:08:06.000Z","size":853,"stargazers_count":77,"open_issues_count":0,"forks_count":20,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-04-04T18:54:43.808Z","etag":null,"topics":["calibre","douban","douban-book","koa","node"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/acdzh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-22T11:31:05.000Z","updated_at":"2023-03-28T16:25:27.000Z","dependencies_parsed_at":"2023-02-16T04:31:34.680Z","dependency_job_id":null,"html_url":"https://github.com/acdzh/douban-book-api","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/acdzh/douban-book-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acdzh%2Fdouban-book-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acdzh%2Fdouban-book-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acdzh%2Fdouban-book-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acdzh%2Fdouban-book-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/acdzh","download_url":"https://codeload.github.com/acdzh/douban-book-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acdzh%2Fdouban-book-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28340400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["calibre","douban","douban-book","koa","node"],"created_at":"2026-01-12T14:33:14.863Z","updated_at":"2026-01-12T14:33:14.929Z","avatar_url":"https://github.com/acdzh.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Douban Book Api for Calibre\n\n## 简介\n\n这是一个使用爬虫实现的第三方豆瓣读书 api 接口. 本项目中没有任何数据, 请自行搭建. 鉴于豆瓣关闭 api 接口并封禁 apiKey, 爬虫有被风控的风险, 请控制好抓取频次.\n\n## Demo\n\n[https://acdzh-douban-book-api.herokuapp.com/](https://acdzh-douban-book-api.herokuapp.com/)\n\n服务部署在 Heroku, 访问量较大可能会被屏蔽, 请不要在正式环境使用该地址的服务.\n\n## 安装\n\n### 一键部署\n\n**请注意: 一键部署使用 Heroku 环境, 项目不对任何在第三方平台行为造成的后果负责**\n\n[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)\n\n### Using Docker\n\n```bash\nsudo docker run -d \\\n--name douban-book-api-1 \\\n-p 3000:3000 \\\n-v /CACHE_DIR:/cache \\\nacdzh/douban-book-api\n```\n\n### Using node\n\n```bash\nnpm install\nnpm start\n```\n\n之后访问 `http://localhost:3000/` 即可.\n\n## API 接口说明\n\n### 图书搜索接口\n\n#### 请求地址  \n\n`{HOST}/search?text=\u003ctext\u003e`  \n\n#### 请求方式  \n\n**GET**  \n\n#### 请求参数  \n\n##### Header 参数  \n\n| 参数名          | 必选  | 类型/参数值           | 说明     |\n|--------------|-----|------------------|--------|\n| Content-Type | 是   | application/json | 请求参数类型 |\n\n#### 返回示例\n\n`[{HOST}/search?text=刘慈欣`: [DEMO](https://acdzh-douban-book-api.herokuapp.com/search?text=刘慈欣)\n\n```json\n{\n  \"success\": true,\n  \"data\": [\n    {\n      \"title\": \"刘慈欣 Cixin Liu\",\n      \"abstract_2\": \"作者 / 1963-06-01 / 三体 / 三体Ⅱ / 三体Ⅲ\",\n      \"labels\": [],\n      \"url\": \"https://book.douban.com/author/4561353/\",\n      \"id\": 4561353,\n      \"abstract\": \"8693 人收藏\",\n      \"cover_url\": \"https://img9.doubanio.com/view/celebrity/raw/public/p1543395922.04.jpg\",\n      \"more_url\": \"\",\n      \"tpl_name\": \"search_common\"\n    },\n    {\n      \"id\": 33146,\n      \"labels\": [],\n      \"tpl_name\": \"search_simple\",\n      \"abstract\": \"中国工人出版社 / 共3册\",\n      \"title\": \"[丛书] 刘慈欣作品\",\n      \"url\": \"https://book.douban.com/series/33146\"\n    },\n    {\n      \"more_url\": \"onclick=\\\"moreurl(this,{i:'0',query:'%E5%88%98%E6%85%88%E6%AC%A3',subject_id:'2567698',from:'book_subject_search',cat_id:'1001'})\\\"\",\n      \"url\": \"https://book.douban.com/subject/2567698/\",\n      \"extra_actions\": [\n        {\n          \"url\": \"https://book.douban.com/subject/2567698/?channel=subject_list\u0026platform=web\",\n          \"color\": \"#CF5B40\",\n          \"text\": \"豆瓣书店有售\"\n        }\n      ],\n      \"labels\": [],\n      \"label_actions\": [],\n      \"rating\": {\n        \"rating_info\": \"\",\n        \"star_count\": 4.5,\n        \"count\": 410716,\n        \"value\": 8.8\n      },\n      \"cover_url\": \"https://img1.doubanio.com/view/subject/m/public/s2768378.jpg\",\n      \"interest\": null,\n      \"topics\": [],\n      \"tpl_name\": \"search_subject\",\n      \"title\": \"三体 : “地球往事”三部曲之一\",\n      \"id\": 2567698,\n      \"abstract\": \"刘慈欣 / 重庆出版社 / 2008-1 / 23.00\",\n      \"abstract_2\": \"\"\n    }\n  ],\n  \"is_cache\": false\n}\n```\n\n这个返回的结果对应 [https://search.douban.com/book/subject_search?search_text=刘慈欣](https://search.douban.com/book/subject_search?search_text=%E5%88%98%E6%85%88%E6%AC%A3), 见下图: \n\n![](./docs/search.png)\n\n\n#### 备注\n\n考虑到大部分的预期结果都出现在第一页, 所以搜索暂未设计翻页. 如果后续发现此需求确有必要, 会考虑升级.\n\n### 根据豆瓣 id 或 isbn 获取图书详情\n\n#### 请求地址  \n\n`{HOST}/subject/\u003cid\u003e`  \n`{HOST}/isbn/\u003cisbn\u003e`\n\n#### 请求方式  \n\n**GET**  \n\n#### 请求参数  \n\n##### Header 参数  \n\n| 参数名          | 必选  | 类型/参数值           | 说明     |\n|--------------|-----|------------------|--------|\n| Content-Type | 是   | application/json | 请求参数类型 |\n\n#### 返回示例\n\n`{HOST}/subject/27012117`: [DEMO](https://acdzh-douban-book-api.herokuapp.com/subject/27012117)  \n`{HOST}/isbn/9787208140400`: [DEMO](https://acdzh-douban-book-api.herokuapp.com/isbn/9787208140400)\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"title\": \"政治的逻辑\",\n    \"subtitle\": \"马克思主义政治原理\",\n    \"original_title\": \"\",\n    \"id\": \"27012117\",\n    \"isbn\": \"9787208140400\",\n    \"author\": [\"王沪宁\", \"林尚立\",\"孙关宏\"],\n    \"translator\": [],\n    \"publish\": \"上海人民出版社\",\n    \"producer\": \"\",\n    \"publishDate\": \"2016-10\",\n    \"pages\": \"650\",\n    \"price\": \"98.00元\",\n    \"binding\": \"精装\",\n    \"series\": \"\",\n    \"book_intro\": \"《政治的逻辑》是高校社会科学....\",\n    \"author_intro\": \"王沪宁，复旦大学政治学教授...\",\n    \"catalog\": [\"序言\", \"......\", \"后记\"],\n    \"original_texts\": [\"阶级消亡...\", \"国家是...\"],\n    \"labels\": [\"政治学\", \"马克思主义\", \"王沪宁\", \"政治\", \"政治经济学\", \"马克思\", \"中国\", \"社会学\"],\n    \"cover_url\": \"https://img2.doubanio.com/view/subject/l/public/s29602841.jpg\",\n    \"url\": \"https://book.douban.com/subject/27012117/\",\n    \"rating\": {\n      \"count\": 176,\n      \"info\": \"\",\n      \"value\": 8.7,\n      \"five_star_per\": 53.4,\n      \"four_star_per\": 33,\n      \"three_star_per\": 8,\n      \"two_star_per\": 2.8,\n      \"one_star_per\": 2.8\n    },\n    \"comments\": [{\n      \"vote\": 1,\n      \"user_name\": \"乔治 ♘\",\n      \"user_page\": \"https://www.douban.com/people/165208204/\",\n      \"rating\": 4,\n      \"date\": \"2021-04-07\",\n      \"content\": \"中国马克思主义的集大成...\"\n      }],\n    \"reviews\": [{\n      \"user_avatar\": \"https://img1.doubanio.com/icon/u1566359-9.jpg\",\n      \"user_name\": \"月之仙者\",\n      \"user_page\": \"https://www.douban.com/people/yuezhixianzhe/\",\n      \"rating\": 3,\n      \"time\": \"2008-08-06 09:53:30\",\n      \"publisher\": \"上海人民出版社2004版\",\n      \"publisher_page\": \"https://book.douban.com/subject/1003659/\",\n      \"title\": \"政治的逻辑：马克思主义政治学原理\",\n      \"url\": \"https://book.douban.com/review/1463309/\",\n      \"short_content\": \"经过十天左右的时间终于看完了...\",\n      \"useful_count\": 53,\n      \"useless_count\": 2,\n      \"reply_count\": 8\n    }],\n    \"notes\": []\n  },\n  \"is_cache\": false\n}\n```\n\n这个返回的结果对应 [https://book.douban.com/subject/27012117/](https://book.douban.com/subject/27012117/) 或者 [https://book.douban.com/isbn/9787208140400/](https://book.douban.com/isbn/9787208140400/), 见下图: \n\n![](./docs/id.png)\n\n#### 数据格式\n\n| 首级标签           | 次级标签   | 三级标签     | 名称                                                              | 类型                                                                 | 示例  | 备注  |\n|----------------|--------|----------|-----------------------------------------------------------------|--------------------------------------------------------------------|-----|-----|\n| title          ||| 标题     | string   | \"政治的逻辑\"                                                         ||\n| subtitle       ||| 副标题    | string   | \"马克思主义政治原理\"                                                     ||\n| original_title ||| 原标题    | string   || 适用于译著                                                           |\n| id             ||| 豆瓣 id  | string   | \"27012117\"                                                      ||\n| author         ||| 作者     | string[] | [\"王沪宁\", \"林尚立\", \"孙关宏\"]                                           | 顺序与豆瓣页面一致, 不进行排序                                                   |\n| translator     ||| 译者     | string[] | []                                                              | 顺序与豆瓣页面一致, 不进行排序                                                   |\n| publish        ||| 出版社    | string   | \"上海人民出版社\"                                                       ||\n| producer       ||| 出品方    | string   | \"\"                                                              ||\n| publishDate    ||| 出版年    | string   | \"2016-10\"                                                       ||\n| pages          ||| 页数     | string   | \"650\"                                                           ||\n| price          ||| 定价     | string   | \"98.00元\"                                                        ||\n| binding        ||| 装帧     | string   | \"精装\"                                                            ||\n| series         ||| 丛书     | string   | \"\"                                                              ||\n| book_intro     ||| 内容简介   | string   | \"《政治的逻辑》是..\"                                                    ||\n| author_intro   ||| 作者简介   | string   | \"王沪宁，复旦大学...\"                                                   ||\n| catalog        ||| 目录     | string[] | [\"序言\", \"...\"]                                                   ||\n| original_texts ||| 原文摘录   | string[] | [\"阶级消亡...\"]                                                     ||\n| labels         ||| 标签     | string[] | [\"政治学\",\"马克思主义\"]                                                 ||\n| cover_url      ||| 封面地址   | string   | \"https://img2.doubanio.com/view/subject/l/public/s29602841.jpg\" | ![](https://img2.doubanio.com/view/subject/l/public/s29602841.jpg) |\n| url            ||| 豆瓣页面地址 | string   | \"https://book.douban.com/subject/27012117/\"                     | [政治的逻辑 (豆瓣)](https://book.douban.com/subject/27012117/)            |\n| rating         ||| 豆瓣评分   | object   |||\n|| count          || 评分人数   | number   | 176                                                             ||\n|| info           || 评分信息   | \"\" \\     | \"目前无人评价\" \\                                                      | \"评价人数不足\"                                                           |\"\"|当评分不足时, 此项不为空|\n|| value          || 分数     | number   | 8.7                                                             ||\n|| five_star_per  || 五星占比   | number   | 53.4                                                            | 百分数                                                                |\n|| four_star_per  || 四星占比   | number   | 33                                                              | 百分数                                                                |\n|| three_star_per || 三星占比   | number   | 8                                                               | 百分数                                                                |\n|| two_star_per   || 二星占比   | number   | 2.8                                                             | 百分数                                                                |\n|| one_star_per   || 一行占比   | number   | 2.8                                                             | 百分数                                                                |\n| comments       ||| 短评     | object[] || 该项为数组, 包括最新短评与热门短评, 短评有字数限制                                     |\n|| vote           || 有用数    | number   | 1                                                               ||\n|| user_name      || 用户昵称   | string   | \"乔治 ♘\"                                                          ||\n|| user_page      || 用户主页   | string   | \"https://www.douban.com/people/165208204/\"                      | [乔治 ♘](https://www.douban.com/people/165208204/)                   |\n|| rating         || 评分     | number   | 4                                                               ||\n|| date           || 日期     | string   | \"2021-04-07\"                                                    ||\n|| content        || 内容     | string   | \"中国马克思主义...\"                                                    ||\n| reviews        ||| 书评     | object[] || 此项为数组, 包含热门书评与最新书评                                              |\n|| user_avatar    || 用户头像   | string   | \"https://img2.doubanio.com/icon/u176380444-1.jpg\"               | ![](https://img2.doubanio.com/icon/u176380444-1.jpg)               |\n|| user_name      || 用户昵称   | string   | \"东风一号\"                                                          ||\n|| user_page      || 用户主页   | string   | \"https://www.douban.com/people/176380444/\"                      | [东风一号](https://www.douban.com/people/176380444/)                   |\n|| rating         || 评分     | number   | 4                                                               ||\n|| time           || 日期     | string   | \"2018-04-27 00:35:23\"                                           ||\n|| publisher      || 版本     | string   | \"上海人民出版社2004版\"                                                  | 同一本书不同版本下的书评, 如果该项为空, 则说明用户所读的是当前版本                                |\n|| publisher_page || 对应版本页面 | string   | \"https://book.douban.com/subject/1003659/\"                      | [政治的逻辑 (豆瓣)](https://book.douban.com/subject/1003659/)             |\n|| title          || 标题     | string   | \"王沪宁《政治的逻辑》读后感\"                                                 ||\n|| url            || 书评链接   | string   | \"https://book.douban.com/review/9320713/\"                       | [王沪宁《政治的逻辑》读后感（政治的逻辑）书评](https://book.douban.com/review/9320713/)  |\n|| short_content  || 书评摘要   | string   | \"花了十几天的时间终于...\"                                                 ||\n|| useful_count   || 有用数    | number   | 16                                                              ||\n|| useless_count  || 没用数    | number   | 1                                                               ||\n|| reply_count    || 回应数    | number   | 2                                                               ||\n| notes          ||| 读书笔记   | object[] || 开发中...                                                          |\n| discussion     ||| 论坛     | object[] || 开发中...                                                          |\n\n## 缓存\n\n查询会强制写缓存. 缓存文件夹路径由环境变量 `CACHE_DIR` 决定, 缺省情况下是 `./.cache`, docker 中该路径为 `/cache`. 缓存存于这个文件夹下的 `books.sqlite` 中.\n\n默认会先从缓存中查询, 如果需要最新数据可以指定 api 参数 `update=1`.\n\n## Calibre 插件\n\n打包 `calibre` 目录为 zip, 拖入 Calibre 安装即可. 注意需要在设置里更改为自己的 api 地址.\n\n## 油猴脚本\n\n[自动刷新豆瓣图书 api 缓存 @Greasy Fork](https://greasyfork.org/zh-CN/scripts/431582)\n\n这个脚本可以在浏览豆瓣时自动提交图书信息. 第一次使用需要先设置 api 服务器地址.\n\n## 其他\n\n因为是通过抓取 html 页面来获取数据, 因此抓取较慢且有一定概率遭到反爬测率限制或数据解析失败. 如果解析规则失效或解析数据有误, 请提 issure 或 pr, 谢谢茄子🍆.\n\n请确保 issure 中包含以下信息:\n\n - 你遇到的问题.\n - 测试用例. 最好是豆瓣图书链接.\n\n如果要提 pr, 请在提供上述信息的同时, 另外确保所有测试用例没有问题. 可以使用 `npm run test` 来运行测试.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facdzh%2Fdouban-book-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Facdzh%2Fdouban-book-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facdzh%2Fdouban-book-api/lists"}