yklibpy 0.2.0__tar.gz → 0.2.4__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.
- yklibpy-0.2.4/CLAUDE.md +91 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/PKG-INFO +1 -1
- {yklibpy-0.2.0 → yklibpy-0.2.4}/pyproject.toml +1 -1
- yklibpy-0.2.4/src/yklibpy/cli/__init__.py +3 -0
- yklibpy-0.2.4/src/yklibpy/cli/cli.py +25 -0
- yklibpy-0.2.4/src/yklibpy/command/__init__.py +3 -0
- yklibpy-0.2.4/src/yklibpy/command/command.py +143 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/common/__init__.py +2 -1
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/config/__init__.py +3 -3
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/db/appstore.py +24 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/db/storex.py +4 -3
- {yklibpy-0.2.0 → yklibpy-0.2.4}/uv.lock +37 -37
- yklibpy-0.2.0/CLAUDE.md +0 -109
- {yklibpy-0.2.0 → yklibpy-0.2.4}/.claude/settings.local.json +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/.editorconfig +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/.gitignore +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/.prettierrc +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/.python-version +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/README.md +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/db.yaml +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/mypy.ini +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/common/env.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/common/info.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/common/safedict.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/common/timex.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/common/util.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/common/util_json.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/common/util_yaml.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/config/appconfig.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/db/__init__.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/db/db_base.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/db/db_yaml.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/htmlparser/__init__.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/htmlparser/app.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/htmlparser/configprepare.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/htmlparser/htmlop.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/htmlparser/misc/__init__.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/htmlparser/misc/anchortaginfo.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/htmlparser/misc/anchortagx.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/htmlparser/misc/priceinfo.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/htmlparser/misc/tagx.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/htmlparser/preparex.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/htmlparser/progress.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/htmlparser/scraper.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/py.typed +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/tomlop/__init__.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/tomlop/fileitem.py +0 -0
- {yklibpy-0.2.0 → yklibpy-0.2.4}/src/yklibpy/tomlop/tomlop.py +0 -0
yklibpy-0.2.4/CLAUDE.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
yklibpy is a Python utility library focused on HTML parsing/scraping, data format conversion (TOML/YAML), and application storage management. It targets Python 3.14+ and uses `uv` for dependency management with `hatchling` as the build backend.
|
|
8
|
+
|
|
9
|
+
## Development Commands
|
|
10
|
+
|
|
11
|
+
### Package Management
|
|
12
|
+
- Install dependencies: `uv sync`
|
|
13
|
+
- Add dependency: `uv add <package>`
|
|
14
|
+
- Add dev dependency: `uv add --dev <package>`
|
|
15
|
+
|
|
16
|
+
### Code Quality
|
|
17
|
+
- Format code: `black src/`
|
|
18
|
+
- Lint code: `ruff check src/`
|
|
19
|
+
- Type check: `mypy src/yklibpy`
|
|
20
|
+
- Configuration is split between `pyproject.toml` (strict mode, Python 3.14) and `mypy.ini` (module-specific settings with namespace packages enabled)
|
|
21
|
+
- Type checking uses strict mode by default
|
|
22
|
+
|
|
23
|
+
### Building and Testing
|
|
24
|
+
- Build package: `uv build` or `hatch build`
|
|
25
|
+
- Run tests: `pytest` (test directory: `tests/`, configured in pyproject.toml)
|
|
26
|
+
- Run a single test: `pytest tests/test_foo.py` or `pytest tests/test_foo.py::test_bar`
|
|
27
|
+
- Run with coverage: `pytest --cov`
|
|
28
|
+
|
|
29
|
+
### Publishing
|
|
30
|
+
- Build distribution: `python -m build`
|
|
31
|
+
- Upload to PyPI: `twine upload dist/*`
|
|
32
|
+
|
|
33
|
+
## Architecture
|
|
34
|
+
|
|
35
|
+
### Module Structure (`src/yklibpy/`)
|
|
36
|
+
|
|
37
|
+
The library is organized into six modules:
|
|
38
|
+
|
|
39
|
+
#### 1. `common/` - Core Utilities
|
|
40
|
+
- `Env`: Configuration and path management from YAML files, extracts scraper modes and base paths
|
|
41
|
+
- `Info`: Data container for parsed HTML information
|
|
42
|
+
- `Util`: General utilities including file operations and encoding detection
|
|
43
|
+
- `UtilYaml`/`UtilJson`: YAML/JSON operations with custom tag registration support
|
|
44
|
+
- `SafeDict`: Safe dictionary wrapper with type checking
|
|
45
|
+
- `Timex`: Timezone-aware timestamp utility (JST)
|
|
46
|
+
|
|
47
|
+
#### 2. `htmlparser/` - Web Scraping Framework
|
|
48
|
+
- **Base Class**: `Scraper` - core scraping logic with link extraction and deduplication
|
|
49
|
+
- **Concrete Scrapers**: `UdemyScraper`, `KUScraper`, `AmazonSavedCartScraper`, `FanzaDoujinPurchasedScraper`, `FanzaDoujinBasketScraper`
|
|
50
|
+
- **App**: Factory/orchestrator that creates the appropriate scraper based on a mode string from configuration. Processes HTML via BeautifulSoup (bs4 + html5lib parser, not lxml).
|
|
51
|
+
- **Supporting**: `HtmlOp`, `Preparex`, `Progress`, and `misc/` helpers (`AnchorTagInfo`, `AnchorTagx`, `PriceInfo`, `Tagx`)
|
|
52
|
+
|
|
53
|
+
#### 3. `tomlop/` - TOML/YAML Conversion
|
|
54
|
+
- `Tomlop`: Bidirectional TOML ↔ YAML conversion with deep dictionary comparison
|
|
55
|
+
- `FileItem`: File metadata and operations wrapper
|
|
56
|
+
|
|
57
|
+
#### 4. `db/` - Database and Storage Abstraction
|
|
58
|
+
- `DbBase`/`DbYaml`: YAML-backed key-value store with `chardet` encoding detection and custom YAML tag constructors
|
|
59
|
+
- `Storex`: File-backed storage supporting YAML, JSON, and plain text formats with auto-creation of parent directories
|
|
60
|
+
- `AppStore`: Cross-platform config/data file manager using OS conventions (APPDATA/LOCALAPPDATA on Windows, XDG on Unix)
|
|
61
|
+
|
|
62
|
+
#### 5. `cli/` - CLI Framework
|
|
63
|
+
- `Cli`: argparse wrapper for building command-line interfaces
|
|
64
|
+
|
|
65
|
+
#### 6. `command/` - Command Execution
|
|
66
|
+
- `Command`: Subprocess runner with timeout support and output capture, plus `array_to_dict` utility
|
|
67
|
+
|
|
68
|
+
#### 7. `config/` - Application Configuration
|
|
69
|
+
- `AppConfig`: File type constants, file association mappings, and default field definitions for config/db files
|
|
70
|
+
|
|
71
|
+
### Key Patterns
|
|
72
|
+
|
|
73
|
+
**Scraper Pattern**: All scrapers inherit from `Scraper` and implement site-specific parsing. `App` is the factory that selects the scraper via a mode string from YAML config.
|
|
74
|
+
|
|
75
|
+
**Storage Pattern**: `AppConfig` defines file associations (config vs db, YAML vs JSON) → `AppStore` resolves platform-specific paths → `Storex` handles file I/O. Config files go to APPDATA/%XDG_CONFIG_HOME, data files go to LOCALAPPDATA/XDG_DATA_HOME.
|
|
76
|
+
|
|
77
|
+
**Entry Points**: Multiple CLI entry points in pyproject.toml under `[project.scripts]` for scrapers, TOML tools, and DB utilities.
|
|
78
|
+
|
|
79
|
+
## Important Notes
|
|
80
|
+
|
|
81
|
+
### Type Annotations
|
|
82
|
+
- Strict mypy checking enabled
|
|
83
|
+
- Uses modern Python 3.14+ type syntax: `dict[str, Any]` not `Dict`, `X | None` not `Optional[X]`
|
|
84
|
+
|
|
85
|
+
### Encoding
|
|
86
|
+
- Uses `chardet` to detect file encodings with explicit encoding on all file operations
|
|
87
|
+
- Falls back to default encoding when detection fails
|
|
88
|
+
|
|
89
|
+
### Ruff Configuration
|
|
90
|
+
- Ignores E501 (line length) — no line length enforcement
|
|
91
|
+
- Checks: E (pycodestyle errors), F (pyflakes), I (isort), N (naming)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from yklibpy.db.appstore import AppStore
|
|
5
|
+
|
|
6
|
+
class Cli:
|
|
7
|
+
def __init__(self, help_text: str) -> None:
|
|
8
|
+
self.parser = argparse.ArgumentParser(
|
|
9
|
+
description=help_text
|
|
10
|
+
)
|
|
11
|
+
self.args = None
|
|
12
|
+
|
|
13
|
+
def get_parser(self) -> argparse.ArgumentParser:
|
|
14
|
+
return self.parser
|
|
15
|
+
|
|
16
|
+
def get_args(self) -> argparse.Namespace:
|
|
17
|
+
return self.args
|
|
18
|
+
|
|
19
|
+
def parse_args(self):
|
|
20
|
+
self.args = self.parser.parse_args()
|
|
21
|
+
return self.args
|
|
22
|
+
|
|
23
|
+
def get_subparsers(self, name: str) -> argparse.ArgumentParser:
|
|
24
|
+
self.subparsers = self.parser.add_subparsers(dest=name, required=True)
|
|
25
|
+
return self.subparsers
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import subprocess
|
|
3
|
+
from typing import Any, Optional
|
|
4
|
+
|
|
5
|
+
class Command:
|
|
6
|
+
def __init__():
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
def run_command(
|
|
10
|
+
self,
|
|
11
|
+
command: str | list[str],
|
|
12
|
+
shell: bool = False,
|
|
13
|
+
encoding: str = "utf-8",
|
|
14
|
+
timeout: Optional[int] = None,
|
|
15
|
+
) -> tuple[str, int]:
|
|
16
|
+
"""
|
|
17
|
+
コマンドラインを実行して、標準出力への出力を文字列として受け取る。
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
command: 実行するコマンド(文字列またはリスト)
|
|
21
|
+
shell: shell経由で実行するかどうか(デフォルト: False)
|
|
22
|
+
encoding: 出力のエンコーディング(デフォルト: utf-8)
|
|
23
|
+
timeout: タイムアウト秒数(デフォルト: None)
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
(標準出力の文字列, 終了コード) のタプル
|
|
27
|
+
|
|
28
|
+
Raises:
|
|
29
|
+
subprocess.TimeoutExpired: タイムアウトが発生した場合
|
|
30
|
+
subprocess.SubprocessError: その他のサブプロセスエラー
|
|
31
|
+
|
|
32
|
+
Example:
|
|
33
|
+
>>> ghprj = Ghprj()
|
|
34
|
+
>>> output, return_code = ghprj.run_command("echo hello")
|
|
35
|
+
>>> print(output) # "hello\\n"
|
|
36
|
+
>>> print(return_code) # 0
|
|
37
|
+
"""
|
|
38
|
+
try:
|
|
39
|
+
result = subprocess.run(
|
|
40
|
+
command,
|
|
41
|
+
shell=shell,
|
|
42
|
+
capture_output=True,
|
|
43
|
+
text=True,
|
|
44
|
+
encoding=encoding,
|
|
45
|
+
timeout=timeout,
|
|
46
|
+
)
|
|
47
|
+
return result.stdout, result.returncode
|
|
48
|
+
except subprocess.TimeoutExpired as e:
|
|
49
|
+
timeout_float = float(timeout) if timeout is not None else float(0)
|
|
50
|
+
raise subprocess.TimeoutExpired(
|
|
51
|
+
cmd=command,
|
|
52
|
+
timeout=timeout_float,
|
|
53
|
+
output=e.stdout.decode(encoding) if e.stdout else "",
|
|
54
|
+
stderr=e.stderr.decode(encoding) if e.stderr else "",
|
|
55
|
+
)
|
|
56
|
+
except subprocess.SubprocessError:
|
|
57
|
+
raise
|
|
58
|
+
|
|
59
|
+
def run_command_simple(self, command: str | list[str], shell: bool = False) -> str:
|
|
60
|
+
"""
|
|
61
|
+
コマンドラインを実行して、標準出力への出力を文字列として受け取る(シンプル版)。
|
|
62
|
+
エラー時は例外を発生させる。
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
command: 実行するコマンド(文字列またはリスト)
|
|
66
|
+
shell: shell経由で実行するかどうか(デフォルト: False)
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
標準出力の文字列
|
|
70
|
+
|
|
71
|
+
Raises:
|
|
72
|
+
subprocess.CalledProcessError: コマンドが非ゼロの終了コードで終了した場合
|
|
73
|
+
|
|
74
|
+
Example:
|
|
75
|
+
>>> ghprj = Ghprj()
|
|
76
|
+
>>> output = ghprj.run_command_simple("echo hello")
|
|
77
|
+
>>> print(output) # "hello\\n"
|
|
78
|
+
"""
|
|
79
|
+
try:
|
|
80
|
+
result = subprocess.run(
|
|
81
|
+
command,
|
|
82
|
+
shell=shell,
|
|
83
|
+
capture_output=True,
|
|
84
|
+
text=True,
|
|
85
|
+
check=True,
|
|
86
|
+
encoding="utf-8",
|
|
87
|
+
)
|
|
88
|
+
return result.stdout
|
|
89
|
+
except subprocess.CalledProcessError as e:
|
|
90
|
+
logging.exception(e)
|
|
91
|
+
'''
|
|
92
|
+
raise subprocess.CalledProcessError(
|
|
93
|
+
returncode=e.returncode,
|
|
94
|
+
cmd=command,
|
|
95
|
+
output=e.stdout.decode("utf-8") if e.stdout else "",
|
|
96
|
+
stderr=e.stderr.decode("utf-8") if e.stderr else "",
|
|
97
|
+
)
|
|
98
|
+
'''
|
|
99
|
+
|
|
100
|
+
def array_to_dict(
|
|
101
|
+
self, data: list[dict[str, Any]], key: str
|
|
102
|
+
) -> dict[str, dict[str, Any]]:
|
|
103
|
+
"""
|
|
104
|
+
JSON形式文字列の配列から、指定文字列をキーとする連想配列に変換する。
|
|
105
|
+
|
|
106
|
+
Args:
|
|
107
|
+
data: 辞書のリスト(JSON配列をパースしたもの)
|
|
108
|
+
key: 連想配列のキーとして使用するフィールド名
|
|
109
|
+
|
|
110
|
+
Returns:
|
|
111
|
+
指定したキーをキーとし、元の要素を値とする連想配列(辞書)
|
|
112
|
+
|
|
113
|
+
Raises:
|
|
114
|
+
KeyError: 指定したキーが要素に存在しない場合
|
|
115
|
+
TypeError: 要素が辞書でない場合
|
|
116
|
+
|
|
117
|
+
Example:
|
|
118
|
+
>>> ghprj = Ghprj()
|
|
119
|
+
>>> data = [
|
|
120
|
+
... {"name": "repo1", "url": "https://example.com/repo1"},
|
|
121
|
+
... {"name": "repo2", "url": "https://example.com/repo2"}
|
|
122
|
+
... ]
|
|
123
|
+
>>> result = ghprj.array_to_dict(data, "name")
|
|
124
|
+
>>> print(result["repo1"]) # {"name": "repo1", "url": "https://example.com/repo1"}
|
|
125
|
+
"""
|
|
126
|
+
result: dict[str, dict[str, Any]] = {}
|
|
127
|
+
for item in data:
|
|
128
|
+
if not isinstance(item, dict):
|
|
129
|
+
raise TypeError(
|
|
130
|
+
f"配列の要素は辞書である必要があります。現在の型: {type(item).__name__}"
|
|
131
|
+
)
|
|
132
|
+
if key not in item:
|
|
133
|
+
raise KeyError(
|
|
134
|
+
f"キー '{key}' が要素に存在しません。要素のキー: {list(item.keys())}"
|
|
135
|
+
)
|
|
136
|
+
key_value = item[key]
|
|
137
|
+
if not isinstance(key_value, (str, int, float, bool)) or key_value is None:
|
|
138
|
+
raise ValueError(
|
|
139
|
+
f"キー '{key}' の値は文字列、数値、真偽値である必要があります。現在の型: {type(key_value).__name__}"
|
|
140
|
+
)
|
|
141
|
+
result[str(key_value)] = item
|
|
142
|
+
|
|
143
|
+
return result
|
|
@@ -4,8 +4,9 @@ from yklibpy.common.util import Util
|
|
|
4
4
|
from yklibpy.common.util_yaml import UtilYaml
|
|
5
5
|
from yklibpy.common.util_json import UtilJson
|
|
6
6
|
from yklibpy.common.safedict import SafeDict
|
|
7
|
+
from yklibpy.common.timex import Timex
|
|
7
8
|
|
|
8
|
-
__all__ = ["Env", "Info", "Util", "UtilYaml", "UtilJson", "SafeDict"]
|
|
9
|
+
__all__ = ["Env", "Info", "Util", "UtilYaml", "UtilJson", "SafeDict", "Timex"]
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
def xmain() -> str:
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
from yklibpy.config.appconfig import AppConfig
|
|
2
|
-
|
|
3
|
-
__all__ = ["AppConfig"]
|
|
1
|
+
from yklibpy.config.appconfig import AppConfig
|
|
2
|
+
|
|
3
|
+
__all__ = ["AppConfig"]
|
|
@@ -35,6 +35,18 @@ class AppStore:
|
|
|
35
35
|
"file"
|
|
36
36
|
].load()
|
|
37
37
|
|
|
38
|
+
def show(self, kind: str, base_name: get_store) -> None:
|
|
39
|
+
dict_x = self.assoc[kind][base_name]["value"]
|
|
40
|
+
for key in dict_x.keys():
|
|
41
|
+
print( f'key={key}' )
|
|
42
|
+
print( dict_x[key])
|
|
43
|
+
|
|
44
|
+
def show_config(self, base_name: str) -> None:
|
|
45
|
+
self.show("config", base_name)
|
|
46
|
+
|
|
47
|
+
def show_db(self, base_name: str) -> None:
|
|
48
|
+
self.show("db", base_name)
|
|
49
|
+
|
|
38
50
|
def get_assoc_from_config(self, base_name: str) -> Any:
|
|
39
51
|
return self.assoc["config"][base_name]["value"]
|
|
40
52
|
|
|
@@ -118,3 +130,15 @@ class AppStore:
|
|
|
118
130
|
|
|
119
131
|
def output_db(self, key: str, data: dict[str, Any]) -> None:
|
|
120
132
|
self.assoc["db"][key]["file"].output(data)
|
|
133
|
+
|
|
134
|
+
def show(self, kind: str, base_name: str) -> None:
|
|
135
|
+
dict_x = self.assoc[kind][base_name]["value"]
|
|
136
|
+
for key in dict_x.keys():
|
|
137
|
+
print( f'key={key}' )
|
|
138
|
+
print( dict_x[key])
|
|
139
|
+
|
|
140
|
+
def show_config(self, base_name: str) -> None:
|
|
141
|
+
self.show("config", base_name)
|
|
142
|
+
|
|
143
|
+
def show_db(self, base_name: str) -> None:
|
|
144
|
+
self.show("db", base_name)
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import json
|
|
2
|
-
import yaml
|
|
3
1
|
from pathlib import Path
|
|
4
2
|
from typing import Any
|
|
3
|
+
import yaml
|
|
4
|
+
import json
|
|
5
5
|
|
|
6
6
|
from yklibpy.config.appconfig import AppConfig
|
|
7
|
-
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
import yaml
|
|
8
9
|
|
|
9
10
|
class Storex:
|
|
10
11
|
_file_type_dict: dict[str, str] = {}
|
|
@@ -199,46 +199,46 @@ wheels = [
|
|
|
199
199
|
|
|
200
200
|
[[package]]
|
|
201
201
|
name = "cryptography"
|
|
202
|
-
version = "46.0.
|
|
202
|
+
version = "46.0.5"
|
|
203
203
|
source = { registry = "https://pypi.org/simple" }
|
|
204
204
|
dependencies = [
|
|
205
205
|
{ name = "cffi", marker = "platform_python_implementation != 'PyPy'" },
|
|
206
206
|
]
|
|
207
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
208
|
-
wheels = [
|
|
209
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
210
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
211
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
212
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
213
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
214
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
215
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
216
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
217
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
218
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
219
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
220
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
221
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
222
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
223
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
224
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
225
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
226
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
227
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
228
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
229
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
230
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
231
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
232
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
233
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
234
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
235
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
236
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
237
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
238
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
239
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
240
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
241
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
207
|
+
sdist = { url = "https://files.pythonhosted.org/packages/60/04/ee2a9e8542e4fa2773b81771ff8349ff19cdd56b7258a0cc442639052edb/cryptography-46.0.5.tar.gz", hash = "sha256:abace499247268e3757271b2f1e244b36b06f8515cf27c4d49468fc9eb16e93d", size = 750064, upload-time = "2026-02-10T19:18:38.255Z" }
|
|
208
|
+
wheels = [
|
|
209
|
+
{ url = "https://files.pythonhosted.org/packages/ff/9e/6b4397a3e3d15123de3b1806ef342522393d50736c13b20ec4c9ea6693a6/cryptography-46.0.5-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:c18ff11e86df2e28854939acde2d003f7984f721eba450b56a200ad90eeb0e6b", size = 4275637, upload-time = "2026-02-10T19:17:10.53Z" },
|
|
210
|
+
{ url = "https://files.pythonhosted.org/packages/63/e7/471ab61099a3920b0c77852ea3f0ea611c9702f651600397ac567848b897/cryptography-46.0.5-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:4d7e3d356b8cd4ea5aff04f129d5f66ebdc7b6f8eae802b93739ed520c47c79b", size = 4424742, upload-time = "2026-02-10T19:17:12.388Z" },
|
|
211
|
+
{ url = "https://files.pythonhosted.org/packages/37/53/a18500f270342d66bf7e4d9f091114e31e5ee9e7375a5aba2e85a91e0044/cryptography-46.0.5-cp311-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:50bfb6925eff619c9c023b967d5b77a54e04256c4281b0e21336a130cd7fc263", size = 4277528, upload-time = "2026-02-10T19:17:13.853Z" },
|
|
212
|
+
{ url = "https://files.pythonhosted.org/packages/22/29/c2e812ebc38c57b40e7c583895e73c8c5adb4d1e4a0cc4c5a4fdab2b1acc/cryptography-46.0.5-cp311-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:803812e111e75d1aa73690d2facc295eaefd4439be1023fefc4995eaea2af90d", size = 4947993, upload-time = "2026-02-10T19:17:15.618Z" },
|
|
213
|
+
{ url = "https://files.pythonhosted.org/packages/6b/e7/237155ae19a9023de7e30ec64e5d99a9431a567407ac21170a046d22a5a3/cryptography-46.0.5-cp311-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:3ee190460e2fbe447175cda91b88b84ae8322a104fc27766ad09428754a618ed", size = 4456855, upload-time = "2026-02-10T19:17:17.221Z" },
|
|
214
|
+
{ url = "https://files.pythonhosted.org/packages/2d/87/fc628a7ad85b81206738abbd213b07702bcbdada1dd43f72236ef3cffbb5/cryptography-46.0.5-cp311-abi3-manylinux_2_31_armv7l.whl", hash = "sha256:f145bba11b878005c496e93e257c1e88f154d278d2638e6450d17e0f31e558d2", size = 3984635, upload-time = "2026-02-10T19:17:18.792Z" },
|
|
215
|
+
{ url = "https://files.pythonhosted.org/packages/84/29/65b55622bde135aedf4565dc509d99b560ee4095e56989e815f8fd2aa910/cryptography-46.0.5-cp311-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:e9251e3be159d1020c4030bd2e5f84d6a43fe54b6c19c12f51cde9542a2817b2", size = 4277038, upload-time = "2026-02-10T19:17:20.256Z" },
|
|
216
|
+
{ url = "https://files.pythonhosted.org/packages/bc/36/45e76c68d7311432741faf1fbf7fac8a196a0a735ca21f504c75d37e2558/cryptography-46.0.5-cp311-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:47fb8a66058b80e509c47118ef8a75d14c455e81ac369050f20ba0d23e77fee0", size = 4912181, upload-time = "2026-02-10T19:17:21.825Z" },
|
|
217
|
+
{ url = "https://files.pythonhosted.org/packages/6d/1a/c1ba8fead184d6e3d5afcf03d569acac5ad063f3ac9fb7258af158f7e378/cryptography-46.0.5-cp311-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:4c3341037c136030cb46e4b1e17b7418ea4cbd9dd207e4a6f3b2b24e0d4ac731", size = 4456482, upload-time = "2026-02-10T19:17:25.133Z" },
|
|
218
|
+
{ url = "https://files.pythonhosted.org/packages/f9/e5/3fb22e37f66827ced3b902cf895e6a6bc1d095b5b26be26bd13c441fdf19/cryptography-46.0.5-cp311-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:890bcb4abd5a2d3f852196437129eb3667d62630333aacc13dfd470fad3aaa82", size = 4405497, upload-time = "2026-02-10T19:17:26.66Z" },
|
|
219
|
+
{ url = "https://files.pythonhosted.org/packages/1a/df/9d58bb32b1121a8a2f27383fabae4d63080c7ca60b9b5c88be742be04ee7/cryptography-46.0.5-cp311-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:80a8d7bfdf38f87ca30a5391c0c9ce4ed2926918e017c29ddf643d0ed2778ea1", size = 4667819, upload-time = "2026-02-10T19:17:28.569Z" },
|
|
220
|
+
{ url = "https://files.pythonhosted.org/packages/67/c8/581a6702e14f0898a0848105cbefd20c058099e2c2d22ef4e476dfec75d7/cryptography-46.0.5-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:5be7bf2fb40769e05739dd0046e7b26f9d4670badc7b032d6ce4db64dddc0678", size = 4265728, upload-time = "2026-02-10T19:17:35.569Z" },
|
|
221
|
+
{ url = "https://files.pythonhosted.org/packages/dd/4a/ba1a65ce8fc65435e5a849558379896c957870dd64fecea97b1ad5f46a37/cryptography-46.0.5-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:fe346b143ff9685e40192a4960938545c699054ba11d4f9029f94751e3f71d87", size = 4408287, upload-time = "2026-02-10T19:17:36.938Z" },
|
|
222
|
+
{ url = "https://files.pythonhosted.org/packages/f8/67/8ffdbf7b65ed1ac224d1c2df3943553766914a8ca718747ee3871da6107e/cryptography-46.0.5-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:c69fd885df7d089548a42d5ec05be26050ebcd2283d89b3d30676eb32ff87dee", size = 4270291, upload-time = "2026-02-10T19:17:38.748Z" },
|
|
223
|
+
{ url = "https://files.pythonhosted.org/packages/f8/e5/f52377ee93bc2f2bba55a41a886fd208c15276ffbd2569f2ddc89d50e2c5/cryptography-46.0.5-cp314-cp314t-manylinux_2_28_ppc64le.whl", hash = "sha256:8293f3dea7fc929ef7240796ba231413afa7b68ce38fd21da2995549f5961981", size = 4927539, upload-time = "2026-02-10T19:17:40.241Z" },
|
|
224
|
+
{ url = "https://files.pythonhosted.org/packages/3b/02/cfe39181b02419bbbbcf3abdd16c1c5c8541f03ca8bda240debc467d5a12/cryptography-46.0.5-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:1abfdb89b41c3be0365328a410baa9df3ff8a9110fb75e7b52e66803ddabc9a9", size = 4442199, upload-time = "2026-02-10T19:17:41.789Z" },
|
|
225
|
+
{ url = "https://files.pythonhosted.org/packages/c0/96/2fcaeb4873e536cf71421a388a6c11b5bc846e986b2b069c79363dc1648e/cryptography-46.0.5-cp314-cp314t-manylinux_2_31_armv7l.whl", hash = "sha256:d66e421495fdb797610a08f43b05269e0a5ea7f5e652a89bfd5a7d3c1dee3648", size = 3960131, upload-time = "2026-02-10T19:17:43.379Z" },
|
|
226
|
+
{ url = "https://files.pythonhosted.org/packages/d8/d2/b27631f401ddd644e94c5cf33c9a4069f72011821cf3dc7309546b0642a0/cryptography-46.0.5-cp314-cp314t-manylinux_2_34_aarch64.whl", hash = "sha256:4e817a8920bfbcff8940ecfd60f23d01836408242b30f1a708d93198393a80b4", size = 4270072, upload-time = "2026-02-10T19:17:45.481Z" },
|
|
227
|
+
{ url = "https://files.pythonhosted.org/packages/f4/a7/60d32b0370dae0b4ebe55ffa10e8599a2a59935b5ece1b9f06edb73abdeb/cryptography-46.0.5-cp314-cp314t-manylinux_2_34_ppc64le.whl", hash = "sha256:68f68d13f2e1cb95163fa3b4db4bf9a159a418f5f6e7242564fc75fcae667fd0", size = 4892170, upload-time = "2026-02-10T19:17:46.997Z" },
|
|
228
|
+
{ url = "https://files.pythonhosted.org/packages/d2/b9/cf73ddf8ef1164330eb0b199a589103c363afa0cf794218c24d524a58eab/cryptography-46.0.5-cp314-cp314t-manylinux_2_34_x86_64.whl", hash = "sha256:a3d1fae9863299076f05cb8a778c467578262fae09f9dc0ee9b12eb4268ce663", size = 4441741, upload-time = "2026-02-10T19:17:48.661Z" },
|
|
229
|
+
{ url = "https://files.pythonhosted.org/packages/5f/eb/eee00b28c84c726fe8fa0158c65afe312d9c3b78d9d01daf700f1f6e37ff/cryptography-46.0.5-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:c4143987a42a2397f2fc3b4d7e3a7d313fbe684f67ff443999e803dd75a76826", size = 4396728, upload-time = "2026-02-10T19:17:50.058Z" },
|
|
230
|
+
{ url = "https://files.pythonhosted.org/packages/65/f4/6bc1a9ed5aef7145045114b75b77c2a8261b4d38717bd8dea111a63c3442/cryptography-46.0.5-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:7d731d4b107030987fd61a7f8ab512b25b53cef8f233a97379ede116f30eb67d", size = 4652001, upload-time = "2026-02-10T19:17:51.54Z" },
|
|
231
|
+
{ url = "https://files.pythonhosted.org/packages/0f/04/c85bdeab78c8bc77b701bf0d9bdcf514c044e18a46dcff330df5448631b0/cryptography-46.0.5-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:7d1f30a86d2757199cb2d56e48cce14deddf1f9c95f1ef1b64ee91ea43fe2e18", size = 4275349, upload-time = "2026-02-10T19:17:58.419Z" },
|
|
232
|
+
{ url = "https://files.pythonhosted.org/packages/5c/32/9b87132a2f91ee7f5223b091dc963055503e9b442c98fc0b8a5ca765fab0/cryptography-46.0.5-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:039917b0dc418bb9f6edce8a906572d69e74bd330b0b3fea4f79dab7f8ddd235", size = 4420667, upload-time = "2026-02-10T19:18:00.619Z" },
|
|
233
|
+
{ url = "https://files.pythonhosted.org/packages/a1/a6/a7cb7010bec4b7c5692ca6f024150371b295ee1c108bdc1c400e4c44562b/cryptography-46.0.5-cp38-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:ba2a27ff02f48193fc4daeadf8ad2590516fa3d0adeeb34336b96f7fa64c1e3a", size = 4276980, upload-time = "2026-02-10T19:18:02.379Z" },
|
|
234
|
+
{ url = "https://files.pythonhosted.org/packages/8e/7c/c4f45e0eeff9b91e3f12dbd0e165fcf2a38847288fcfd889deea99fb7b6d/cryptography-46.0.5-cp38-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:61aa400dce22cb001a98014f647dc21cda08f7915ceb95df0c9eaf84b4b6af76", size = 4939143, upload-time = "2026-02-10T19:18:03.964Z" },
|
|
235
|
+
{ url = "https://files.pythonhosted.org/packages/37/19/e1b8f964a834eddb44fa1b9a9976f4e414cbb7aa62809b6760c8803d22d1/cryptography-46.0.5-cp38-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:3ce58ba46e1bc2aac4f7d9290223cead56743fa6ab94a5d53292ffaac6a91614", size = 4453674, upload-time = "2026-02-10T19:18:05.588Z" },
|
|
236
|
+
{ url = "https://files.pythonhosted.org/packages/db/ed/db15d3956f65264ca204625597c410d420e26530c4e2943e05a0d2f24d51/cryptography-46.0.5-cp38-abi3-manylinux_2_31_armv7l.whl", hash = "sha256:420d0e909050490d04359e7fdb5ed7e667ca5c3c402b809ae2563d7e66a92229", size = 3978801, upload-time = "2026-02-10T19:18:07.167Z" },
|
|
237
|
+
{ url = "https://files.pythonhosted.org/packages/41/e2/df40a31d82df0a70a0daf69791f91dbb70e47644c58581d654879b382d11/cryptography-46.0.5-cp38-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:582f5fcd2afa31622f317f80426a027f30dc792e9c80ffee87b993200ea115f1", size = 4276755, upload-time = "2026-02-10T19:18:09.813Z" },
|
|
238
|
+
{ url = "https://files.pythonhosted.org/packages/33/45/726809d1176959f4a896b86907b98ff4391a8aa29c0aaaf9450a8a10630e/cryptography-46.0.5-cp38-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:bfd56bb4b37ed4f330b82402f6f435845a5f5648edf1ad497da51a8452d5d62d", size = 4901539, upload-time = "2026-02-10T19:18:11.263Z" },
|
|
239
|
+
{ url = "https://files.pythonhosted.org/packages/99/0f/a3076874e9c88ecb2ecc31382f6e7c21b428ede6f55aafa1aa272613e3cd/cryptography-46.0.5-cp38-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:a3d507bb6a513ca96ba84443226af944b0f7f47dcc9a399d110cd6146481d24c", size = 4452794, upload-time = "2026-02-10T19:18:12.914Z" },
|
|
240
|
+
{ url = "https://files.pythonhosted.org/packages/02/ef/ffeb542d3683d24194a38f66ca17c0a4b8bf10631feef44a7ef64e631b1a/cryptography-46.0.5-cp38-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:9f16fbdf4da055efb21c22d81b89f155f02ba420558db21288b3d0035bafd5f4", size = 4404160, upload-time = "2026-02-10T19:18:14.375Z" },
|
|
241
|
+
{ url = "https://files.pythonhosted.org/packages/96/93/682d2b43c1d5f1406ed048f377c0fc9fc8f7b0447a478d5c65ab3d3a66eb/cryptography-46.0.5-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:ced80795227d70549a411a4ab66e8ce307899fad2220ce5ab2f296e687eacde9", size = 4667123, upload-time = "2026-02-10T19:18:15.886Z" },
|
|
242
242
|
]
|
|
243
243
|
|
|
244
244
|
[[package]]
|
|
@@ -1026,7 +1026,7 @@ wheels = [
|
|
|
1026
1026
|
|
|
1027
1027
|
[[package]]
|
|
1028
1028
|
name = "yklibpy"
|
|
1029
|
-
version = "0.
|
|
1029
|
+
version = "0.2.4"
|
|
1030
1030
|
source = { editable = "." }
|
|
1031
1031
|
dependencies = [
|
|
1032
1032
|
{ name = "bs4" },
|
yklibpy-0.2.0/CLAUDE.md
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
2
|
-
|
|
3
|
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
-
|
|
5
|
-
## Project Overview
|
|
6
|
-
|
|
7
|
-
yklibpy is a Python utility library focused on HTML parsing/scraping and data format conversion (TOML/YAML). It targets Python 3.14+ and uses `uv` for dependency management with `hatchling` as the build backend.
|
|
8
|
-
|
|
9
|
-
## Development Commands
|
|
10
|
-
|
|
11
|
-
### Package Management
|
|
12
|
-
- Install dependencies: `uv sync`
|
|
13
|
-
- Add dependency: `uv add <package>`
|
|
14
|
-
- Add dev dependency: `uv add --dev <package>`
|
|
15
|
-
|
|
16
|
-
### Code Quality
|
|
17
|
-
- Format code: `black src/`
|
|
18
|
-
- Lint code: `ruff check src/`
|
|
19
|
-
- Type check: `mypy src/yklibpy`
|
|
20
|
-
- Configuration is split between `pyproject.toml` (strict mode, Python 3.14) and `mypy.ini` (module-specific settings)
|
|
21
|
-
- Type checking uses strict mode by default
|
|
22
|
-
|
|
23
|
-
### Building and Testing
|
|
24
|
-
- Build package: `uv build` or `hatch build`
|
|
25
|
-
- Run tests: `pytest` (test directory: `tests/`, configured in pyproject.toml)
|
|
26
|
-
- Run with coverage: `pytest --cov`
|
|
27
|
-
|
|
28
|
-
### Publishing
|
|
29
|
-
- Build distribution: `python -m build`
|
|
30
|
-
- Upload to PyPI: `twine upload dist/*`
|
|
31
|
-
|
|
32
|
-
## Architecture
|
|
33
|
-
|
|
34
|
-
### Module Structure
|
|
35
|
-
|
|
36
|
-
The library is organized into four main modules:
|
|
37
|
-
|
|
38
|
-
#### 1. `common/` - Core Utilities
|
|
39
|
-
- `Env`: Configuration and path management from YAML files, extracts scraper modes and base paths
|
|
40
|
-
- `Info`: Data container for parsed HTML information
|
|
41
|
-
- `Util`: General utilities including file operations and encoding detection
|
|
42
|
-
- `UtilYaml`: YAML operations with custom tag registration support
|
|
43
|
-
- `UtilJson`: JSON operations
|
|
44
|
-
- `SafeDict`: Safe dictionary wrapper with type checking
|
|
45
|
-
|
|
46
|
-
#### 2. `htmlparser/` - Web Scraping Framework
|
|
47
|
-
Base scraper pattern with site-specific implementations:
|
|
48
|
-
|
|
49
|
-
- **Base Class**: `Scraper` - provides core scraping logic with link extraction and deduplication
|
|
50
|
-
- **Concrete Scrapers**:
|
|
51
|
-
- `UdemyScraper`: Udemy course pages
|
|
52
|
-
- `KUScraper`: KU (Kindle Unlimited) content
|
|
53
|
-
- `AmazonSavedCartScraper`: Amazon saved cart items
|
|
54
|
-
- `FanzaDoujinPurchasedScraper`: Fanza purchased doujin content
|
|
55
|
-
- `FanzaDoujinBasketScraper`: Fanza basket/cart items
|
|
56
|
-
|
|
57
|
-
- **App**: Factory/orchestrator that creates appropriate scraper based on mode string
|
|
58
|
-
- Uses `Env` to load configuration and determine scraper mode
|
|
59
|
-
- Processes HTML files via BeautifulSoup (bs4 + html5lib)
|
|
60
|
-
- Maintains link collections with sequence tracking for deduplication
|
|
61
|
-
|
|
62
|
-
- **Supporting Classes**:
|
|
63
|
-
- `HtmlOp`: HTML operations and manipulation
|
|
64
|
-
- `Preparex`: Preparation/preprocessing logic
|
|
65
|
-
- `Progress`: Progress tracking
|
|
66
|
-
- `misc/`: Miscellaneous helpers like `AnchorTagInfo`
|
|
67
|
-
|
|
68
|
-
#### 3. `tomlop/` - TOML/YAML Conversion
|
|
69
|
-
- `Tomlop`: Bidirectional TOML ↔ YAML conversion with deep dictionary comparison
|
|
70
|
-
- `FileItem`: File metadata and operations wrapper
|
|
71
|
-
- Entry points: `toml2yaml`, `yaml2toml`, and various main functions
|
|
72
|
-
|
|
73
|
-
#### 4. `db/` - Database Abstraction
|
|
74
|
-
- `DbBase`: Base class for database operations
|
|
75
|
-
- `DbYaml`: YAML-backed key-value store with encoding detection
|
|
76
|
-
- Supports custom YAML tag constructors
|
|
77
|
-
- Automatic encoding detection via `chardet`
|
|
78
|
-
|
|
79
|
-
### Key Patterns
|
|
80
|
-
|
|
81
|
-
**Scraper Pattern**: All scrapers inherit from `Scraper` base class and implement site-specific parsing logic. The `App` class acts as a factory, creating the appropriate scraper based on a mode string from configuration.
|
|
82
|
-
|
|
83
|
-
**Configuration-Driven**: Uses YAML config files to specify base paths, patterns, and scraper modes. The `Env` class loads these and provides structured access.
|
|
84
|
-
|
|
85
|
-
**Link Deduplication**: Scrapers track links by ID with sequence numbers to avoid duplicates across multiple scrapes.
|
|
86
|
-
|
|
87
|
-
**Entry Points**: Multiple CLI entry points defined in pyproject.toml under `[project.scripts]` for different tools and scrapers.
|
|
88
|
-
|
|
89
|
-
## Important Notes
|
|
90
|
-
|
|
91
|
-
### Dependencies
|
|
92
|
-
- BeautifulSoup4 with html5lib parser (not lxml)
|
|
93
|
-
- PyYAML for configuration and data storage
|
|
94
|
-
- chardet for encoding detection
|
|
95
|
-
- TOML library for TOML operations
|
|
96
|
-
|
|
97
|
-
### Encoding
|
|
98
|
-
The codebase handles various encodings:
|
|
99
|
-
- Uses `chardet` to detect file encodings
|
|
100
|
-
- Falls back to default encoding when detection fails
|
|
101
|
-
- All file operations specify encoding explicitly
|
|
102
|
-
|
|
103
|
-
### Type Annotations
|
|
104
|
-
- Strict mypy checking enabled
|
|
105
|
-
- Uses modern Python 3.14+ type syntax (e.g., `dict[str, Any]` instead of `Dict`)
|
|
106
|
-
- Optional types use `| None` syntax instead of `Optional`
|
|
107
|
-
|
|
108
|
-
### YAML Custom Tags
|
|
109
|
-
The YAML utilities support custom tag registration for deserializing Python objects. Used in database operations for object persistence.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|