将网页转换为 Markdown 的 Python 库
Project description
page2md
将网页转换为 Markdown 的 Python 库。
安装
pip install page2md
快速开始
from page2md import HtmlToMarkdown
# 单个 URL 转换
crawler = HtmlToMarkdown("https://example.com")
results = crawler.run()
for url, result in results.items():
print(f"Title: {result.metadata.title}")
print(f"Content:\n{result.content}")
# 批量转换
crawler = HtmlToMarkdown([
"https://example.com/page1",
"https://example.com/page2"
])
results = crawler.run()
功能特性
- 支持单个或批量 URL 转换
- 使用 DrissionPage 渲染动态网页
- 支持自定义 CSS 选择器
- 支持增量爬取
- 完善的错误处理和重试机制
- 进度回调支持
配置选项
详细配置请参考 Config 模块src/page2md。
许可证
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file page2md-1.0.0.tar.gz.
File metadata
- Download URL: page2md-1.0.0.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cf05c11a76f1a430f48170b69c347c3786c3b46a5fa82d9975038547becec08
|
|
| MD5 |
d07b6f12f36a0de57620a9577b86fa7e
|
|
| BLAKE2b-256 |
accc8135c18848fca11d36a89fde5b4f7091445120c65629d7411727cea38a29
|
Provenance
The following attestation bundles were made for page2md-1.0.0.tar.gz:
Publisher:
python-publish.yml on morning-start/page2md
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
page2md-1.0.0.tar.gz -
Subject digest:
5cf05c11a76f1a430f48170b69c347c3786c3b46a5fa82d9975038547becec08 - Sigstore transparency entry: 983380092
- Sigstore integration time:
-
Permalink:
morning-start/page2md@679d50b0cee34d8ffe624e729ec15939123305ac -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/morning-start
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@679d50b0cee34d8ffe624e729ec15939123305ac -
Trigger Event:
push
-
Statement type:
File details
Details for the file page2md-1.0.0-py3-none-any.whl.
File metadata
- Download URL: page2md-1.0.0-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f66d77e7d2b5129ab12941ab87433bb1fca1142c030d39e39fb7b5aaf52a330e
|
|
| MD5 |
fa788b72054f8583d358397d15dbbeb8
|
|
| BLAKE2b-256 |
59fc27681c2c3fccb07e5a500c598df71e7d89e592cf4847d3f0e6461b186200
|
Provenance
The following attestation bundles were made for page2md-1.0.0-py3-none-any.whl:
Publisher:
python-publish.yml on morning-start/page2md
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
page2md-1.0.0-py3-none-any.whl -
Subject digest:
f66d77e7d2b5129ab12941ab87433bb1fca1142c030d39e39fb7b5aaf52a330e - Sigstore transparency entry: 983380096
- Sigstore integration time:
-
Permalink:
morning-start/page2md@679d50b0cee34d8ffe624e729ec15939123305ac -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/morning-start
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@679d50b0cee34d8ffe624e729ec15939123305ac -
Trigger Event:
push
-
Statement type: