Skip to main content

Wrapper for SauceNAO JSON API

Project description

SauceNAO Logo

saucenao_api

Build Status Coverage Status License SauceNao Status PyPI - Python Version

“The rough edges are a part of its charm”

Unofficial wrapper for the SauceNAO JSON API

Installation

This package requires Python 3.6 or later

pip install saucenao_api

Dependencies

Usage

from saucenao_api import SauceNao
from saucenao_api.params import DB, Hide, Bgcolor

# Parameters from https://saucenao.com/user.php?page=search-api
sauce = SauceNao(api_key=None,
                 testmode=0,
                 dbmask=None,
                 dbmaski=None,
                 db=DB.ALL,
                 numres=6,
                 hide=Hide.NONE,
                 bgcolor=Bgcolor.NONE)

# results = sauce.from_file(file)
results = sauce.from_url('https://i.imgur.com/oZjCxGo.jpg')

results.short_remaining  # 30 seconds limit
results.long_remaining   # 24 hours limit

len(results)  # 6
print(repr(results))
<SauceResponse(results_count=6, long_remaining=99, short_remaining=3)>

The library provides common parameters, such as similarity, title, url, author and some others for almost all results:

from saucenao_api import SauceNao

sauce = SauceNao()
results = sauce.from_url('https://i.imgur.com/oZjCxGo.jpg')

results[0].similarity  # 93.3
results[0].title       # めぐみん
results[0].url         # https://www.pixiv.net/member_illust.php?mode=medium&illust_id=77630170
results[0].author      # frgs

There are also special VideoSauce and BookSauce containers with extra parameters:

from saucenao_api import SauceNao, VideoSauce, BookSauce

sauce = SauceNao()
result = sauce.from_url('https://i.imgur.com/k9xlw6f.jpg')[0]

if isinstance(result, VideoSauce):
    result.part      # 02
    result.year      # 2009-2009
    result.est_time  # 00:05:32 / 00:21:10

elif isinstance(result, BookSauce):
    result.part

License

This package is based on pysaucenao.

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

saucenao_api-1.0.2.tar.gz (6.2 kB view hashes)

Uploaded Source

Built Distribution

saucenao_api-1.0.2-py3-none-any.whl (19.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page