python get cubox article
Project description
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()
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
cubox-1.0.0.tar.gz
(5.4 kB
view details)
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
cubox-1.0.0-py3-none-any.whl
(6.3 kB
view details)
File details
Details for the file cubox-1.0.0.tar.gz.
File metadata
- Download URL: cubox-1.0.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70bfd63d7277c371dec381a60ac5fbdfc7cc5ba4588b3157e29cd6ba334e15a9
|
|
| MD5 |
678dae085c287b284d32ddd71e784ac0
|
|
| BLAKE2b-256 |
79575f9ae184304eb54645ae5c04157103d0d1758a0125540bce5468b69a9934
|
File details
Details for the file cubox-1.0.0-py3-none-any.whl.
File metadata
- Download URL: cubox-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c50b9ce2a8a768bdf8468fea1121bda3c6ed09dfa9430aee4e577c24f3b76e1d
|
|
| MD5 |
9599e7a657efb148f65211bd0b81050f
|
|
| BLAKE2b-256 |
9554b3dafda3e59431e30a08c5e7cf5c69aea84c5e5937da9b79f9eb9e07634c
|