Skip to main content

Python SDK for Nullbr API - 用于访问 Nullbr API 的 Python SDK

Project description

nullbr

PyPI - Version License: MIT Python 3.9+

Python SDK for Nullbr API - 用于访问 Nullbr API 的 Python SDK

功能特性

  • 🔍 搜索电影、电视剧、合集和人物
  • 🎬 获取电影详细信息和资源链接
  • 📺 获取电视剧详细信息和资源链接
  • 📚 获取合集信息和资源链接
  • 🔗 支持115网盘、磁力链接、电驴链接等多种资源类型
  • 🛠️ 命令行工具支持
  • 🔒 MIT 许可证

安装

使用 uv 安装

uv add nullbr

使用 pip 安装

pip install nullbr

从源码安装

git clone https://github.com/iLay1678/nullbr-python.git
cd nullbr
uv sync
uv pip install -e .

快速开始

基本用法

from nullbr import NullbrSDK

# 初始化SDK
sdk = NullbrSDK(
    app_id="your_app_id",
    api_key="your_api_key"  # 可选,某些操作需要
)

# 搜索电影
results = sdk.search("复仇者联盟")
for item in results.items:
    print(f"{item.title} ({item.media_type})")

# 获取电影详细信息
movie = sdk.get_movie(299536)  # 复仇者联盟4的TMDB ID
print(f"电影名称: {movie.title}")
print(f"评分: {movie.vote}")
print(f"上映日期: {movie.release_date}")

# 获取电影资源(需要API Key)
if movie.has_115:
    resources = sdk.get_movie_115(299536)
    for resource in resources.items:
        print(f"资源: {resource.title} - {resource.size}")

命令行使用

使用uv:

# 搜索
uv run python -m nullbr.cli --app-id YOUR_APP_ID search "复仇者联盟"

# 获取电影信息
uv run python -m nullbr.cli --app-id YOUR_APP_ID movie 299536

# 获取电视剧信息
uv run python -m nullbr.cli --app-id YOUR_APP_ID tv 1396

如果已安装为全局包:

# 搜索
nullbr --app-id YOUR_APP_ID search "复仇者联盟"

# 获取电影信息
nullbr --app-id YOUR_APP_ID movie 299536

# 获取电视剧信息
nullbr --app-id YOUR_APP_ID tv 1396

API 参考

NullbrSDK

主要的SDK类,提供所有API方法。

初始化

sdk = NullbrSDK(
    app_id="your_app_id",
    api_key="your_api_key",  # 可选
    base_url="https://api.nullbr.eu.org"  # 默认值
)

方法

search(query, page=1)

搜索媒体内容

  • query (str): 搜索关键词
  • page (int): 页码,默认为1
  • 返回: SearchResponse 对象
get_movie(tmdbid)

获取电影详细信息

  • tmdbid (int): 电影的TMDB ID
  • 返回: MovieResponse 对象
get_movie_115(tmdbid, page=1)

获取电影115网盘资源(需要API Key)

  • tmdbid (int): 电影的TMDB ID
  • page (int): 页码,默认为1
  • 返回: Movie115Response 对象
get_movie_magnet(tmdbid)

获取电影磁力资源

  • tmdbid (int): 电影的TMDB ID
  • 返回: MovieMagnetResponse 对象
get_tv(tmdbid)

获取电视剧详细信息

  • tmdbid (int): 电视剧的TMDB ID
  • 返回: TVResponse 对象

更多方法请参考源码文档。

数据模型

MediaItem

媒体项目基础信息

SearchResponse

搜索结果响应

MovieResponse

电影信息响应

TVResponse

电视剧信息响应

开发

安装开发依赖

uv sync --dev

或者使用pip:

pip install -e ".[dev]"

代码格式化

uv run black nullbr/
uv run isort nullbr/

运行测试

uv run pytest

许可证

本项目采用 MIT 许可证。详情请见 LICENSE 文件。

贡献

欢迎提交Issue和Pull Request!

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

nullbr-1.0.1.tar.gz (48.3 kB view details)

Uploaded Source

Built Distribution

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

nullbr-1.0.1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file nullbr-1.0.1.tar.gz.

File metadata

  • Download URL: nullbr-1.0.1.tar.gz
  • Upload date:
  • Size: 48.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for nullbr-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b02fc0b3f7d53efaa093afafe8b5536251d715ffefec02c42779034db56f10f5
MD5 6e6839e5cfc44cdb50e6a656431cd203
BLAKE2b-256 e79d76dd83aecc9cbad15c1a3ec21f18f8f2fc28d2c3e21f8ae76e534b95388c

See more details on using hashes here.

File details

Details for the file nullbr-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: nullbr-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for nullbr-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 514c62fef0c8ee4c68849a154494a79aa4c77e2b4ffe1f38d71a53a274e74a7c
MD5 9577d9c6e974624e7ce92b62be9f4d94
BLAKE2b-256 ad868306203d6dc1a2e8a19928778c0abf2bc91f9d1c5598961392171bce823e

See more details on using hashes here.

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