V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
billyangg
V2EX  ›  Node.js

🔥 掘金小册 markdown 转换器

  •  
  •   billyangg · 2019-01-23 23:07:35 +08:00 · 3752 次点击
    这是一个创建于 1891 天前的主题,其中的信息可能已经有所发展或是发生改变。

    20190121001820.png

    购买过的掘金小册,通过谷歌 pupeteer 自动爬取 html 文档,并将 html 文档转换为 markdown 格式的文件。

    安装方式

    首先 clone 此项目:

    git clone https://github.com/oliyg/juejinxiaoce.git

    然后安装依赖:

    npm i

    推荐使用 nrm 管理镜像源,使用淘宝镜像:nrm use taobao

    手动下载 chromium:

    chromium 官网下载

    windows 系统,将 chromium 解压缩,连同 chrome-win 文件夹一同放入项目根目录中去

    macOS 系统,正常安装程序(安装到 /Applications 应用程序文件夹)中去,避免遇到权限问题

    最后项目目录如下:

    ├── CODE_OF_CONDUCT.md
    ├── LICENSE
    ├── app.js
    ├── chrome-win
    ├── constant.js
    ├── converter.js
    ├── dist
    ├── node_modules
    ├── package-lock.json
    ├── package.json
    └── readme.md
    

    使用方法

    新建 .env 文件到根目录,并根据 .env.example 填写掘金登录用户名和密码以及要爬取的小册 ID 信息:

    20190120235150.png

    小册 ID 见 URL 链接:

    20190120235353.png

    .env 文件修改完毕后执行 npm start 等待出现消息 all done. enjoy. 完成转换,效果如下:

    20190121000703.png

    20190121000715.png

    常见问题

    • 报错:spawn EACCES
      • 常见于 macOS,请保证 chromium 已被正常安装

    免责

    • 不提供用户名和密码,需使用用户自己的账号密码登录
    • 仅作为技术讨论,学习和研究使用

    隐私

    • 该项目不会存储和发送任何用户隐私数据

    License

    The MIT License (MIT) Copyright (c) 2019 OliverYoung

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1022 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:57 · PVG 03:57 · LAX 12:57 · JFK 15:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.