Skip to main content

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

Project description

nullbr-python

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.0.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.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nullbr-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 1b349fdf283f51b571b1caa19f842f211c21c2c5ef32b0fa888a2000193c11ac
MD5 27e2aed610f9d2d6b16c1b77548e2830
BLAKE2b-256 fbcd0ffdea439851fedf23320e22a97745f2cc9ce19023d0df7df67e7950b885

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nullbr-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 755d4581fcb7fbe62c56994b4214cc2b433157f03b8b2f3496bd2de20a989f0a
MD5 b89f30cb8b64ed94266620f58dc35a3e
BLAKE2b-256 99d1b1d81ab76fa358535d5c35597a186c7599ebae8679d3f5e02898c3b75f30

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