Skip to content

Commit

Permalink
Merge pull request #4 from YaoZeyuan/yaozeyuan/dev/适配新文章接口
Browse files Browse the repository at this point in the history
Yaozeyuan/dev/适配新文章接口
  • Loading branch information
YaoZeyuan authored Dec 12, 2019
2 parents bda746b + ce6bf41 commit 9c276a3
Show file tree
Hide file tree
Showing 19 changed files with 683 additions and 115 deletions.
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
{
"type": "node",
"request": "launch",
"name": "debug",
"name": "debug-command",
"program": "${workspaceFolder}/src/ace.ts",
"args": [
// 抓取数据
"Command:Demo"
"debug"
],
"outFiles": ["${workspaceFolder}/**/*.js"]
}
Expand Down
43 changes: 19 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,23 @@

# 软件下载

最新版本: 1.1.0
[点击下载](http://stablog.bookflaneur.cn/%E7%A8%B3%E9%83%A8%E8%90%BD%20Setup%201.1.0.exe)
最新版本: 1.2.0
[点击下载-win](http://stablog.bookflaneur.cn/release/%E7%A8%B3%E9%83%A8%E8%90%BD%20Setup%201.2.0.exe)

使用截图:

软件界面:
![软件界面](http://ww1.sinaimg.cn/large/6671cfa8ly1g86clapkgxj211y0omt9r.jpg)
![软件界面](http://stablog.bookflaneur.cn//img/%E4%BD%BF%E7%94%A8%E6%88%AA%E5%9B%BE.png)

输出的html电子书:
![输出的html电子书](http://ww1.sinaimg.cn/large/6671cfa8ly1g86clb89ixj20rg0qjgs0.jpg)
![输出的html电子书](http://stablog.bookflaneur.cn//img/%E8%BE%93%E5%87%BA%E7%9A%84html%E7%94%B5%E5%AD%90%E4%B9%A6.png)

输出的pdf电子书:
![输出的pdf电子书](http://ww1.sinaimg.cn/large/6671cfa8ly1g86clba2g8j20tv0kbgr8.jpg)
![输出的pdf电子书](http://stablog.bookflaneur.cn//img/%E8%BE%93%E5%87%BA%E7%9A%84pdf%E7%94%B5%E5%AD%90%E4%B9%A6.png)


## 项目动机

鉴于知乎世风日下, 还禁了项目前身[知乎助手](https://github.com/YaoZeyuan/zhihuhelp_with_node)的推广. 作者决定转战微博, 造福社会

严肃保护以[@Aioros先生](https://weibo.com/u/6646798696?refer_flag=0000015010_&from=feed&loc=nickname&sudaref=www.weibo.com&is_all=1)为代表的珍稀野生读物博主


Expand All @@ -46,9 +44,9 @@
3. 备份完成后会自动打开电子书输出目录, `稳部落输出的电子书`目录下, 即为电子书, 其中, `html`目录下为html格式书籍, `index.html`为目录页. `pdf`下为pdf输出位置


1. ![登录微博](http://ww1.sinaimg.cn/large/6671cfa8ly1g86clauxc7j211g0kydje.jpg)
2. ![配置任务](http://ww1.sinaimg.cn/large/6671cfa8ly1g86claim2zj211j0ohabb.jpg)
3. ![查看电子书](http://ww1.sinaimg.cn/large/6671cfa8ly1g86clad6r8j20ni0ce3zb.jpg)
1. ![登录微博](http://stablog.bookflaneur.cn//img/%E7%99%BB%E5%BD%95%E5%BE%AE%E5%8D%9A.jfif)
2. ![配置任务](http://stablog.bookflaneur.cn//img/%E4%BD%BF%E7%94%A8%E6%AD%A5%E9%AA%A4-6.png)
3. ![查看电子书](http://stablog.bookflaneur.cn//img/%E6%9F%A5%E7%9C%8B%E8%BE%93%E5%87%BA%E7%9A%84%E7%94%B5%E5%AD%90%E4%B9%A6.jfif)

# 配置项说明

Expand All @@ -74,10 +72,6 @@
问: 为什么备份这么慢? 为什么每次都要等20s之后才抓取下一条微博?
答: 新浪对爬虫进行了严格限制, 20s抓一次是我试验多次之后, 可以安全备份微博数据的最短间隔. 作为为非开发人员提供的备份工具, **稳定**第一🎵

问: 为啥只有Windows版? 我是Mac用户, 什么时候会有Mac版? 会不会有Android版? iOS版?
答: 因为作者用的是Windows, 没有Mac...以及, 由于这本身是一个业余项目, 所以不会开发Android/iOS. 有兴趣的同学可以比照源代码自行开发.




# 代码规范
Expand Down Expand Up @@ -112,13 +106,16 @@
1. 打包时会向dist目录中复制一份node_modules目录, 导致npm run 时优先从dist中获取node_module信息, 导致无法启动
1. 因此, 打包结束后需要将dist里的node_modules目录删掉, 以免影响后续开发工作
3. 电子书封面分辨率为: 100 * 130(宽*高)
4. commit信息规范 =>
| 关键字 | 功能 |
| ------ | ------------- |
| feat | 添加新功能 |
| format | 调整代码格式 |
| fix | 修复错误 |
| doc | 修订文档/注释 |


## commit信息规范

| 关键字 | 功能 |
| ------ | ------------- |
| feat | 添加新功能 |
| format | 调整代码格式 |
| fix | 修复错误 |
| doc | 修订文档/注释 |

# 开发指南

Expand Down Expand Up @@ -154,6 +151,4 @@

# 支持作者

![老铁,谢谢了](http://ww1.sinaimg.cn/large/6671cfa8ly1g7y4zur0juj20ri16s41d.jpg)

[致谢列表](https://www.easy-mock.com/mock/5d9b49fc896b9432186c1fa5/stablog/thank_you/list)
![老铁,谢谢了](http://stablog.bookflaneur.cn//img/%E8%80%81%E9%93%81%E8%B0%A2%E8%B0%A2%E4%BA%86.jfif)
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# 1.2.0

1. 支持浏览已备份微博数据
2. 解决微博排序异常问题
3. 解决无法展示微博文章问题
4. 日志记录超过10w行, 自动清空
2 changes: 2 additions & 0 deletions gui/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

<head>
<meta charset="utf-8">
<meta name="referer" content="never">
<meta name="referrer" content="never">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
Expand Down
6 changes: 6 additions & 0 deletions gui/src/view/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<el-tab-pane label="系统设置" :name="constant.tab.customerTask">
<CustomerTask :currentTab.sync="status.tab" />
</el-tab-pane>
<el-tab-pane label="管理数据" :name="constant.tab.manage">
<Manage />
</el-tab-pane>
<el-tab-pane label="运行日志" :name="constant.tab.log">
<Log />
</el-tab-pane>
Expand All @@ -31,6 +34,7 @@
import Log from './log/index.vue'
import Helper from './helper/index.vue'
import Donate from './donate/index.vue'
import Manage from './manage/index.vue'
import _ from 'lodash'
export default {
Expand All @@ -41,6 +45,7 @@
Login,
Helper,
Donate,
Manage,
},
data(){
return {
Expand All @@ -52,6 +57,7 @@
login:'login',
helper:'helper',
donate:'donate',
manage:'manage',
}
},
// 页面数据
Expand Down
2 changes: 1 addition & 1 deletion gui/src/view/customer_task/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export default Vue.extend({
mergeCount: 1000,
fetchStartAtPageNo: 0,
fetchEndAtPageNo: 100000,
outputStartAtMs: moment('2015-01-01 00:00:00').unix() * 1000,
outputStartAtMs: moment('2011-01-01 00:00:00').unix() * 1000,
outputEndAtMs:
moment()
.add(1, 'year')
Expand Down
19 changes: 9 additions & 10 deletions gui/src/view/helper/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,26 @@
name="github-readme"
id="github-readme"
src="https://github.com/YaoZeyuan/stablog/blob/master/README.md"
style
></webview>
</div>
</template>

<script>
import _ from "lodash"
import _ from 'lodash'
export default {
name: 'dashboard',
data(){
return {}
}
}
export default {
name: 'dashboard',
data() {
return {}
},
}
</script>

<style scoped>
webview {
display: inline-flex;
width: 80vw;
width: 100%;
margin: 0 auto;
height: 80vh;
min-height: 85vh;
}
</style>
93 changes: 48 additions & 45 deletions gui/src/view/log/index.vue
Original file line number Diff line number Diff line change
@@ -1,61 +1,64 @@
<template>
<div>
<div id="log-dashboard">
<pre>{{this.database.log}}</pre>
<pre>{{ this.database.log }}</pre>
</div>
<el-button @click="this.updateLog">刷新</el-button>
<el-button disabled>当前总日志行数:{{database.totalLogCount}}条</el-button>
<el-button disabled>当前总日志行数:{{ database.totalLogCount }}条</el-button>
<el-button @click="this.clearLog">清空日志</el-button>
</div>
</template>

<script>
import _ from "lodash"
import fs from "fs"
import electron from "electron"
import util from '~/gui/src/library/util'
let remote = electron.remote
let ipcRenderer = electron.ipcRenderer
let pathConfig = remote.getGlobal("pathConfig")
import _ from 'lodash'
import fs from 'fs'
import electron from 'electron'
import util from '~/gui/src/library/util'
let remote = electron.remote
let ipcRenderer = electron.ipcRenderer
export default {
name: 'dashboard',
data(){
return {
// 页面数据
database:{
log:'',
totalLogCount:0
},
}
},
mounted(){
let that = this
setInterval(function(){
// 每5s更新一次日志
that.updateLog()
}, 2000)
let pathConfig = remote.getGlobal('pathConfig')
export default {
name: 'dashboard',
data() {
return {
// 页面数据
database: {
log: '',
totalLogCount: 0,
},
}
},
mounted() {
let that = this
setInterval(function() {
// 每5s更新一次日志
that.updateLog()
}, 2000)
},
methods: {
updateLog() {
let logContent = util.getFileContent(pathConfig.runtimeLogUri)
let logList = logContent.split('\n')
this.database.totalLogCount = logList.length
logList = logList.slice(logList.length - 500, logList.length) // 只展示最后500行即可
this.database.log = logList.join('\n')
// 自动滚动到页面最下方
let divElement = window.document.getElementById('log-dashboard')
divElement.scrollTop = divElement.scrollHeight
console.log('updateLog: log =>', this.database.log)
if (this.database.totalLogCount > 100000) {
this.clearLog()
fs.writeFileSync(pathConfig.runtimeLogUri, `日志数超过10w, 自动清空\n--------------${this.database.log}`)
}
},
methods:{
updateLog(){
let logContent = util.getFileContent(pathConfig.runtimeLogUri)
let logList = logContent.split("\n")
this.database.totalLogCount = logList.length
logList = logList.slice(logList.length - 500, logList.length) // 只展示最后500行即可
this.database.log = logList.join("\n")
// 自动滚动到页面最下方
let divElement = window.document.getElementById('log-dashboard');
divElement.scrollTop = divElement.scrollHeight;
console.log("updateLog: log =>", this.database.log)
},
clearLog(){
fs.writeFileSync(pathConfig.runtimeLogUri, '')
}
clearLog() {
fs.writeFileSync(pathConfig.runtimeLogUri, '')
},
computed:{
}
}
},
computed: {},
}
</script>

<style lang="less" scoped>
Expand Down
Loading

0 comments on commit 9c276a3

Please sign in to comment.