funread 1.1.40__tar.gz → 1.2.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. funread-1.2.7/.github/FUNDING.yml +1 -0
  2. funread-1.2.7/.github/workflows/ci.yml +63 -0
  3. {funread-1.1.40 → funread-1.2.7}/.gitignore +34 -1
  4. funread-1.2.7/CHANGELOG.md +65 -0
  5. funread-1.2.7/LICENSE +21 -0
  6. funread-1.2.7/PKG-INFO +84 -0
  7. funread-1.2.7/README.md +38 -0
  8. funread-1.2.7/example/run.py +61 -0
  9. funread-1.2.7/example/run1.py +16 -0
  10. funread-1.2.7/example/run3.py +29 -0
  11. funread-1.2.7/pyproject.toml +64 -0
  12. funread-1.2.7/scripts/setup.sh +98 -0
  13. funread-1.2.7/src/funread/base/__init__.py +1 -0
  14. funread-1.2.7/src/funread/base/config.py +518 -0
  15. funread-1.2.7/src/funread/legado/engine/__init__.py +98 -0
  16. funread-1.2.7/src/funread/legado/engine/backends/__init__.py +14 -0
  17. funread-1.2.7/src/funread/legado/engine/backends/html.py +336 -0
  18. funread-1.2.7/src/funread/legado/engine/backends/jsonx.py +98 -0
  19. funread-1.2.7/src/funread/legado/engine/backends/regexrow.py +53 -0
  20. funread-1.2.7/src/funread/legado/engine/book.py +332 -0
  21. funread-1.2.7/src/funread/legado/engine/errors.py +100 -0
  22. funread-1.2.7/src/funread/legado/engine/evaluator.py +428 -0
  23. funread-1.2.7/src/funread/legado/engine/expr.py +69 -0
  24. funread-1.2.7/src/funread/legado/engine/feed.py +271 -0
  25. funread-1.2.7/src/funread/legado/engine/fetch.py +306 -0
  26. funread-1.2.7/src/funread/legado/engine/js/__init__.py +44 -0
  27. funread-1.2.7/src/funread/legado/engine/js/base.py +41 -0
  28. funread-1.2.7/src/funread/legado/engine/js/host.py +344 -0
  29. funread-1.2.7/src/funread/legado/engine/js/null.py +30 -0
  30. funread-1.2.7/src/funread/legado/engine/js/quickjs_runtime.py +372 -0
  31. funread-1.2.7/src/funread/legado/engine/lexer.py +534 -0
  32. funread-1.2.7/src/funread/legado/engine/models.py +128 -0
  33. funread-1.2.7/src/funread/legado/engine/nodes.py +235 -0
  34. funread-1.2.7/src/funread/legado/engine/opml.py +145 -0
  35. funread-1.2.7/src/funread/legado/engine/rss.py +294 -0
  36. funread-1.2.7/src/funread/legado/engine/runtime.py +38 -0
  37. funread-1.2.7/src/funread/legado/engine/source.py +668 -0
  38. funread-1.2.7/src/funread/legado/engine/values.py +151 -0
  39. funread-1.2.7/src/funread/legado/engine/variables.py +60 -0
  40. funread-1.2.7/src/funread/legado/manage/__init__.py +56 -0
  41. funread-1.2.7/src/funread/legado/manage/download/__init__.py +63 -0
  42. funread-1.2.7/src/funread/legado/manage/download/context.py +87 -0
  43. funread-1.2.7/src/funread/legado/manage/download/core/__init__.py +39 -0
  44. funread-1.2.7/src/funread/legado/manage/download/core/constants.py +12 -0
  45. funread-1.2.7/src/funread/legado/manage/download/core/db_backup.py +50 -0
  46. funread-1.2.7/src/funread/legado/manage/download/core/processor.py +182 -0
  47. funread-1.2.7/src/funread/legado/manage/download/core/store.py +384 -0
  48. funread-1.2.7/src/funread/legado/manage/download/reporting/__init__.py +11 -0
  49. funread-1.2.7/src/funread/legado/manage/download/reporting/builder.py +187 -0
  50. funread-1.2.7/src/funread/legado/manage/download/reporting/remote.py +141 -0
  51. funread-1.2.7/src/funread/legado/manage/download/sources/__init__.py +15 -0
  52. funread-1.2.7/src/funread/legado/manage/download/sources/book.py +159 -0
  53. funread-1.2.7/src/funread/legado/manage/download/sources/factory.py +57 -0
  54. funread-1.2.7/src/funread/legado/manage/download/sources/rss.py +44 -0
  55. funread-1.2.7/src/funread/legado/manage/download/task.py +165 -0
  56. funread-1.2.7/src/funread/legado/manage/publish/__init__.py +6 -0
  57. funread-1.1.40/src/funread/legado/manage/rss.py → funread-1.2.7/src/funread/legado/manage/publish/entrance.py +52 -41
  58. funread-1.2.7/src/funread/legado/manage/publish/rss.py +207 -0
  59. funread-1.2.7/src/funread/legado/manage/source/__init__.py +58 -0
  60. funread-1.2.7/src/funread/legado/manage/source/check/__init__.py +5 -0
  61. funread-1.2.7/src/funread/legado/manage/source/check/task.py +305 -0
  62. funread-1.2.7/src/funread/legado/manage/source/merge/__init__.py +5 -0
  63. funread-1.2.7/src/funread/legado/manage/source/merge/task.py +664 -0
  64. funread-1.2.7/src/funread/legado/manage/source/storage.py +941 -0
  65. funread-1.2.7/src/funread/legado/manage/source/sync/__init__.py +5 -0
  66. funread-1.2.7/src/funread/legado/manage/source/sync/task.py +415 -0
  67. funread-1.2.7/src/funread/legado/manage/utils/__init__.py +6 -0
  68. {funread-1.1.40 → funread-1.2.7}/src/funread/legado/manage/utils/core.py +2 -3
  69. funread-1.2.7/src/funread/legado/manage/utils/worker.py +28 -0
  70. funread-1.2.7/src/funread/legado/net/__init__.py +16 -0
  71. funread-1.2.7/src/funread/legado/net/charset.py +135 -0
  72. funread-1.2.7/src/funread/legado/net/fetcher.py +198 -0
  73. funread-1.2.7/src/funread/legado/net/probe.py +109 -0
  74. funread-1.2.7/src/funread/legado/net/survey.py +268 -0
  75. funread-1.2.7/src/funread/legado/reader/__init__.py +117 -0
  76. funread-1.2.7/src/funread/legado/reader/matching.py +192 -0
  77. funread-1.2.7/src/funread/legado/reader/registry.py +336 -0
  78. funread-1.2.7/src/funread/legado/reader/rss_service.py +576 -0
  79. funread-1.2.7/src/funread/legado/reader/service.py +877 -0
  80. funread-1.2.7/src/funread/legado/reader/storage.py +1296 -0
  81. {funread-1.1.40 → funread-1.2.7}/src/funread/scripts/command.py +2 -2
  82. funread-1.2.7/tests/conftest.py +58 -0
  83. funread-1.2.7/tests/engine/test_book_flow.py +432 -0
  84. funread-1.2.7/tests/engine/test_combinators_and_regex.py +89 -0
  85. funread-1.2.7/tests/engine/test_default_dialect.py +196 -0
  86. funread-1.2.7/tests/engine/test_dialects.py +163 -0
  87. funread-1.2.7/tests/engine/test_feed_parser.py +301 -0
  88. funread-1.2.7/tests/engine/test_js_boundary.py +152 -0
  89. funread-1.2.7/tests/engine/test_js_quickjs.py +349 -0
  90. funread-1.2.7/tests/engine/test_no_heavy_imports.py +99 -0
  91. funread-1.2.7/tests/engine/test_opml.py +75 -0
  92. funread-1.2.7/tests/engine/test_rss_engine.py +303 -0
  93. funread-1.2.7/tests/engine/test_source_spec.py +349 -0
  94. funread-1.2.7/tests/engine/test_source_spec_rss.py +240 -0
  95. funread-1.2.7/tests/engine/test_url_options.py +243 -0
  96. funread-1.2.7/tests/engine/test_variables_and_interpolation.py +170 -0
  97. funread-1.2.7/tests/net/test_charset.py +134 -0
  98. funread-1.2.7/tests/net/test_requests_fetcher.py +304 -0
  99. funread-1.2.7/tests/net/test_survey.py +60 -0
  100. funread-1.2.7/tests/reader/test_chapter_matching.py +213 -0
  101. funread-1.2.7/tests/reader/test_reader_service.py +916 -0
  102. funread-1.2.7/tests/reader/test_reader_storage.py +604 -0
  103. funread-1.2.7/tests/reader/test_registry.py +372 -0
  104. funread-1.2.7/tests/reader/test_rss_service.py +465 -0
  105. funread-1.2.7/tests/reader/test_rss_storage.py +280 -0
  106. funread-1.2.7/tests/reader/test_user_scoping.py +318 -0
  107. funread-1.2.7/tests/test_config.py +369 -0
  108. funread-1.2.7/tests/test_db_backup.py +28 -0
  109. funread-1.2.7/tests/test_download_base.py +1457 -0
  110. funread-1.2.7/tests/test_publish_and_parse.py +221 -0
  111. funread-1.2.7/tests/test_publish_optional_fundrive.py +103 -0
  112. funread-1.2.7/tests/test_report_builder.py +79 -0
  113. funread-1.2.7/tests/test_source_download_storage.py +430 -0
  114. funread-1.2.7/tests/test_task_database_resolution.py +99 -0
  115. funread-1.1.40/.git +0 -1
  116. funread-1.1.40/.github/workflows/sync.yml +0 -22
  117. funread-1.1.40/LICENSE +0 -201
  118. funread-1.1.40/PKG-INFO +0 -44
  119. funread-1.1.40/README.md +0 -9
  120. funread-1.1.40/example/run1.py +0 -8
  121. funread-1.1.40/example/run3.py +0 -41
  122. funread-1.1.40/logs/.gitignore +0 -1
  123. funread-1.1.40/pyproject.toml +0 -56
  124. funread-1.1.40/src/funread/legado/manage/download/__init__.py +0 -15
  125. funread-1.1.40/src/funread/legado/manage/download/base.py +0 -487
  126. funread-1.1.40/src/funread/legado/manage/download/book.py +0 -146
  127. funread-1.1.40/src/funread/legado/manage/download/generate.py +0 -218
  128. funread-1.1.40/src/funread/legado/manage/download/rss.py +0 -114
  129. funread-1.1.40/src/funread/legado/manage/utils/__init__.py +0 -5
  130. funread-1.1.40/src/funread/web/__init__.py +0 -0
  131. funread-1.1.40/src/funread/web/page/__init__.py +0 -0
  132. funread-1.1.40/src/funread/web/page/video.py +0 -12
  133. funread-1.1.40/src/funread/web/page/video_list.py +0 -67
  134. funread-1.1.40/src/funread/web/parse/__init__.py +0 -0
  135. funread-1.1.40/src/funread/web/parse/base.py +0 -9
  136. funread-1.1.40/src/funread/web/parse/video.py +0 -29
  137. funread-1.1.40/uv.lock +0 -1223
  138. {funread-1.1.40 → funread-1.2.7}/src/funread/__init__.py +0 -0
  139. {funread-1.1.40 → funread-1.2.7}/src/funread/legado/__init__.py +0 -0
  140. /funread-1.1.40/src/funread/legado/manage/__init__.py → /funread-1.2.7/src/funread/py.typed +0 -0
  141. {funread-1.1.40 → funread-1.2.7}/src/funread/scripts/__init__.py +0 -0
@@ -0,0 +1 @@
1
+ github: [farfarfun]
@@ -0,0 +1,63 @@
1
+ name: ci
2
+
3
+ # 这个仓库在 2026-10-17 之前**没有任何 CI** —— 693 个测试只在谁想起来的时候本地
4
+ # 跑一次,而 `funbuild build` 是直接从本机推 PyPI 的,中间没有任何自动关卡。
5
+ #
6
+ # **这条流水线不能阻止一个坏版本发出去**(发版不经过它),它能做的是让问题在
7
+ # push 之后几分钟内可见,而不是等到别人装上。真正的前置关卡要么是发版前本地跑
8
+ # 一遍测试,要么把发布改成 tag 触发 —— 那是另一件事。
9
+ on:
10
+ push:
11
+ branches: [master]
12
+ pull_request:
13
+ workflow_dispatch:
14
+
15
+ concurrency:
16
+ group: ci-${{ github.ref }}
17
+ cancel-in-progress: true
18
+
19
+ jobs:
20
+ test:
21
+ name: test (py${{ matrix.python }})
22
+ runs-on: ubuntu-latest
23
+ timeout-minutes: 15
24
+ strategy:
25
+ fail-fast: false
26
+ matrix:
27
+ # 3.11 是 pyproject 里 requires-python 的下限,**必须测** —— 声明支持
28
+ # 却从没在上面跑过的话,那条下限只是一句话。3.12 是实际开发用的版本。
29
+ # (funread-api 那边下限是 3.12,因为 funauth 要求它;这个库不跟着抬,
30
+ # 只用采集功能的人不该被迫升级。)
31
+ python: ["3.11", "3.12"]
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+
35
+ - uses: astral-sh/setup-uv@v5
36
+ with:
37
+ enable-cache: true
38
+
39
+ - name: 装依赖
40
+ # `--all-extras` 把 parse / js / reader / publish 都装上:测试覆盖规则
41
+ # 引擎(要 lxml、cssselect、jsonpath-ng)和 quickjs 那条 JS 路径,少装
42
+ # 一个 extra 对应的用例会 skip 而不是报错 —— 绿得毫无意义。
43
+ # publish 那个 extra 的 fundrive 带 `python_version >= '3.12'` 标记,
44
+ # 3.11 上自动跳过,不用在这儿分支。
45
+ #
46
+ # 不加 `--locked`:uv.lock 在每次 funbuild 发版时被 `rm -rf` 重建,
47
+ # 要求它和 pyproject 严格一致只会在无关的时候红。
48
+ run: uv sync --all-extras --python ${{ matrix.python }}
49
+
50
+ - name: ruff
51
+ run: uv run ruff check .
52
+
53
+ - name: 格式
54
+ run: uv run ruff format --check .
55
+
56
+ - name: pytest
57
+ # 测试全部离线(注入 StaticFetcher),不碰网络。
58
+ # tests/conftest.py 有 autouse fixture 把库地址强制成临时 SQLite ——
59
+ # 本机的 funsecret 指向生产 PostgreSQL,没有那层隔离,跑一次测试就是往
60
+ # 生产库里写数据。CI 上没有 funsecret,但那层隔离照样生效。
61
+ # --fail-on-skip:少装一个 extra 对应的用例会 skip 而不是报错,绿得毫无
62
+ # 意义 —— 这里把 skip 当失败。实现在 tests/conftest.py。
63
+ run: uv run pytest -q --fail-on-skip
@@ -114,4 +114,37 @@ dmypy.json
114
114
  # Pyre type checker
115
115
  .pyre/
116
116
  *.db
117
- *.accdb
117
+ *.accdb
118
+ .run/
119
+ logs/
120
+ .idea/
121
+ .vscode/
122
+ *.rar
123
+ node_modules/
124
+
125
+ # ---- AI 编码助手 ----
126
+ # 只忽略本地状态;团队有意共享的 agent / 命令 / 规则定义仍然版本化。
127
+ # 必须写 `dir/*` 而不是 `dir/`:父目录被整体排除后 git 不会下探,
128
+ # 下面的 `!` 取消规则就永远不会生效。
129
+ .claude/*
130
+ !.claude/agents/
131
+ !.claude/commands/
132
+ !.claude/skills/
133
+ !.claude/settings.json
134
+ .codex/*
135
+ !.codex/prompts/
136
+ .cursor/*
137
+ !.cursor/agents/
138
+ !.cursor/rules/
139
+
140
+ # 其余助手:目前没有共享内容,整体忽略
141
+ .aider*
142
+ .gemini/
143
+ .continue/
144
+ .windsurf/
145
+ .roo/
146
+ .cline/
147
+ .specstory/
148
+ CLAUDE.local.md
149
+ AGENTS.local.md
150
+ uv.lock
@@ -0,0 +1,65 @@
1
+ # 更新日志
2
+
3
+ ## 未发布
4
+
5
+ ### 新增
6
+
7
+ - 无。
8
+
9
+ ### 修复
10
+
11
+ - 修复 `fundrive`(仅要求 Python >= 3.12)条件依赖导致 Python 3.10/3.11 下
12
+ `import funread.legado.manage` 整体失败的问题:`download/context.py`、
13
+ `publish/entrance.py`、`publish/rss.py` 改为惰性导入 `fundrive`,缺失时仅在
14
+ 实际使用发布/上传功能(`SourceBuildContext`、`UpdateEntrance`、
15
+ `UpdateRssTask`)时抛出明确的 `ImportError`,不再拖垮整个包的导入。
16
+ - 修复 `download/reporting/builder.py` 中订阅源链接硬编码指向不存在的
17
+ `funread/legado/rss/rss-main.json`、导致 Legado 导入页链接全部失效的问题,
18
+ 改为指向实际产出的 `funread/legado/snapshot/lasted/funread.json`
19
+ (根因排查见 farfarfun/funread-cache#743,该仓库已同步修正生成产物里的链接)。
20
+ - 收窄多处过宽的 `except Exception`:`utils/core.py` 的 `url_to_hostname`、
21
+ `source/check/task.py` 与 `source/merge/task.py` 中 `read_secret` 相关的
22
+ 数据库地址读取、`_load_status_map`、`_read_file_status`/`_read_version`
23
+ (及 merge 侧的 `_read_version_count`)、`source/sync/task.py` 的
24
+ `_build_canonical_url_id_map`,均改为捕获实际可能抛出的具体异常类型并保留
25
+ 日志上下文,避免掩盖真实的系统故障。
26
+ - 简化 `download/core/processor.py` 中 `(IOError, Exception)` 这一冗余异常元组
27
+ (`IOError` 是 `OSError` 的别名,本身就是 `Exception` 的子类,并无实际收窄
28
+ 效果)。
29
+
30
+ ### 变更
31
+
32
+ - `fundrive` 依赖从无条件声明改为真正可选,移动到 `publish` extra:
33
+ 需要发布/上传功能的调用方请改用 `pip install funread[publish]`
34
+ (仍要求 Python >= 3.12)。
35
+ - 将遗留的 `typing.Optional/List/Dict/Set/Tuple/Type` 写法统一迁移为 Python
36
+ 3.10+ 内置泛型语法(`X | None`、`list[X]`、`dict[K, V]` 等)。
37
+ - 为 `download/sources/factory.py`(模块、`register_source_type`、
38
+ `supported_source_types`、`SourceStoreFactory.create`)与
39
+ `download/sources/book.py` 的 `BookSourceFormat.run` 补充中文 docstring。
40
+ - `web/page/video_list.py` 的 `run()` 新增 `port` 参数,支持通过
41
+ `FUNREAD_WEB_PORT` 环境变量覆盖监听端口;新增 `scripts/setup.sh` 管理该
42
+ 开发用 NiceGUI 服务的 start/stop/restart/run/status 生命周期。
43
+
44
+ ### 废弃
45
+
46
+ - 无。
47
+
48
+ ## 1.1.103
49
+
50
+ ### 新增
51
+
52
+ - 无。
53
+
54
+ ### 修复
55
+
56
+ - 修正 Python 3.10 兼容声明、日志版本下限和解析器失败行为。
57
+ - 移除视频列表调试输出。
58
+
59
+ ### 变更
60
+
61
+ - 现代化公开类型标注并补充最小使用示例。
62
+
63
+ ### 废弃
64
+
65
+ - 无。
funread-1.2.7/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 farfarfun
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
funread-1.2.7/PKG-INFO ADDED
@@ -0,0 +1,84 @@
1
+ Metadata-Version: 2.5
2
+ Name: funread
3
+ Version: 1.2.7
4
+ Summary: 一个用于管理和处理阅读源(Legado 阅读 APP 的书源和 RSS 源)的 Python 工具库
5
+ Project-URL: Organization, https://github.com/farfarfun
6
+ Project-URL: Repository, https://github.com/farfarfun/funread
7
+ Project-URL: Releases, https://github.com/farfarfun/funread/releases
8
+ Author-email: 牛哥 <niuliangtao@qq.com>, farfarfun <farfarfun@qq.com>
9
+ Maintainer-email: 牛哥 <niuliangtao@qq.com>, farfarfun <farfarfun@qq.com>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: book-source,ebook,legado,reading,rss
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Classifier: Topic :: Text Processing :: Markup
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: dominate>=2.9.1
21
+ Requires-Dist: farlog>=1.1.7
22
+ Requires-Dist: funfake>=1.1.5
23
+ Requires-Dist: funfile>=1.0.39
24
+ Requires-Dist: funsecret>=1.4.88
25
+ Requires-Dist: funworker>=0.1.3
26
+ Requires-Dist: psycopg2-binary>=2.9.10
27
+ Requires-Dist: pymysql>=1.1.0
28
+ Requires-Dist: requests>=2.28.0
29
+ Requires-Dist: sqlalchemy>=2.0.0
30
+ Requires-Dist: tqdm>=4.67.0
31
+ Provides-Extra: js
32
+ Requires-Dist: quickjs>=1.19.4; extra == 'js'
33
+ Provides-Extra: parse
34
+ Requires-Dist: charset-normalizer>=3.0.0; extra == 'parse'
35
+ Requires-Dist: cssselect>=1.2.0; extra == 'parse'
36
+ Requires-Dist: jsonpath-ng>=1.6.1; extra == 'parse'
37
+ Requires-Dist: lxml>=5.1.0; extra == 'parse'
38
+ Provides-Extra: publish
39
+ Requires-Dist: fundrive>=2.0.81; (python_version >= '3.12') and extra == 'publish'
40
+ Provides-Extra: reader
41
+ Requires-Dist: charset-normalizer>=3.0.0; extra == 'reader'
42
+ Requires-Dist: cssselect>=1.2.0; extra == 'reader'
43
+ Requires-Dist: jsonpath-ng>=1.6.1; extra == 'reader'
44
+ Requires-Dist: lxml>=5.1.0; extra == 'reader'
45
+ Description-Content-Type: text/markdown
46
+
47
+ # 阅读
48
+
49
+ [源仓库](http://www.yckceo1.com/)
50
+
51
+ [规则说明](https://alanskycn.gitee.io/teachme/)
52
+
53
+ [app端](https://github.com/gedoor/legado)
54
+
55
+ [服务端](https://github.com/hectorqin/reader)
56
+
57
+ `funread` 是一个用于管理和处理 Legado 阅读 APP 书源与 RSS 源的 Python 工具库。
58
+
59
+ ## 安装
60
+
61
+ ```bash
62
+ uv add funread
63
+ ```
64
+
65
+ ## 最小示例
66
+
67
+ ```python
68
+ from funread.legado.manage.source.storage import compute_url_md5
69
+
70
+ print(compute_url_md5("https://example.com/source.json"))
71
+ ```
72
+
73
+ ---
74
+
75
+ ## 关于 farfarfun
76
+
77
+ [farfarfun](https://github.com/farfarfun) 是一个专注于实用工具库的开源组织,
78
+ 涵盖云存储、数据处理、AI、多媒体与开发工具链等方向。
79
+
80
+ - 🏠 组织主页:<https://github.com/farfarfun>
81
+ - 📦 PyPI:<https://pypi.org/user/niuliangtao/>
82
+ - 📧 联系:farfarfun@qq.com
83
+
84
+ 本项目基于 [MIT](LICENSE) 协议开源。
@@ -0,0 +1,38 @@
1
+ # 阅读
2
+
3
+ [源仓库](http://www.yckceo1.com/)
4
+
5
+ [规则说明](https://alanskycn.gitee.io/teachme/)
6
+
7
+ [app端](https://github.com/gedoor/legado)
8
+
9
+ [服务端](https://github.com/hectorqin/reader)
10
+
11
+ `funread` 是一个用于管理和处理 Legado 阅读 APP 书源与 RSS 源的 Python 工具库。
12
+
13
+ ## 安装
14
+
15
+ ```bash
16
+ uv add funread
17
+ ```
18
+
19
+ ## 最小示例
20
+
21
+ ```python
22
+ from funread.legado.manage.source.storage import compute_url_md5
23
+
24
+ print(compute_url_md5("https://example.com/source.json"))
25
+ ```
26
+
27
+ ---
28
+
29
+ ## 关于 farfarfun
30
+
31
+ [farfarfun](https://github.com/farfarfun) 是一个专注于实用工具库的开源组织,
32
+ 涵盖云存储、数据处理、AI、多媒体与开发工具链等方向。
33
+
34
+ - 🏠 组织主页:<https://github.com/farfarfun>
35
+ - 📦 PyPI:<https://pypi.org/user/niuliangtao/>
36
+ - 📧 联系:farfarfun@qq.com
37
+
38
+ 本项目基于 [MIT](LICENSE) 协议开源。
@@ -0,0 +1,61 @@
1
+ import sys
2
+ from pathlib import Path
3
+
4
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
5
+
6
+ from tqdm import tqdm
7
+
8
+ from funread.legado.manage.download import GenerateSourceTask
9
+ from funread.legado.manage.publish import UpdateEntrance
10
+ from funread.legado.manage.source import add_source_list_url
11
+
12
+
13
+ def add_url_data():
14
+ urls = [
15
+ "https://bitbucket.org/xiu2/yuedu/raw/master/shuyuan",
16
+ "https://jihulab.com/aoaostar/legado/-/raw/release/cache/8274870a1493d7c4e51c41682a8d1e9500457826.json",
17
+ "https://jihulab.com/aoaostar/legado/-/raw/release/cache/3fc2c64c5489c491de6284dca2c2dfce7f551bc9.json",
18
+ "https://jihulab.com/aoaostar/legado/-/raw/release/cache/71e56d4f1d8f1bff61fdd3582ef7513600a9e108.json",
19
+ "https://jihulab.com/aoaostar/legado/-/raw/release/cache/1b8256c78b385543b5e8aa6a0d7693c76f8e60d4.json",
20
+ "https://jihulab.com/aoaostar/legado/-/raw/release/cache/4dc410d1d0a674de21c5d869496efd60a7fcba7c.json",
21
+ "https://jihulab.com/aoaostar/legado/-/raw/release/cache/edeb9b5490b7028906ad3cd2c2b7404b2e4052b9.json",
22
+ "https://jihulab.com/aoaostar/legado/-/raw/release/cache/290e0bb1f148e963941fade280a938df81b374b7.json",
23
+ "https://jihulab.com/aoaostar/legado/-/raw/release/cache/346da4b785d3dd5aed990a553e10d03d1ececec4.json",
24
+ "https://jihulab.com/aoaostar/legado/-/raw/release/cache/6a2c6bb280c2508b7946a6fbe908e3208254f529.json",
25
+ "https://jihulab.com/aoaostar/legado/-/raw/release/cache/c495b2f09c55df7acec91eb34588e78b1add7908.json",
26
+ "https://jihulab.com/aoaostar/legado/-/raw/release/cache/0a189226b495a6b15c57acc06177ee15db8cd33c.json",
27
+ ]
28
+
29
+ for url in tqdm(urls):
30
+ add_source_list_url(url=url, source_type="book")
31
+
32
+ for uri in ("https://www.yckceo.com",):
33
+ for _id in tqdm(range(7000, 7500), desc=uri):
34
+ add_source_list_url(url=f"{uri}/yuedu/shuyuan/json/id/{_id}.json", source_type="book")
35
+
36
+ for _id in tqdm(range(0, 1200), desc=uri):
37
+ add_source_list_url(url=f"{uri}/yuedu/shuyuans/json/id/{_id}.json", source_type="book")
38
+
39
+ for _id in tqdm(range(0, 300), desc=uri):
40
+ add_source_list_url(url=f"{uri}/yuedu/rss/json/id/{_id}.json", source_type="rss")
41
+ for _id in tqdm(range(0, 300), desc=uri):
42
+ add_source_list_url(url=f"{uri}/yuedu/rsss/json/id/{_id}.json", source_type="rss")
43
+
44
+
45
+ # add_url_data()
46
+
47
+ # GenerateSourceTask().run_rss()
48
+ # GenerateSourceTask().run_rss(load=True)
49
+
50
+ # GenerateSourceTask().run_rss(check=True)
51
+ # GenerateSourceTask().run_rss(merge=True)
52
+ GenerateSourceTask().run_rss(sync=True, dump=True)
53
+
54
+
55
+ # GenerateSourceTask().run_book(check=True)
56
+ # GenerateSourceTask().run_book(merge=True)
57
+ GenerateSourceTask().run_book(sync=True, dump=True)
58
+
59
+ GenerateSourceTask().run_book(upload=True, publish=True)
60
+ GenerateSourceTask().run_rss(upload=True, publish=True)
61
+ UpdateEntrance().run()
@@ -0,0 +1,16 @@
1
+ from funread.legado.manage.source import add_source_list_url
2
+
3
+
4
+ def main():
5
+ add_source_list_url(
6
+ url="https://bitbucket.org/xiu2/yuedu/raw/master/shuyuan",
7
+ source_type="book",
8
+ )
9
+ add_source_list_url(
10
+ url="https://www.yckceo1.com/yuedu/rsss/json/id/43.json",
11
+ source_type="rss",
12
+ )
13
+
14
+
15
+ if __name__ == "__main__":
16
+ main()
@@ -0,0 +1,29 @@
1
+ import sys
2
+ from pathlib import Path
3
+
4
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
5
+
6
+ from funread.legado.manage.download import GenerateSourceTask
7
+ from funread.legado.manage.publish import UpdateRssTask
8
+ from funread.legado.manage.source import MergeSourceTask
9
+
10
+
11
+ def run_generate():
12
+ task = GenerateSourceTask()
13
+ task.run_book()
14
+ task.run_rss()
15
+
16
+
17
+ def run_merge():
18
+ task = MergeSourceTask()
19
+ task.run_book()
20
+ task.run_rss()
21
+
22
+
23
+ def run_publish():
24
+ task = UpdateRssTask()
25
+ task.run()
26
+
27
+
28
+ if __name__ == "__main__":
29
+ run_generate()
@@ -0,0 +1,64 @@
1
+ [project]
2
+ name = "funread"
3
+ version = "1.2.7"
4
+ description = "一个用于管理和处理阅读源(Legado 阅读 APP 的书源和 RSS 源)的 Python 工具库"
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ keywords = [ "legado", "reading", "book-source", "rss", "ebook",]
8
+ classifiers = ["Development Status :: 4 - Beta", "Intended Audience :: Developers", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.12", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Text Processing :: Markup"]
9
+ dependencies = [ "dominate>=2.9.1", "funfake>=1.1.5", "funfile>=1.0.39", "farlog>=1.1.7", "funsecret>=1.4.88", "funworker>=0.1.3", "requests>=2.28.0", "SQLAlchemy>=2.0.0", "PyMySQL>=1.1.0", "psycopg2-binary>=2.9.10", "tqdm>=4.67.0",]
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ [[project.authors]]
13
+ name = "牛哥"
14
+ email = "niuliangtao@qq.com"
15
+
16
+ [[project.authors]]
17
+ name = "farfarfun"
18
+ email = "farfarfun@qq.com"
19
+ [[project.maintainers]]
20
+ name = "牛哥"
21
+ email = "niuliangtao@qq.com"
22
+
23
+ [[project.maintainers]]
24
+ name = "farfarfun"
25
+ email = "farfarfun@qq.com"
26
+ [build-system]
27
+ requires = [ "hatchling",]
28
+ build-backend = "hatchling.build"
29
+
30
+ [project.optional-dependencies]
31
+ parse = [ "lxml>=5.1.0", "cssselect>=1.2.0", "jsonpath-ng>=1.6.1", "charset-normalizer>=3.0.0",]
32
+ js = [ "quickjs>=1.19.4",]
33
+ reader = [ "funread[parse]",]
34
+ publish = [ "fundrive>=2.0.81; python_version >= '3.12'",]
35
+
36
+ [project.urls]
37
+ Organization = "https://github.com/farfarfun"
38
+ Repository = "https://github.com/farfarfun/funread"
39
+ Releases = "https://github.com/farfarfun/funread/releases"
40
+
41
+ [dependency-groups]
42
+ dev = [ "pytest>=8.0.0", "pytest-cov>=4.0.0", "ruff>=0.1.0", "mypy>=1.0.0", "httpx2>=2.0.0",]
43
+
44
+ [tool.ruff]
45
+ line-length = 100
46
+ target-version = "py311"
47
+
48
+ [tool.mypy]
49
+ python_version = "3.11"
50
+ warn_return_any = true
51
+ warn_unused_configs = true
52
+ disallow_untyped_defs = false
53
+
54
+ [tool.setuptools]
55
+
56
+ [tool.ruff.lint]
57
+ select = [ "E", "F", "I", "N", "W",]
58
+ ignore = [ "E501",]
59
+
60
+ [tool.ruff.lint.isort]
61
+ # funread is this package. Ruff also finds it installed in site-packages and
62
+ # would otherwise sort absolute `from funread.base.config import ...` in with
63
+ # the third-party block.
64
+ known-first-party = ["funread"]
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # funread 是 package 类应用:只会被 import / pip install 成依赖,
5
+ # 没有任何东西把它当长驻进程启动。因此它只实现 release action,
6
+ # 不实现 start/stop/restart/run/status,也没有 `server` 子命令 ——
7
+ # 对它执行 service action 是用法错误,这里显式报错而不是静默跳过。
8
+
9
+ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
10
+ cd "${ROOT}"
11
+
12
+ PKG_NAME="funread"
13
+ PYTHON="${PYTHON:-python3}"
14
+
15
+ readonly ROOT PKG_NAME PYTHON
16
+
17
+ usage() {
18
+ printf 'Usage: %s install-dev\n' "${0##*/}" >&2
19
+ printf ' %s <install-prod|upgrade> [version]\n' "${0##*/}" >&2
20
+ printf ' %s rollback <version>\n' "${0##*/}" >&2
21
+ printf ' %s uninstall\n' "${0##*/}" >&2
22
+ printf '\n' >&2
23
+ printf '%s 是 package 类应用,不支持 start/stop/restart/run/status。\n' "${PKG_NAME}" >&2
24
+ }
25
+
26
+ die() {
27
+ printf 'error: %s\n' "$*" >&2
28
+ exit 2
29
+ }
30
+
31
+ # 清掉上一次的构建产物与本地安装,从工作树重新构建并强制重装。
32
+ do_install_dev() {
33
+ rm -rf dist build
34
+ funbuild install
35
+ }
36
+
37
+ do_install_prod() {
38
+ local version="${1:-}"
39
+ "${PYTHON}" -m pip install "${PKG_NAME}${version:+==${version}}"
40
+ }
41
+
42
+ # funread 没有自己的 CLI(pyproject 里没有 [project.scripts]),
43
+ # 所以 upgrade/rollback 直接退回到包管理器,而不是转发给某个 CLI 子命令。
44
+ do_upgrade() {
45
+ local version="${1:-}"
46
+ if [[ -n "${version}" ]]; then
47
+ "${PYTHON}" -m pip install "${PKG_NAME}==${version}"
48
+ else
49
+ "${PYTHON}" -m pip install --upgrade "${PKG_NAME}"
50
+ fi
51
+ }
52
+
53
+ do_rollback() {
54
+ local version="$1"
55
+ "${PYTHON}" -m pip install "${PKG_NAME}==${version}"
56
+ }
57
+
58
+ do_uninstall() {
59
+ "${PYTHON}" -m pip uninstall -y "${PKG_NAME}"
60
+ }
61
+
62
+ main() {
63
+ local action="${1:-}"
64
+
65
+ case "${action}" in
66
+ start | stop | restart | run | status)
67
+ usage
68
+ die "${action} 只适用于 service 类应用;${PKG_NAME} 是 package 类应用"
69
+ ;;
70
+ install-dev | uninstall)
71
+ (( $# == 1 )) || {
72
+ usage
73
+ die "${action} 不接受额外参数"
74
+ }
75
+ "do_${action//-/_}"
76
+ ;;
77
+ install-prod | upgrade)
78
+ (( $# <= 2 )) || {
79
+ usage
80
+ die "${action} 最多接受一个 version 参数"
81
+ }
82
+ "do_${action//-/_}" "${2:-}"
83
+ ;;
84
+ rollback)
85
+ (( $# == 2 )) || {
86
+ usage
87
+ die "rollback 必须显式给出版本号"
88
+ }
89
+ do_rollback "$2"
90
+ ;;
91
+ *)
92
+ usage
93
+ die "unknown action: ${action:-<empty>}"
94
+ ;;
95
+ esac
96
+ }
97
+
98
+ main "$@"
@@ -0,0 +1 @@
1
+ """Shared cross-cutting infrastructure (config, ...)."""