8 releases
0.0.8 | Nov 22, 2024 |
---|---|
0.0.7 | Aug 29, 2024 |
0.0.6 | Mar 14, 2024 |
0.0.4 | Jul 7, 2023 |
0.0.2 | Apr 26, 2023 |
#1594 in Web programming
147 downloads per month
18KB
324 lines
Introduction
This crate provides a simple interface for fetching oEmbed data from known providers based on the oembed specification.
Usage
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");
}
Roadmap
- Add support for custom providers
- Return known errors from the specification properly
- Support the discovery flow
lib.rs
:
Documentation
This crate provides a simple interface for fetching oEmbed data from known providers.
Example
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");
}
Dependencies
~4–16MB
~200K SLoC