Skip to main content

将网页转换为 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

page2md-1.0.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

page2md-1.0.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

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

Hashes for page2md-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5cf05c11a76f1a430f48170b69c347c3786c3b46a5fa82d9975038547becec08
MD5 d07b6f12f36a0de57620a9577b86fa7e
BLAKE2b-256 accc8135c18848fca11d36a89fde5b4f7091445120c65629d7411727cea38a29

See more details on using hashes here.

Provenance

The following attestation bundles were made for page2md-1.0.0.tar.gz:

Publisher: python-publish.yml on morning-start/page2md

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for page2md-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f66d77e7d2b5129ab12941ab87433bb1fca1142c030d39e39fb7b5aaf52a330e
MD5 fa788b72054f8583d358397d15dbbeb8
BLAKE2b-256 59fc27681c2c3fccb07e5a500c598df71e7d89e592cf4847d3f0e6461b186200

See more details on using hashes here.

Provenance

The following attestation bundles were made for page2md-1.0.0-py3-none-any.whl:

Publisher: python-publish.yml on morning-start/page2md

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page