在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:acdzh/douban-book-api开源软件地址:https://github.com/acdzh/douban-book-api开源编程语言:HTML 90.3%开源软件介绍:Douban Book Api for Calibre简介这是一个使用爬虫实现的第三方豆瓣读书 api 接口. 本项目中没有任何数据, 请自行搭建. 鉴于豆瓣关闭 api 接口并封禁 apiKey, 爬虫有被风控的风险, 请控制好抓取频次. Demohttps://acdzh-douban-book-api.herokuapp.com/ 服务部署在 Heroku, 访问量较大可能会被屏蔽, 请不要在正式环境使用该地址的服务. 安装一键部署请注意: 一键部署使用 Heroku 环境, 项目不对任何在第三方平台行为造成的后果负责 Using Dockersudo docker run -d \
--name douban-book-api-1 \
-p 3000:3000 \
-v /CACHE_DIR:/cache \
acdzh/douban-book-api Using nodenpm install
npm start 之后访问 API 接口说明图书搜索接口请求地址
请求方式GET 请求参数Header 参数
返回示例
{
"success": true,
"data": [
{
"title": "刘慈欣 Cixin Liu",
"abstract_2": "作者 / 1963-06-01 / 三体 / 三体Ⅱ / 三体Ⅲ",
"labels": [],
"url": "https://book.douban.com/author/4561353/",
"id": 4561353,
"abstract": "8693 人收藏",
"cover_url": "https://img9.doubanio.com/view/celebrity/raw/public/p1543395922.04.jpg",
"more_url": "",
"tpl_name": "search_common"
},
{
"id": 33146,
"labels": [],
"tpl_name": "search_simple",
"abstract": "中国工人出版社 / 共3册",
"title": "[丛书] 刘慈欣作品",
"url": "https://book.douban.com/series/33146"
},
{
"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'})\"",
"url": "https://book.douban.com/subject/2567698/",
"extra_actions": [
{
"url": "https://book.douban.com/subject/2567698/?channel=subject_list&platform=web",
"color": "#CF5B40",
"text": "豆瓣书店有售"
}
],
"labels": [],
"label_actions": [],
"rating": {
"rating_info": "",
"star_count": 4.5,
"count": 410716,
"value": 8.8
},
"cover_url": "https://img1.doubanio.com/view/subject/m/public/s2768378.jpg",
"interest": null,
"topics": [],
"tpl_name": "search_subject",
"title": "三体 : “地球往事”三部曲之一",
"id": 2567698,
"abstract": "刘慈欣 / 重庆出版社 / 2008-1 / 23.00",
"abstract_2": ""
}
],
"is_cache": false
} 这个返回的结果对应 https://search.douban.com/book/subject_search?search_text=刘慈欣, 见下图: 备注考虑到大部分的预期结果都出现在第一页, 所以搜索暂未设计翻页. 如果后续发现此需求确有必要, 会考虑升级. 根据豆瓣 id 或 isbn 获取图书详情请求地址
请求方式GET 请求参数Header 参数
返回示例
{
"success": true,
"data": {
"title": "政治的逻辑",
"subtitle": "马克思主义政治原理",
"original_title": "",
"id": "27012117",
"isbn": "9787208140400",
"author": ["王沪宁", "林尚立","孙关宏"],
"translator": [],
"publish": "上海人民出版社",
"producer": "",
"publishDate": "2016-10",
"pages": "650",
"price": "98.00元",
"binging": "精装",
"series": "",
"book_intro": "《政治的逻辑》是高校社会科学....",
"author_intro": "王沪宁,复旦大学政治学教授...",
"catalog": ["序言", "......", "后记"],
"original_texts": ["阶级消亡...", "国家是..."],
"labels": ["政治学", "马克思主义", "王沪宁", "政治", "政治经济学", "马克思", "中国", "社会学"],
"cover_url": "https://img2.doubanio.com/view/subject/l/public/s29602841.jpg",
"url": "https://book.douban.com/subject/27012117/",
"rating": {
"count": 176,
"info": "",
"value": 8.7,
"five_star_pre": 53.4,
"four_star_pre": 33,
"three_star_pre": 8,
"two_star_pre": 2.8,
"one_star_pre": 2.8
},
"comments": [{
"vote": 1,
"user_name": "乔治 ♘",
"user_page": "https://www.douban.com/people/165208204/",
"rating": 4,
"date": "2021-04-07",
"content": "中国马克思主义的集大成..."
}],
"reviews": [{
"user_avator": "https://img1.doubanio.com/icon/u1566359-9.jpg",
"user_name": "月之仙者",
"user_page": "https://www.douban.com/people/yuezhixianzhe/",
"rating": 3,
"time": "2008-08-06 09:53:30",
"publisher": "上海人民出版社2004版",
"publisher_page": "https://book.douban.com/subject/1003659/",
"title": "政治的逻辑:马克思主义政治学原理",
"url": "https://book.douban.com/review/1463309/",
"short_content": "经过十天左右的时间终于看完了...",
"usefull_count": 53,
"useless_count": 2,
"reply_count": 8
}],
"notes": []
},
"is_cache": false
} 这个返回的结果对应 https://book.douban.com/subject/27012117/ 或者 https://book.douban.com/isbn/9787208140400/, 见下图: 数据格式
缓存查询会强制写缓存. 缓存文件夹路径由环境变量 默认会先从缓存中查询, 如果需要最新数据可以指定 api 参数 Calibre 插件打包 油猴脚本这个脚本可以在浏览豆瓣时自动提交图书信息. 第一次使用需要先设置 api 服务器地址. 其他因为是通过抓取 html 页面来获取数据, 因此抓取较慢且有一定概率遭到反爬测率限制或数据解析失败. 如果解析规则失效或解析数据有误, 请提 issure 或 pr, 谢谢茄子 |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论