{"id":13430925,"url":"https://github.com/mythsman/hexo-douban","last_synced_at":"2025-03-16T06:31:38.701Z","repository":{"id":47118643,"uuid":"94492686","full_name":"mythsman/hexo-douban","owner":"mythsman","description":" :cd: a Hexo plugin that helps you generate content for Douban books, movies, music, and games.","archived":false,"fork":false,"pushed_at":"2024-05-07T02:34:58.000Z","size":1111,"stargazers_count":439,"open_issues_count":0,"forks_count":56,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-05-20T09:18:15.903Z","etag":null,"topics":["douban","douban-backup","douban-crawler","hexo","hexo-douban","hexo-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/mythsman.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-16T01:26:21.000Z","updated_at":"2024-06-19T05:15:05.996Z","dependencies_parsed_at":"2024-01-18T14:41:17.333Z","dependency_job_id":"b019651f-2874-4945-afd4-7c45e1b4c668","html_url":"https://github.com/mythsman/hexo-douban","commit_stats":{"total_commits":204,"total_committers":7,"mean_commits":"29.142857142857142","dds":0.06372549019607843,"last_synced_commit":"24d1c23a5845251e9eb6f7aeff0a901d7505562f"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mythsman%2Fhexo-douban","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mythsman%2Fhexo-douban/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mythsman%2Fhexo-douban/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mythsman%2Fhexo-douban/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mythsman","download_url":"https://codeload.github.com/mythsman/hexo-douban/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221656477,"owners_count":16858777,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["douban","douban-backup","douban-crawler","hexo","hexo-douban","hexo-plugin"],"created_at":"2024-07-31T02:00:59.024Z","updated_at":"2024-10-27T09:31:08.637Z","avatar_url":"https://github.com/mythsman.png","language":"JavaScript","funding_links":[],"categories":["Content"],"sub_categories":[],"readme":"# hexo-douban\n\n一个在 [Hexo](https://hexo.io) 页面中嵌入豆瓣个人主页的小插件.\n\n[![package version](https://badge.fury.io/js/hexo-douban.svg)](https://www.npmjs.com/package/hexo-douban)\n[![npm](https://img.shields.io/npm/dt/hexo-douban.svg)](https://www.npmjs.com/package/hexo-douban)\n[![GitHub license](https://img.shields.io/github/license/mythsman/hexo-douban.svg)](https://github.com/mythsman/hexo-douban/blob/master/LICENSE)\n\n[![NPM](https://nodei.co/npm/hexo-douban.png)](https://nodei.co/npm/hexo-douban/)\n\n## 原理\n\nhexo-douban 目前升级到了 2.x 版本，将原先由插件客户端自行获取数据的逻辑抽到了一个隐藏的服务端中进行，以统一解决数据获取、数据缓存、风控对抗等问题，提高页面生成的成功率和效率。\n\n## 安装\n\nnode 版本要求 \u003e= v18\n\n```bash\n$ npm install hexo-douban --save\n```\n\n## 配置\n\n将下面的配置写入站点的配置文件 `_config.yml` 里(不是主题的配置文件).\n\n### 精简配置\n\n```yaml\ndouban:\n  id: 162448367\n  book:\n    title: \"This is my book title\"\n  movie:\n    title: \"This is my movie title\"\n  game:\n    title: \"This is my game title\"\n  song:\n    title: \"This is my song title\"\n```\n\n### 完整配置\n\n```yaml\ndouban:\n  id: 162448367\n  builtin: false\n  dynamic: false\n  item_per_page: 10\n  meta_max_line: 4\n  customize_layout: page\n  swup: false\n  book:\n    path: books/index.html\n    title: \"This is my book title\"\n    quote: \"This is my book quote\"\n    actions:\n      - do\n      - wish\n      - collect\n    option:\n  movie:\n    path: movies/index.html\n    title: \"This is my movie title\"\n    quote: \"This is my movie quote\"\n    actions:\n      - do\n      - wish\n      - collect\n    option:\n  game:\n    path: games/index.html\n    title: \"This is my game title\"\n    quote: \"This is my game quote\"\n    actions:\n      - do\n      - wish\n      - collect\n    option:\n  song:\n    path: songs/index.html\n    title: \"This is my song title\"\n    quote: \"This is my song quote\"\n    actions:\n      - do\n      - wish\n      - collect\n    option:\n```\n\n- **id**: 你的豆瓣 ID(纯数字格式，不是自定义的域名)。获取方法可以参考[怎样获取豆瓣的数字 ID ？](https://www.zhihu.com/question/19634899)\n- **builtin**: 是否将`hexo douban`命令默认嵌入进`hexo g`、`hexo s`，使其自动执行`hexo douban` 命令。默认关闭。\n- **dynamic**: 豆瓣页面是否在访问时实时请求接口。默认为 false，表示页面信息会在执行 hexo douban 命令时更新，优点是生成的页面不会受到后续接口可用性的影响，缺点是需要手动更新。如果设置为 true ，则会在页面访问时实时调用接口进行渲染，无需执行 hexo douban 命令更新页面，但是代价就是如果接口挂了，页面就会G。\n- **item_per_page**: 每页展示的条目数，默认 10 。\n- **meta_max_line**: 每个条目展示的详细信息的最大行数，超过该行数则会以 \"...\" 省略，默认 4 。\n- **customize_layout**: 自定义布局文件。默认值为 page 。无特别需要，留空即可。若配置为 `abcd`，则表示指定 `//theme/hexo-theme/layout/abcd.ejs` 文件渲染豆瓣页面。\n- **swup**: 是否兼容 [swup](https://swup.js.org/plugins/scripts-plugin/) 。支持 script 热加载，解决一些 single-page 主题的加载问题，默认 false 。\n- **path**: 生成页面后的路径，默认生成在 //yourblog/books/index.html 等下面。如需自定义路径，则可以修改这里。\n- **title**: 该页面的标题。\n- **quote**: 写在页面开头的一段话,支持 html 语法，可以为空。\n- **actions**: 一个字符串列表，表示生成的页面中的\"已 X\"，\"想 X\",\"X 过\"的标签配置，默认会自动聚焦在第一个标签。可选项为: 'do','wish','collect'。\n- **option**: 该页面额外的 Front-matter 配置，参考[Hexo 文档](https://hexo.io/docs/front-matter.html)。无特别需要，留空即可。\n\n如果只想显示某一个页面(比如 movie)，那就把其他的配置项注释掉即可。\n\n## 使用\n\n**展示帮助文档**\n\n```\n$ hexo douban -h\nUsage: hexo douban\n\nDescription:\nGenerate pages from douban\n\nOptions:\n  -b, --books   Generate douban books only\n  -g, --games   Generate douban games only\n  -m, --movies  Generate douban movies only\n  -s, --songs   Generate douban songs only\n```\n\n**主动生成豆瓣页面**\n\n```\n$ hexo douban\nINFO  Start processing\nINFO  0 (wish), 0 (do),0 (collect) game loaded in 729 ms\nINFO  0 (wish), 0 (do),20 (collect) song loaded in 761 ms\nINFO  2 (wish), 0 (do),136 (collect) book loaded in 940 ms\nINFO  30 (wish), 0 (do),6105 (collect) movie loaded in 4129 ms\nINFO  Generated: books/index.html\nINFO  Generated: movies/index.html\nINFO  Generated: games/index.html\nINFO  Generated: songs/index.html\n```\n\n如果不加参数，那么默认参数为`-bgms`。当然，前提是配置文件中均有这些类型的配置。\n\n**需要注意的是**，通常大家都喜欢用`hexo d`来作为`hexo deploy`命令的简化，但是当安装了`hexo douban`之后，就不能用`hexo d`了，因为`hexo douban`跟`hexo deploy` 的前缀都是`hexo d`。\n\n如果 builtin:false 时，执行 hexo g 之后发现将 douban 生成的页面删除了:\n\n```\nINFO  Start processing\nINFO  Files loaded in 343 ms\nINFO  Deleted: games/index.html\nINFO  Deleted: books/index.html\nINFO  Deleted: movies/index.html\nINFO  Deleted: songs/index.html\n```\n\n那么重新执行 hexo clean 一下即可（原因是 db.json 的数据缓存）。\n\n第一次使用 hexo douban 时，后台会异步进行数据获取，一般需要等待一段时间（后台访问你的标记页面）才能查到数据。顺利情况下，平均一个页面会花 10s。\n\n例如如果你有 150 个想读、150 个已读、150 个在读的图书，每页 15 条，则共需要翻 30 页。那么大约需要等待 30\\*10/60=5 分钟。如果长时间没有更新（一天以上），请及时提 issue 反馈。\n\n后续如果你的豆瓣数据更新了，hexo douban 同样也会自动进行更新（同样需要等待一段时间才会查到更新数据），不过出于安全考虑，一个用户 id**每半小时至多只会同步一次**。\n\n由于豆瓣本身深分页的 RT 过高（上万条目的翻页 RT 会到 15s 到 60s），为了防止系统同步压力过大，每个用户的每一类条目最多只会同步 1w 条。\n\n如果 dynamic 设置为 true，则每次访问页面时都会向后端自动发起更新请求，无需手动执行 hexo douban 命令。\n\n## 升级\n\n我会不定期更新一些功能或者修改一些 Bug，所以如果想使用最新的特性，可以用下面的方法来更新:\n\n1. 修改 package.json 内 hexo-douban 的版本号至最新\n2. 重新安装最新版本`npm install hexo-douban --save`\n\n或者使用`npm install hexo-douban --update --save`直接更新。\n\n## 显示\n\n如果上面的配置和操作都没问题，就可以在生成站点之后打开 `//yourblog/books` 和 `//yourblog/movies`, `//yourblog/games`, 来查看结果。\n\n## 菜单\n\n如果上面的显示没有问题就可以在主题的配置文件 `_config.yml` 里添加如下配置来为这些页面添加菜单链接.\n\n```yaml\nmenu:\n  Home: /\n  Archives: /archives\n  Books: /books #This is your books page\n  Movies: /movies #This is your movies page\n  Games: /games #This is your games page\n  Songs: /songs #This is your songs page\n```\n\n## 通用环境\n\n如果有非 hexo 环境的部署需求，则可以考虑以引入静态资源的方式接入 [idouban](https://github.com/mythsman/idouban) 。\n\n## 接口\n\n如果仅仅想对自己的豆瓣数据进行备份，可以尝试使用下面的接口，复用后端维护的数据提取服务 [mouban](https://github.com/mythsman/mouban) ：\n\n```\n# 将 {your_douban_id} 改为你的豆瓣数字ID\n\n# 用户录入/更新\n\nhttps://mouban.mythsman.com/guest/check_user?id={your_douban_id}\n\n# 查询用户的读书评论\n\nhttps://mouban.mythsman.com/guest/user_book?id={your_douban_id}\u0026action=wish\n\nhttps://mouban.mythsman.com/guest/user_book?id={your_douban_id}\u0026action=do\n\nhttps://mouban.mythsman.com/guest/user_book?id={your_douban_id}\u0026action=collect\n\n# 查询用户的电影评论\n\nhttps://mouban.mythsman.com/guest/user_movie?id={your_douban_id}\u0026action=wish\n\nhttps://mouban.mythsman.com/guest/user_movie?id={your_douban_id}\u0026action=do\n\nhttps://mouban.mythsman.com/guest/user_movie?id={your_douban_id}\u0026action=collect\n\n# 查询用户的游戏评论\n\nhttps://mouban.mythsman.com/guest/user_game?id={your_douban_id}\u0026action=wish\n\nhttps://mouban.mythsman.com/guest/user_game?id={your_douban_id}\u0026action=do\n\nhttps://mouban.mythsman.com/guest/user_game?id={your_douban_id}\u0026action=collect\n\n# 查询用户的音乐评论\n\nhttps://mouban.mythsman.com/guest/user_song?id={your_douban_id}\u0026action=wish\n\nhttps://mouban.mythsman.com/guest/user_song?id={your_douban_id}\u0026action=do\n\nhttps://mouban.mythsman.com/guest/user_song?id={your_douban_id}\u0026action=collect\n```\n\n## 他们在用\n\n下面列举了在不同 hexo 主题下使用插件后的渲染结果，仅供参考。\n\n如果您使用了本插件，也欢迎在 README.md 中提 PR 将您的网站添加进来，供后人参考。\n\n### [hexo-theme-butterfly](https://github.com/jerryc127/hexo-theme-butterfly)\n\n- [七鳄の学习格 - 生在黑暗，行向光明ヾ(@^▽^@)ノ](https://blog.gmcj0816.top/books/)\n- [Ofra Serendipity](https://cmwlvip.github.io/movies/)\n- [冰糖盒子 - 冰糖的笔记本](https://cvki.cn/movies/)\n- [フサエ·キャンベル·木之下 - 天道酬勤功不唐捐](https://zipblog.top/movies/)\n- [个人生活感悟记录](https://www.ensoul.club/books/)\n- [week.wiki](https://week.wiki/movies/)\n- [CodeRain - 越努力，越幸运](https://code7rain.github.io/movies/)\n- [hangzl's Blog - 总之岁月漫长 然而值得等待](https://hangzl.xyz/movies/)\n- [Lmx0](https://www.lmx0.top/movies/)\n- [老胖叔 - JZ](https://laopangshu.top/movies/)\n- [来生拓己 オフィシャルサイト](https://kisugitakumi.net/movies/)\n- [果实 o 的博客 - 个人网站](https://www.shengshunyan.xyz/movies/)\n- [TFC 的个人博客](https://iqdxa.github.io/movies/)\n- [吕小布の博客 - MindCons](https://mindcons.cn/booklist/)\n- [Darler Space - 极速翱翔](https://blog.darler.cn/movies/)\n- [Evergarden](https://evergarden.moe/books/)\n- [现实的延续](https://www.intelland.cn/movies/)\n- [Gallifrey 的计算机学习日记 - 个人文章归档](https://gallifrey.asia/)\n- [Chen's Blog](https://chenxs.site/)\n\n### [hexo-theme-matery](https://github.com/blinkfox/hexo-theme-matery)\n\n- [小法进阶](https://imouyang.com/books/)\n- [Peiqi Blog](https://jupeiqi.top/books/)\n\n### [hexo-theme-next](https://github.com/theme-next/hexo-theme-next)\n\n- [Lyz's Blog - Never Give Up](https://blog.home999.cc/books)\n- [Sitch's Blog](https://sitchzou.com/movies/)\n\n### [hexo-theme-stellar](https://github.com/xaoxuu/hexo-theme-stellar)\n\n- [是非题](https://www.shifeiti.com/about/movies/)\n- [MerryJingle](https://blog.pengfeima.cn/movies/)\n- [梅园小径](https://www.auntyang.cf/life/doubanmovies/)\n- [苏末了](https://sumorio.com/douban/movie/)\n\n### [hexo-theme-volantis](https://github.com/volantis-x/hexo-theme-volantis)\n\n- [老梁有墨](https://www.laoliang.ink/book/)\n\n### [hexo-theme-pure](https://github.com/cofess/hexo-theme-pure)\n\n- [fyupeng](https://lhx.cool/movies/)\n\n### [hexo-theme-icarus](https://github.com/ppoffice/hexo-theme-icarus)\n\n- [There Hello](https://therehello.top/movies/)\n\n### [hexo-theme-fluid](https://github.com/fluid-dev/hexo-theme-fluid)\n\n- [Loststar's blog](https://blog.loststar.tech/movies)\n- [MerickBao の博客](https://merickbao.github.io/movies/)\n\n## 免责声明\n\n本项目仅供学习交流使用，不得用于任何商业用途。\n\n数据来源于互联网公开内容，没有获取任何私有和有权限的信息（个人信息等），由此引发的任何法律纠纷与本人无关。\n\n## 反馈\n\n系统刚上线，可能还不够完善。如果大家在使用的过程中数据有问题、或者有什么问题和意见，欢迎随时提 issue。\n\n如果你觉得这个插件很好用，欢迎右上角点下 star ⭐️，表达对作者的鼓励。\n\n如果你想了解数据获的实现方式，可以参考 [mouban](https://github.com/mythsman/mouban) 这个项目。\n\n## Star History\n\n[![Stargazers over time](https://starchart.cc/mythsman/hexo-douban.svg)](https://starchart.cc/mythsman/hexo-douban)\n\n## Lisense\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmythsman%2Fhexo-douban","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmythsman%2Fhexo-douban","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmythsman%2Fhexo-douban/lists"}