Skip to main content

cubox

python get cubox article

demo.py

import os

from cubox import CuboxApi, CuboxOutput


def main():
    """Cubox导出Markdown示例"""

    # 初始化API客户端(替换为你的域名和API密钥)
    domain = "cubox.pro"  # 替换为实际域名
    api_key = "https://cubox.pro/c/api/save/xxxxxxxx"  # 替换为你的API密钥链接
    api = CuboxApi(domain, api_key)

    print("开始导出Cubox文章到Markdown...")

    has_more = True
    last_card_id = None
    last_card_update_time = None
    all_articles = []
    while has_more:
        # 可以自定义筛选条件,例如只获取特定标签或文件夹的文章
        articles, has_more = api.get_articles(
            last_card_id=last_card_id, last_card_update_time=last_card_update_time)
        all_articles.extend(articles)
        print(f"成功获取 {len(all_articles)} 篇文章, {has_more}")
        last_card = articles[-1]
        last_card_id = last_card.id
        last_card_update_time = last_card.update_time

    # 如果没有文章,则退出
    if not all_articles:
        print("没有找到任何文章,退出导出")
        return

    export_dir = f"cubox_export"
    output = CuboxOutput(api, all_articles)
    output.to_markdown(export_dir)

    print(f"\n导出完成! 文件已保存到 {os.path.abspath(export_dir)} 目录")


if __name__ == "__main__":
    main()

Metadata

Release files for cubox 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cubox 1.0.0
File Size Uploaded Provenance
cubox-1.0.0.tar.gz 5.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cubox 1.0.0
File Interpreter ABI Platform
cubox-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.7 kB

Release files / cubox-1.0.0.tar.gz

Download URL cubox-1.0.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
70bfd63d7277c371dec381a60ac5fbdfc7cc5ba4588b3157e29cd6ba334e15a9
BLAKE2b-256 checksum
How to use checksums
79575f9ae184304eb54645ae5c04157103d0d1758a0125540bce5468b69a9934
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.0

Release files / cubox-1.0.0-py3-none-any.whl

Download URL cubox-1.0.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c50b9ce2a8a768bdf8468fea1121bda3c6ed09dfa9430aee4e577c24f3b76e1d
BLAKE2b-256 checksum
How to use checksums
9554b3dafda3e59431e30a08c5e7cf5c69aea84c5e5937da9b79f9eb9e07634c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.0

Security for cubox 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page