Wrapper for SauceNAO JSON API
Project description
saucenao_api
“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
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
saucenao_api-1.0.0.tar.gz
(6.1 kB
view hashes)
Built Distribution
Close
Hashes for saucenao_api-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c422cae1091f2aea1b52ecfe3c32f6336f13421524e46510ecb49c28bd04adc3 |
|
MD5 | 9c8aca3d7bf47d8b429fe7f47c215acd |
|
BLAKE2b-256 | 87a49a54e89e0961ba635214e04639571699ba5f4e649d4359c3f20fefb6ef69 |