Giter Site home page Giter Site logo

weread2notion's Introduction

关于

  • 👋 嗨,我叫马林康,目前工作生活在北京,是一名Android工程师 👨🏻‍💻
  • ❤️ 我喜欢🏃🏻跑步 、📖读书 和🎬看电影
  • ✍️ 会在个人博客上记录生活和学习笔记,也会活跃在一些社交媒体上。

GitHub Twitter Telegram

weread2notion's People

Contributors

actions-user avatar jerrysmd avatar malinkang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

weread2notion's Issues

自动运行成功后notion内容没有发生改变

第一次发生时我直接删了原来的,重新建了一个,但是后来建的第二个还是发生这种情况,于是我将Cookie和NotionDatabaseID给替换了,然后我手动运行了一次,成功了,请问如何避免下次遇到这种情况?

一直同步错误,只同步了几本书。UnboundLocalError: local variable 'newRating' referenced before assignment

报错代码如下,谢谢
Traceback (most recent call last):
File "/home/runner/work/weread_to_notion/weread_to_notion/weread.py", line 409, in
isbn,rating = get_bookinfo(bookId)
File "/home/runner/work/weread_to_notion/weread_to_notion/weread.py", line 67, in get_bookinfo
return (isbn, newRating)
UnboundLocalError: local variable 'newRating' referenced before assignment
Error: Process completed with exit code 1.

notion的内容无法更改

image

例如,当我的微信读书的章节题目变成乱码时,Notion也自动提取了错误题目,无法更改题目。
image

第一次运行同步只同步了几本书,其他统统没有同步

第一次成功运行action,只同步成功了3本书。有两本是今天读,一本是昨天读的。但是更早之前的笔记就没有更新了。
其他的书都还是复制过来的模版中的读书笔记,不是我自己的。
现在笔记条数是124,同步之前是121。
看了action的日子,同步已经运行结束正确退出了。

自动化错误疑似cookie格式不对?如何正确获取cookie?

具体问题是:

Traceback (most recent call last):
  File "/home/runner/work/weread_to_notion/weread_to_notion/weread.py", line 389, in <module>
    session.get(WEREAD_URL)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/requests/sessions.py", line 602, in get
    return self.request("GET", url, **kwargs)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/requests/sessions.py", line 719, in send
    extract_cookies_to_jar(self.cookies, request, r.raw)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/requests/cookies.py", line [13](https://github.com/Xiaoshizi1024/weread_to_notion/actions/runs/6439335875/job/17489578613#step:5:14)7, in extract_cookies_to_jar
    jar.extract_cookies(res, req)
AttributeError: 'NoneType' object has no attribute 'extract_cookies'
Error: Process completed with exit code 1.

没有对代码做任何改变,那么能错误的只有上传的三个参数,看着应该是cookie的问题。

自我测试,用edge获取的cookie跟Google Chrome获取的格式竟然都不一样,两个都测试了,但是还是出现同样的错误。
那么难道是我获取的cookie有问题?

我是如何获取cookie的?

  • 在网页端,打开开发者选项,随便点击一本书,会出现doc,然后在文件“weread.qq.com” 标头中,请求的标头中获取的。

cookie对比

我具体上传参数格式是这样的

setting
这是基本上所有的内容了,我尝试着重新上传这三个参数,但是还没有解决问题,所以希望您能帮助我~

同步失败

Sync报如下错误
Run python weread.py "" "" "***"
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/notion_client/client.py", line 118, in _parse_response
response.raise_for_status()
File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/httpx/_models.py", line 758, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '400 Bad Request' for url 'https://api.notion.com/v1/databases/***/query'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400

看起来是Secrets没有获取到?但在fork的代码中按照guide添加了3个token的。

报错,在函数内部更改全局变量

Traceback (most recent call last):
  File "/home/runner/work/weread_to_notion/weread_to_notion/weread.py", line 409, in <module>
    isbn,rating = get_bookinfo(bookId)
  File "/home/runner/work/weread_to_notion/weread_to_notion/weread.py", line 67, in get_bookinfo
    return (isbn, rating)
UnboundLocalError: local variable 'rating' referenced before assignment
Error: Process completed with exit code 1.

报错如上,google 了一下,意思是在函数内部更改全局变量导致的错误,需要在函数内部做个声明 global rating,不知是否可行。

但在 notion 有记录且仅有一条。

如果大佬更新了代码,我们需要重新 fork ,重新走流程吗?

感谢!

开发者修改了Notion模版导致老模版用户同步失败

问题:
notion_client.errors.APIResponseError: ISBN is not a property that exists. URL is not a property that exists. Rating is not a property that exists.

原因:
拥有老模版的用户,因为缺少新增的:ISBN URL Rating 三个字段,

解决方案:
需要自己手工该模版添加属性,或者删除模版重新导入模版重新同步。

设置问题

github->我fork的项目->settings->Secrets and variables中有actions, codespaces, dependabot三个选项,是在哪一个里进行new repository secret呢

notion里模板里缺少properties

  1. notion_client.errors.APIResponseError: ISBN is not a property that exists. URL is not a property that exists. Rating is not a property that exists. 模板缺少这三个新加的property(ISBN, URL, Rating), 需要加到Table properties

  2. 教程里缺少notion database - add connection 这个部分, 不做的话 notion token access 不了database

报错,请求参数有问题?

已经根据步骤正确设置了NOTION_TOKEN、NOTION_DATABASE_ID、WEREAD_COOKIE,但在运行时出现如下报错:
Traceback (most recent call last):
File "/home/runner/work/weread_to_notion/weread_to_notion/weread.py", line 345, in
session.get(WEREAD_URL)
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/requests/sessions.py", line 602, in get
return self.request("GET", url, **kwargs)
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/requests/sessions.py", line 719, in send
extract_cookies_to_jar(self.cookies, request, r.raw)
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/requests/cookies.py", line 137, in extract_cookies_to_jar
jar.extract_cookies(res, req)
AttributeError: 'NoneType' object has no attribute 'extract_cookies'
Error: Process completed with exit code 1.
看上去似乎是因为Cookie传参有问题?

运行报错

Run python weread.py "" "" "***"
Traceback (most recent call last):
File "/home/runner/work/weread_to_notion/weread_to_notion/weread.py", line 389, in
session.get(WEREAD_URL)
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/requests/sessions.py", line 600, in get
return self.request("GET", url, **kwargs)
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/requests/sessions.py", line 717, in send
extract_cookies_to_jar(self.cookies, request, r.raw)
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/requests/cookies.py", line 137, in extract_cookies_to_jar
jar.extract_cookies(res, req)
AttributeError: 'NoneType' object has no attribute 'extract_cookies'
Error: Process completed with exit code 1.

无法实现任务自动执行

我的手动执行都好使,为啥自动执行无效,每天0点不执行,改成0/5 * * * *,每5分钟执行一次也是无效,是否还有啥地方配置自动执行的操作。

缺少笔记

希望不仅可以有划线,还能同步笔记

运行报错

错误信息:
Traceback (most recent call last):
File "/home/runner/work/weread_to_notion/weread_to_notion/weread.py", line 380, in
bookmark_list = sorted(bookmark_list, key=lambda x: (
File "/home/runner/work/weread_to_notion/weread_to_notion/weread.py", line 381, in
x.get("chapterUid", 1), 0 if x.get("range") == "" else int(x.get("range").split("-")[0])))
AttributeError: 'NoneType' object has no attribute 'split'

提示报错,请问有没有能告知下处理方向?建立了connect,确定三个参数填入没有问题

报错:
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/notion_client/client.py", line 118, in _parse_response
response.raise_for_status()
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/httpx/_models.py", line 749, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '404 Not Found' for url 'https://api.notion.com/v1/databases/***/query'
For more information check: https://httpstatuses.com/404

notion_client.errors.APIResponseError: Could not find database with ID: *my_id. Make sure the relevant pages and databases are shared with your integration.

同步计划一直在进行,但是书库没有变化

除了第一天成功同步之外,之后connection就完全没有修改过database。不知道是否跟cookie一直在变有关——因为我开了禁广告ADguard。
但是当我把Adguard关掉,更新cookie以后手动同步,页面还是没有变化。我确定token和dataID都是正确的

自己上传微信读书里的书不显示封面

自己上传到微信读书里的mobi和epub格式受影响,pdf格式的书籍的cover封面显示正常,不受影响。

notion里,其余字段正常获取不受影响,并且bookname前面的图标显示正常,有数据的封面,但cover里为cover的灰色链接:https://wrco-40036.sh.gfp.tencent-cloud.com/CB_EMb3Zh3YK8uJ6i36gwBfz3hn/parsecover?sign=q-sign-algorithm%3Dsha1%26q-ak%3Dcydn1szJ2OQT2J72AOTKL4DZ%26q-sign-time%3D1692166441%3B1692167041%26q-key-time%3D1692166441%3B1692167041%26q-header-list%3Dhost%26q-url-param-list%3D%26q-signature%3D8ac25232101ff8260068cd4e5c79855740080787

于是乎来到weread.qq.com检查,发现mobi和epub的封面链接均为下载文件的形式,pdf则为图片形式。

私以为说明程序是正常跑的,链接也抓到了,只是notion数据里的cover字段是文件和媒体公用字段,链接被notion识别为了文件,故而没有使用图片进行直接展示,至于微信读书里mobi和epub的图片链接为文件格式,可能是有特殊原因存在。

不知道可不可行的胡乱猜想不负责任信口胡说解决方案:
1、微信读书侧生成的链接有没有可能转换为图片形式;
2、notion里关于cvoer字段能否像bookname前面的图标一样直接显示为图片;
3、py检测到链接里包含:parsecover时,下载图片转存到notion,在notion进行显示。

KeyError: 'readTimes'

从重构版本更新那天起就一直报同样的错误:
`Run github_heatmap weread --weread_cookie "***" --year 2018-2023 --me "" --with-animation --background-color=#ffffff --track-color=#ACE7AE --special-color1=#69C16E --special-color2=#549F57 --dom-color=#EBEDF0 --text-color=#000000

Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.9.18/x64/bin/github_heatmap", line 8, in
sys.exit(main())
File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/github_heatmap/cli.py",
line 182, in main
run()
File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/github_heatmap/cli.py",
line 89, in run
tracks, years = loader.get_all_track_data()
File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/github_heatmap/loader/weread_loader.py", line 50, in get_all_track_data
self.make_track_dict()
File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/github_heatmap/loader/weread_loader.py", line 41, in make_track_dict
readTimes = dict(sorted(api_data["readTimes"].items(), reverse=True))

KeyError: 'readTimes'

Error: Process completed with exit code 1.`

刚开始以为是notion模板的问题,把模板删除了重新复制了,更新了database_id,还是报错。

第一天运行成功,第二天报错

Traceback (most recent call last):
File "/home/runner/work/munotion/munotion/weread.py", line 404, in
bookmark_list = get_bookmark_list(bookId)
File "/home/runner/work/munotion/munotion/weread.py", line 43, in get_bookmark_list
updated = sorted(updated, key=lambda x: (
File "/home/runner/work/munotion/munotion/weread.py", line 44, in
x.get("chapterUid", 1), int(x.get("range").split("-")[0])))
ValueError: invalid literal for int() with base 10: ''

无法实现

您好,每一步否按照要求做了,但是无法实现相应的功能。是否因为现在有了新的变化?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.