Git Product home page Git Product logo

sauce-api's Introduction

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"] }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.