Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
malinkang committed Jan 3, 2024
0 parents commit cabaa71
Show file tree
Hide file tree
Showing 17 changed files with 1,240 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/read_time.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: weread sync

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
jobs:
sync:
name: Sync
runs-on: ubuntu-latest
env:
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
BOOK_DATABASE_ID: ${{ secrets.BOOK_DATABASE_ID }}
AUTHOR_DATABASE_ID: ${{ secrets.AUTHOR_DATABASE_ID }}
CATEGORY_DATABASE_ID: ${{ secrets.CATEGORY_DATABASE_ID }}
BOOKMARK_DATABASE_ID: ${{ secrets.BOOKMARK_DATABASE_ID }}
REVIEW_DATABASE_ID: ${{ secrets.REVIEW_DATABASE_ID }}
CHAPTER_DATABASE_ID: ${{ secrets.CHAPTER_DATABASE_ID }}
YEAR_DATABASE_ID: ${{ secrets.YEAR_DATABASE_ID }}
WEEK_DATABASE_ID: ${{ secrets.WEEK_DATABASE_ID }}
MONTH_DATABASE_ID: ${{ secrets.MONTH_DATABASE_ID }}
DAY_DATABASE_ID: ${{ secrets.DAY_DATABASE_ID }}
WEREAD_COOKIE: ${{ secrets.WEREAD_COOKIE }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: read time sync
run: |
python -u scripts/read_time.py
48 changes: 48 additions & 0 deletions .github/workflows/weread.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: weread sync

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
jobs:
sync:
name: Sync
runs-on: ubuntu-latest
env:
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
BOOK_DATABASE_ID: ${{ secrets.BOOK_DATABASE_ID }}
AUTHOR_DATABASE_ID: ${{ secrets.AUTHOR_DATABASE_ID }}
CATEGORY_DATABASE_ID: ${{ secrets.CATEGORY_DATABASE_ID }}
BOOKMARK_DATABASE_ID: ${{ secrets.BOOKMARK_DATABASE_ID }}
REVIEW_DATABASE_ID: ${{ secrets.REVIEW_DATABASE_ID }}
CHAPTER_DATABASE_ID: ${{ secrets.CHAPTER_DATABASE_ID }}
YEAR_DATABASE_ID: ${{ secrets.YEAR_DATABASE_ID }}
WEEK_DATABASE_ID: ${{ secrets.WEEK_DATABASE_ID }}
MONTH_DATABASE_ID: ${{ secrets.MONTH_DATABASE_ID }}
DAY_DATABASE_ID: ${{ secrets.DAY_DATABASE_ID }}
WEREAD_COOKIE: ${{ secrets.WEREAD_COOKIE }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: weread sync
run: |
python -u scripts/weread.py "${{ github.ref }}" "${{ github.repository }}"
- name: weread heatmap
run: |
github_heatmap weread --weread_cookie "${{secrets.WEREAD_COOKIE}}" --year 2018-2023 --me "${{secrets.NAME}}" --with-animation --background-color=#ffffff --track-color=#ACE7AE --special-color1=#69C16E --special-color2=#549F57 --dom-color=#EBEDF0 --text-color=#000000
- name: push
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m 'add new cover' || echo "nothing to commit"
git push || echo "nothing to push"
2 changes: 2 additions & 0 deletions OUT_FOLDER/weread.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 将微信读书划线和笔记同步到Notion


本项目通过Github Action每天定时同步微信读书划线到Notion。

预览效果:https://book.malinkang.com

> [!WARNING]
> 请不要在Page里面添加自己的笔记,有新的笔记的时候会删除原笔记重新添加。

## 使用

使用文档:https://malinkang.com/posts/weread2notion/

热力图使用文档:https://malinkang.com/posts/github_heatmap/

## 捐赠

如果你觉得本项目帮助了你,请作者喝一杯咖啡,你的支持是作者最大的动力。本项目会持续更新。

![](./asset/WechatIMG27.jpg)

## 问题解答

1. 如果发现数据没有同步,请点击Action查看运行状态。红色表示失败,绿色代表成功,如果有失败的点击去查看详情,检查值是否填写正确
2. Categories is expected to be select. 这个是模板设置的问题,将模板中的Categories修改为Multi-select类型
3. 模板中的属性解释
* BookName:书名
* BookId:书Id
* Sort:主要用于增量同步没啥实际意义
* Cover:封面
* Author:作者
* Status:状态
* ReadingTime:阅读时长
* Date:读完日期
* Rating:评分
* URL:网页链接
* Categories:分类
* Progress:阅读进度


## 微信群
> [!WARNING]
> 微信群已满,加我备注微信读书,我拉你进群。
> 也可以加TG群:https://t.me/wereadnotion
![image](./asset/WechatIMG24.jpg)
Binary file added asset/WechatIMG24.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added asset/WechatIMG27.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cover/CB_9ax3Gh3GK5B46i26g289e0DH_parsecover.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cover/CB_BpXAIZAHx7al6j56kiG4i43T_parsecover.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
requests
notion-client
github-heatmap
retrying
Binary file added scripts/__pycache__/notion_helper.cpython-311.pyc
Binary file not shown.
Binary file added scripts/__pycache__/utils.cpython-311.pyc
Binary file not shown.
Binary file added scripts/__pycache__/weread_api.cpython-311.pyc
Binary file not shown.
Loading

0 comments on commit cabaa71

Please sign in to comment.