| Crates.io | oembed-rs |
| lib.rs | oembed-rs |
| version | 0.0.8 |
| created_at | 2023-04-22 09:42:34.141166+00 |
| updated_at | 2024-11-22 10:59:08.460302+00 |
| description | Retrieve oEmbed data from a URL |
| homepage | |
| repository | https://github.com/brainhivenl/oembed/ |
| max_upload_size | |
| id | 845896 |
| size | 149,870 |
This crate provides a simple interface for fetching oEmbed data from known providers based on the oembed specification.
use oembed_rs::{find_provider, fetch, ConsumerRequest};
async fn example() {
let url = "https://twitter.com/user/status/1000000000000000000";
let (_, endpoint) = find_provider(url).expect("unknown provider");
let response = fetch(
&endpoint.url,
ConsumerRequest {
url,
max_width: Some(1000),
max_height: Some(500),
..ConsumerRequest::default()
},
)
.await
.expect("failed to fetch oembed data");
}