解决只有标题没有文章内容抓取失败的BUG
This commit is contained in:
parent
fd2a49ebbe
commit
1321046bb1
13
Gmeek.py
13
Gmeek.py
@ -220,11 +220,12 @@ class GMEEK():
|
||||
period="。"
|
||||
else:
|
||||
period="."
|
||||
|
||||
|
||||
if issue.body==None:
|
||||
issue.body=''
|
||||
self.blogBase[listJsonName][postNum]["description"]=''
|
||||
else:
|
||||
self.blogBase[listJsonName][postNum]["description"]=issue.body.split(period)[0]+period
|
||||
|
||||
self.blogBase[listJsonName][postNum]["description"]=issue.body.split(period)[0]+period
|
||||
self.blogBase[listJsonName][postNum]["top"]=0
|
||||
for event in issue.get_events():
|
||||
if event.event=="pinned":
|
||||
@ -261,7 +262,11 @@ class GMEEK():
|
||||
self.blogBase[listJsonName][postNum]["dateLabelColor"]=self.blogBase["yearColorList"][int(thisYear)%len(self.blogBase["yearColorList"])]
|
||||
|
||||
f = open("backup/"+issue.title+".md", 'w', encoding='UTF-8')
|
||||
f.write(issue.body)
|
||||
|
||||
if issue.body==None:
|
||||
f.write('')
|
||||
else:
|
||||
f.write(issue.body)
|
||||
f.close()
|
||||
return listJsonName
|
||||
|
||||
|
||||
65
README.md
65
README.md
@ -8,7 +8,7 @@
|
||||
|
||||

|
||||
|
||||
### 安装
|
||||
### 安装 -> 详情可见[Gmeek快速上手](https://blog.meekdai.com/post/Gmeek-kuai-su-shang-shou.html)
|
||||
|
||||
1. 点击[通过模板创建仓库](https://github.com/new?template_name=Gmeek-template&template_owner=Meekdai),建议仓库名称为`XXX.github.io`,其中`XXX`为你的github用户名。
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
3. 打开一篇issue,开始写作,并且添加一个标签,保存issue后会自动创建博客内容,片刻后可通过https://XXX.github.io 访问
|
||||
|
||||
如果有问题可在本仓库提交[Issues](https://github.com/Meekdai/Gmeek/issues)
|
||||
如果还有有问题可在本仓库提交[Issues](https://github.com/Meekdai/Gmeek/issues)
|
||||
|
||||
### 特性
|
||||
|
||||
@ -25,67 +25,6 @@
|
||||
- 评论系统引入[utteranc.es](https://utteranc.es/)
|
||||
- 使用`jinja2`对html进行渲染,可通过模板自定义UI主题
|
||||
|
||||
### 说明
|
||||
1. 请确保每一篇文章有且仅有一个`Label`,为了防止他人提交的Issue也被抓取生成文章。
|
||||
|
||||
2. 如果要导入以前的文章,如何设置发布时间呢?
|
||||
如需上传旧博客的文章需要修改发布时间,可以在文章最后一行添加如下代码。里面的时间是采用时间戳的形式,可以用如下[网站](https://tool.lu/timestamp)转换。
|
||||
```html
|
||||
<!-- ##{"timestamp":1490764800}## -->
|
||||
```
|
||||
|
||||
3. 自定义单篇文章页面的`style`和`script`,同样是在文章最后一行添加如下代码,为JSON格式。
|
||||
```html
|
||||
<!-- ##{"style":"<style>#postBody{font-size:20px}</style>"}## -->
|
||||
```
|
||||
```html
|
||||
<!-- ##{"script":"<script async src='//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js'></script>"}## -->
|
||||
```
|
||||
4. 可同时一起添加多种自定义参数:
|
||||
```html
|
||||
<!-- ##{"script":"<script async src='//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js'></script>","style":"<style>#postBody{font-size:20px}</style>","timestamp":1490764800}## -->
|
||||
```
|
||||
|
||||
5. 如果修改过config.json里面的参数后,发现生成文章失败,或其他奇奇怪怪的问题。
|
||||
建议通过Actions->build Gmeek->Run workflow->里面的按钮全局重新生成一次就行。
|
||||
|
||||
6. 置顶博客文章,只需要`Pin issue`即可。
|
||||
|
||||
7. 如果在评论里面登录后评论报错,可直接按照提示安装`utteranc app`即可
|
||||
> Error: utterances is not installed on xxx/xxx.github.io. If you own this repo, install the app. Read more about this change in the PR.
|
||||
|
||||
### 配置文件
|
||||
|
||||
`config.json` 文件
|
||||
```javascript
|
||||
{
|
||||
"title":"Meekdai",
|
||||
"displayTitle":"eekdai",
|
||||
"subTitle":"童话是一种生活态度,仅此而已。",
|
||||
"homeUrl":"http://blog.meekdai.com",
|
||||
"avatarUrl":"http://meekdai.com/avatar.jpg",
|
||||
"faviconUrl":"http://meekdai.com/favicon.ico",
|
||||
"singlePage":[],
|
||||
"GMEEK_VERSION":"last"
|
||||
}
|
||||
```
|
||||
以上是必须的字段,修改为自己的信息即可,下面是可以自定义字段的描述,可以选择加入到`config.json`中。
|
||||
|
||||
```javascript
|
||||
"email":"meekdai@163.com",
|
||||
"startSite":"02/16/2015",
|
||||
"filingNum":"浙ICP备20023628号",
|
||||
"onePageListNum":15,
|
||||
"commentLabelColor":"#006b75",
|
||||
"yearColorList":["#bc4c00", "#0969da", "#1f883d", "#A333D0"],
|
||||
"i18n":"CN",
|
||||
"dayTheme":"light",
|
||||
"nightTheme":"dark_colorblind",
|
||||
"urlMode":"pinyin",
|
||||
```
|
||||
另有不清楚的也可以参考 https://github.com/Meekdai/meekdai.github.io/blob/main/config.json
|
||||
|
||||
|
||||
### 鸣谢
|
||||
- [jinja2](https://jinja.palletsprojects.com/)
|
||||
- [utteranc.es](https://utteranc.es/)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user