mercury

Crates.iomercury
lib.rsmercury
version0.1.0
sourcesrc
created_at2017-10-26 00:35:59.632463
updated_at2017-10-26 00:35:59.632463
descriptionThe official Rust client for the Mercury Parser.
homepagehttps://mercury.postlight.com
repositoryhttps://github.com/postlight/mercury-rs
max_upload_size
id36959
size31,687
Zachary Golba (zacharygolba)

documentation

https://docs.rs/mercury/0.1

README

mercury-rs

CircleCI branch

The official Rust client for the Mercury Parser.

With just one API request, Mercury takes any web article and returns only the relevant content — headline, author, body text, relevant images and more — free from any clutter. It’s reliable, easy-to-use and free.

Installation

The examples in this document assume you already have a Mercury Parser API key. If you do not already have one, you can sign up here.

Add this to your Cargo.toml:

[dependencies]
futures = "0.1"
mercury = "0.1"
tokio-core = "0.1"

Add this to your main.rs:

extern crate futures;
extern crate mercury;
extern crate tokio_core;

Usage

// Create a new event loop with tokio.
let mut core = Core::new()?;

// Load your API key from the environment.
let key = env::var("MERCURY_API_KEY")?;

// Pass a handle to the event loop and the API key to the Mercury constructor.
let client = Mercury::new(&core.handle(), key)?;

// The parse method returns a Future that will resolve to a parsed Article.
let resp = client.parse("https://example.com").inspect(|article| {
    println!("{:#?}", article);
});

// Block the current thread until the future completes.
core.run(resp)?;

Additional examples can be found here.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 12

cargo fmt