Skip to content

A rust API for searching for the original source of images.

License

Notifications You must be signed in to change notification settings

lyssieth/sauce-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sauce-api

documentation crates.io

sauce-api is an API for finding the source image for low-quality or cropped images.
Currently it only works with anime-styled images, but I hope to makeit capable of doing other kinds of images as well.

Asynchronous due to the usage of reqwest, and works best with Tokio.

Supported Sources

If you wish to see more, please submit PRs or a request in an issue!

Usage

IQDB

use sauce_api::source::{Output, iqdb::Iqdb, Source};
use sauce_api::error::Error;

async fn find_source(url: &str) {
    let source = Iqdb::create(()).await.unwrap();
    let res: Result<Output, Error> = source.check(url).await; // Can take some time as IQDB is a bit slow.

    match res {
        Ok(result) => {
            println!("Found results! {:?}", result);
        }
        Err(e) => {
            eprintln!("Unable to find results: {}", e);
        }
    }
}

SauceNao

use sauce_api::source::{Output, saucenao::SauceNao, Source};
use sauce_api::error::Error;

async fn find_source(url: &str, api_key: &str) {
    let source = SauceNao::create(api_key.to_string()).await.unwrap();
    let res: Result<Output, Error> = source.check(url).await;

    match res {
        Ok(result) => {
            println!("Found results! {:?}", result);
        }
        Err(e) => {
            eprintln!("Unable to find results: {}", e);
        }
    }
}

Fuzzysearch

use sauce_api::source::{Output, fuzzysearch::FuzzySearch, Source};
use sauce_api::error::Error;

async fn find_source(url: &str, api_key: &str) {
    let source = FuzzySearch::create(api_key.to_string()).await.unwrap();
    let res: Result<Output, Error> = source.check(url).await;

    match res {
        Ok(result) => {
            println!("Found results! {:?}", result);
        }
        Err(e) => {
            eprintln!("Unable to find results: {}", e);
        }
    }
}

Requirements

sauce-api by default uses the native TLS framework, see this for specific details. You may opt-in to using rustls if you would like to by enabling the rustls feature like this:

sauce-api = { version = "1.0.0", features = ["rustls"] }

About

A rust API for searching for the original source of images.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages