GithubHelp home page GithubHelp logo

eansearch / rust-eansearch Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 179.76 MB

Rust library to search the EAN barcode database at EAN-Search.org

Home Page: https://www.ean-search.org/ean-database-api.html

License: Apache License 2.0

Rust 100.00%
barcode ean ean13 gtin gtin-codes isbn isbn-13 rust upc

rust-eansearch's Introduction

EANSearch

Search for products by EAN barcode or product name / keywords

Features

  • Search by EAN code
  • Lookup by ISBN code (ISBN-10 or ISBN-13)
  • Search by name or keyords
  • restrict search by product category
  • get the issuing country for the barcode
  • verify barcode checksum
  • get PNG image for the EAN barcode

How to use

// search by EAN barcode, product name in English
let eansearch = EANSearch::new(&token);
let product = eansearch.barcode_lookup(5099750442227, Some(1));
let product = product.unwrap(); // unwrap result
let product = product.unwrap();
println!("EAN {} is {}", product.ean, product.name);

// search by ISBN code
let eansearch = EANSearch::new(&token);
let book = eansearch.isbn_lookup(1119578884);
let book = book.unwrap(); // unwrap result
let book = book.unwrap();
println!("ISBN-13 {} is {}", book.ean, book.name);

// now find all products with the keyword 'bananaboat'
let product_list = eansearch.product_search("bananaboat", Some(1), None);
for p in &product_list.unwrap() {
	println!("EAN {:0>13} is {} ({})", p.ean, p.name, p.category_name);
}

// only find 'bananaboat' products from the 'Music' category
let product_list = eansearch.category_search(45, Some("bananaboat"), Some(1), None);

// download a EANs that start with 509975044xxx
let product_list = eansearch.barcode_prefix_search(509975044, Some(1), None);

// find the country where a barcode was issued
let country_lookup = eansearch.issuing_country(5099750442227);

// check if this is really a valid barcode
let checksum_ok = eansearch.verify_checksum(5099750442227);

// get A PNG image of the barcode to display eg. on a website
let img = eansearch.barcode_image(5099750442227, None, None);

To use the library, you need an account and obtain an API token.

See https://www.ean-search.org/ean-database-api.html

rust-eansearch's People

Contributors

eansearch avatar willamowius avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

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.