# blog_website **Repository Path**: DieHunter/blog_website ## Basic Information - **Project Name**: blog_website - **Description**: 基于 node 编写的CSDN博客导出的爬虫脚本+hexo部署 - **Primary Language**: JavaScript - **License**: AGPL-3.0 - **Default Branch**: master - **Homepage**: http://website.diehunter1024.work/blog_website/2021/12/21/%E5%9F%BA%E4%BA%8Enode%E5%AE%9E%E7%8E%B0CSDN%E5%8D%9A%E5%AE%A2%E5%AF%BC%E5%87%BA%E4%B8%BAmarkdown/ - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 2 - **Created**: 2021-12-07 - **Last Updated**: 2024-04-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: JavaScript, Nodejs, Hexo ## README ### 基于 node 编写的导出博客的爬虫脚本+hexo 部署,可以搭配 Jenkins 一键将 CSDN 博客部署到自己服务器的博客中 Jenkins 流水线语句参考:https://gitee.com/DieHunter/blog_website/blob/master/pipeline 示例:http://website.diehunter1024.work/blog_website/ 博客:https://blog.csdn.net/time_____/article/details/121995028 ### 脚本运行方式: npm i npm start npm export_blog 或 node server -type:csdn -id:time**\_** 1. -type 表示博客类型 2. -id 表示用户名,如:在'https://blog.csdn.net/time_____'中,'time_____'是用户名 默认导出目录:source/\_posts npm update_blog 只导出新增的博客,导出效果是 markdown #### hexo 运行方式: npm i hexo -g npm start 或 hexo server -p 10245 #### 构建静态文件: npm run build #### 删除构建: npm run clean ### 2.0 版本重要更新 C 站官方增加了人机验证功能,使用 node 实现较为繁琐,所以需要手动验证一下,步骤如下: 1. https://blog.csdn.net/community/home-api/v1/get-business-list?page=1&size=20&businessType=blog&orderby=&noMore=false&year=&month=&username=time**\_** 在浏览器(最好是无痕模式下,因为 cookie 更少)打开上述页面 2. 提示‘很抱歉,当前访问人数过多,请完成“安全验证”后继续访问’ 3. 手动验证一下,通过人机校验 4. 复制 cookie (人机校验后,在浏览器列表请求中查看) 5. 放到 server 文件的 Cookie 变量中 6. 运行脚本导出博客