oliyg / juejinxiaoce Goto Github PK
View Code? Open in Web Editor NEW爬取掘金小册,并将 html 文件转为 markdown 格式文件
License: MIT License
爬取掘金小册,并将 html 文件转为 markdown 格式文件
License: MIT License
可以指定文章地址吗?
将文档中的链接转为本地图片
===navagating to main page
===login...
===getting book section list
===getting book HTML content
开篇词 —— 小册食用指南
===writing html...
===getting book HTML content
===write html file success
===writing markdown...
===write markdown file success
(node:15252) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
at validateString (internal/validators.js:125:11)
at Object.resolve (path.js:161:7)
at mkdir (C:\Users\Lerix\AppData\Roaming\npm\node_modules@oliyg\juejinxiaoce\utils.js:7:26)
at Juejin.copyToPWDDir (C:\Users\Lerix\AppData\Roaming\npm\node_modules@oliyg\juejinxiaoce\app.js:26:5)
at juejin.getContentHTML (C:\Users\Lerix\AppData\Roaming\npm\node_modules@oliyg\juejinxiaoce\app.js:196:14)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:15252) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:15252) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
TCP/IP 历史与分层模型
===writing html...
===getting book HTML content
===write html file success
===writing markdown...
===write markdown file success
(node:15252) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
at validateString (internal/validators.js:125:11)
at Object.resolve (path.js:161:7)
at mkdir (C:\Users\Lerix\AppData\Roaming\npm\node_modules@oliyg\juejinxiaoce\utils.js:7:26)
at Juejin.copyToPWDDir (C:\Users\Lerix\AppData\Roaming\npm\node_modules@oliyg\juejinxiaoce\app.js:26:5)
at juejin.getContentHTML (C:\Users\Lerix\AppData\Roaming\npm\node_modules@oliyg\juejinxiaoce\app.js:196:14)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:15252) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
如题
执行 npm i 后会下载Chromium到node_modules/puppeteer/.local-chromium/mac-609904/chrome-mac
将chrome-mac直接复制到项目根目录
目录结构如下
├── chrome-mac
├── dist
├── node_modules
├── CODE_OF_CONDUCT.md
├── LICENSE
├── app.js
├── constant.js
├── converter.js
├── package-lock.json
├── package.json
└── readme.md
然后将根目录下app.js中第17行
executablePath: './chrome-win/chrome.exe',
替换为
executablePath: './chrome-mac/Chromium.app/Contents/MacOS/Chromium',
保存后执行 npm start
等待结束即可
ps:过程中下载html文件时提示all finished: false,不确定是否判断条件未适配macOS系统,但完成后并没有什么问题
感谢git主的辛勤劳动和无私精神!
sitdown转换效果更佳,https://github.com/mdnice/sitdown
===navagating to main page
===login...
===getting book section list
===getting book HTML content
TypeError: Cannot read property 'sectionId' of undefined
at Juejin.getContentHTML (/Users/jipengning/Desktop/learnWeb/juejinxiaoce/app.js:123:192)
可以试试极客时间:)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.