Crates.io | diffbot |
lib.rs | diffbot |
version | 1.0.0 |
source | src |
created_at | 2016-01-07 00:11:51.659771 |
updated_at | 2017-08-02 14:52:22.704919 |
description | A client library for the Diffbot API |
homepage | |
repository | https://github.com/diffbot/diffbot-rust-client |
max_upload_size | |
id | 3840 |
size | 23,790 |
This library allows you to access the Diffbot API from your rust application. You still need a diffbot token (check their trial).
It returns a Json object from serde_json.
Add to your Cargo.toml
dependencies:
[dependencies]
diffbot = "1.0"
And to your main source file:
extern crate diffbot;
extern crate diffbot;
use diffbot::*;
fn main() {
let client = Diffbot::v3("insert_your_token_here");
match client.call(API::Analyze, "http://www.diffbot.com") {
Ok(result) =>
println!("{:?}", result),
Err(Error::Api(code, msg)) =>
println!("API returned error {}: {}", code, msg),
Err(err) =>
println!("Other error: {:?}", err),
};
}
extern crate diffbot;
use diffbot::*;
fn main() {
let client = Diffbot::v3("insert_your_token_here");
match client.search("GLOBAL-INDEX", "type:article diffbot") {
Ok(result) =>
println!("{:?}", result),
Err(Error::Api(code, msg)) =>
println!("API returned error {}: {}", code, msg),
Err(err) =>
println!("Other error: {:?}", err),
};
}
This library is under the MIT license. You can probably use it in your commercial application without complication.