✨ zhihu daily Node.js、Vue.js ...
Node.js + Vue.js + MongoDB 的知乎日报爬虫项目
Node.js + Express + MongoDB
使用 Express 搭建 web 服务,爬虫爬取的数据用 MongoDB 存储。
用 node-jieba分词 分析正文的tag,做则更能准确的数据分析和内容搜索 (doing)
ES6 + Vue + Webpack
基于 Vue2.0 的单页面应用 用webpack做前端代码构建
数据统计的页面使用原生 ES6 代码编写,单独配置了webpack做构建,没有和 Vue 的webpack构建代码混在一起
启动 mongoDB sudo mongod
用命令 mongo
进入命令行模式
创建数据库
use zhihu
db.createUser({
user: "username",
pwd: "password",
"roles" : [
{
"role" : "readWrite",
"db" : "report"
},{
"role" : "dbAdmin",
"db" : "report"
}]
})
config.js.sample 重命名为 config.js
说明:
Authorization
)fire: true
是否启动爬虫爬取历史信息openTask:true
表示开启定时任务 每日爬虫和定时更新在config.js文件中设置 fire: true
表示开启爬虫,对应的 start end
如果在页面的HTTP的请求头里想加入 Authorization 和 referer 可以用这个 chrome扩展
http://news-at.zhihu.com/api/4/start-image/1080*1776
现在返回的图片应该都不再区分分辨率,都是同一尺寸了
http://news-at.zhihu.com/api/4/news/latest
http://news.at.zhihu.com/api/4/news/before/20150101
http://news-at.zhihu.com/api/4/news/4620055
http://news-at.zhihu.com/api/4/story/3942319
http://news-at.zhihu.com/api/4/story-extra/7033320
http://news-at.zhihu.com/api/4/story/4628696/long-comments
http://news-at.zhihu.com/api/4/story/4628696/short-comments
http://news-at.zhihu.com/api/4/themes
http://news-at.zhihu.com/api/4/theme/2