Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

JKit

许可证 PyPI 版本 支持的 Python 版本

静态分析 Ruff 类型检查 代码风格 Ruff

创造可能性。

[!WARNING] JKit v3 正在 Beta 测试中,可能随时进行重大变更。

[!WARNING] JKit 为非官方 SDK,可能因相关 API 变动导致功能异常。

功能

  • 简书文章 / 用户 / 专题 / 文集标识符(ID / Slug / URL)校验与转换
  • 获取简书文章、用户、专题、文集数据
  • 获取简书资产数据、钻贝变动记录、持钻奖励数据、收益加成卡数据
  • 获取简书会员分销链接
  • 钻贝互转
  • 获取简书积分兑换平台贝市场订单数据
  • 获取贝交易平台贝市场订单数据

(部分功能需要鉴权凭证)

安装

JKit 需要 Python 3.9 及以上版本。

PyPy 等其它 Python 实现可能运行,但不受支持。

pip install jkit

快速上手

JKit 仅支持异步操作。

import asyncio

from jkit.user import User


async def main() -> None:
    user = User.from_slug("ea36c8d8aa30")

    info = await user.info

    print(f"ID:{info.id}")
    print(f"URL:{user.url}")
    print(f"昵称:{info.name}")


asyncio.run(main())
ID:19867175
URL:https://www.jianshu.com/u/ea36c8d8aa30
昵称:初心不变_叶子

获取凭证

简书

目前仅支持从电脑端获取凭证。

在浏览器中登录简书账号。

打开开发者工具(DevTools)- 存储(Storages)选项卡- Cookie,remember_user_token 对应的值即为凭证。

使用示例:

import asyncio

from jkit.credentials import JianshuCredential
from jkit.private.assets_wallet import AssetsWallet

TOKEN = "<YOUR_TOKEN>"


async def main() -> None:
    credential = JianshuCredential.from_remember_user_token(TOKEN)
    assets_wallet = AssetsWallet(credential=credential)

    print(await assets_wallet.assets_info)


asyncio.run(main())
AssetsInfoData(
    fp_amount=Decimal('88987.0378258294950'),
    ftn_amount=Decimal('7860.19387826272668'),
    assets_amount=Decimal('96847.2317040922062'),
    converting_fp_amount=Decimal('8.46199999999999974')
)

贝交易平台

在浏览器中登录贝交易平台账号。

打开开发者工具(DevTools)- 控制台(Console)选项卡,执行以下代码:

JSON.parse(window.localStorage.app_user_token).token

输出内容即为凭证。(不包含引号)

使用示例:

import asyncio

from jkit.beijiaoyi.ftn_market import FtnMarket
from jkit.credentials import BeijiaoyiCredential

TOKEN = "<YOUR_TOKEN>"


async def main() -> None:
    credential = BeijiaoyiCredential.from_bearer_token(TOKEN)
    ftn_market = FtnMarket(credential=credential)

    async for item in ftn_market.iter_orders(type="BUY"):
        print(item)
        return


asyncio.run(main())
OrderData(
    id=1893596965401399296,
    price=0.046,
    total_amount=10000,
    traded_amount=0,
    remaining_amount=10000,
    minimum_trade_amount=1000,
    maximum_trade_amount=None,
    completed_trades_count=0,
    publish_time=datetime.datetime(2025, 2, 23, 17, 41, 12),
    supported_payment_channels=('WECHAT_PAY', 'ALIPAY'),
    publisher_info=_PublisherInfoField(
        id=3513,
        name='eQn8ME9fnt',
        avatar_url='https://testapi.beijiaoyi.com/Upload/headimg/13.png'
    )
)

Release files for jkit 3.0.0b5

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

Source distribution (sdist)

Source distribution for jkit 3.0.0b5
File Size Uploaded
jkit-3.0.0b5.tar.gz 21.7 kB Details

Built distribution (wheel)

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

Total release size: 58.8 kB

Release files / jkit-3.0.0b5.tar.gz

Download URL jkit-3.0.0b5.tar.gz
Size 21.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f808751b6206e35149eb2837dc002b28a21c470d1b5a70a58715facf03baad0d
BLAKE2b-256 checksum
How to use checksums
14531642aef56339f1a0c7cc71e6d502079e144e16fd0196cc4aff7711bb0ed7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.5

Release files / jkit-3.0.0b5-py3-none-any.whl

Download URL jkit-3.0.0b5-py3-none-any.whl
Size 37.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e4fbbc16748be6e9650f6380d0490be0fa3bca9926b4d8b9702197a6233a8a11
BLAKE2b-256 checksum
How to use checksums
c5f80e749c24b2ef7f5d41dcd8baa7e79b94a37536562cc63e91959e56948cd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.5
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