Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kumabook/opengraph
Parses html and extracts Open Graph protocol markup
https://github.com/kumabook/opengraph
Last synced: 3 months ago
JSON representation
Parses html and extracts Open Graph protocol markup
- Host: GitHub
- URL: https://github.com/kumabook/opengraph
- Owner: kumabook
- License: mit
- Created: 2017-04-28T23:14:21.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-05T04:05:16.000Z (about 6 years ago)
- Last Synced: 2024-09-15T17:24:49.816Z (3 months ago)
- Language: Rust
- Homepage:
- Size: 20.5 KB
- Stars: 16
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
opengraph
=========opengraph is a library that parses html and extracts Open Graph protocol markup.
Usage
------ Add `opengraph` to dependencies in Cargo.toml
```toml
[dependencies]
opengraph = "^0"
```- Then, use `opengraph::scrape` as below:
```rust
extern crate opengraph;
fn main() {
match opengraph::scrape("https://spincoaster.com/chromeo-juice", Default::default()) {
Ok(object) => {
println!("{:?}", object);
},
Err(_) => println!("error occured"),
}
}```
or use `opengraph::extract` as below:
```rust
extern crate opengraph;fn main() {
let x = r#"The Rock (1996)
"#;
match opengraph::extract(&mut x.to_string().as_bytes(), Default::default()) {
Ok(object) => {
println!("{:?}", object);
},
Err(_) => println!("error occured"),
}
}
```License
-------[MIT](LICENSE)