oembed-rs

Crates.iooembed-rs
lib.rsoembed-rs
version0.0.7
sourcesrc
created_at2023-04-22 09:42:34.141166
updated_at2024-08-29 14:10:26.993669
descriptionRetrieve oEmbed data from a URL
homepage
repositoryhttps://github.com/brainhivenl/oembed/
max_upload_size
id845896
size149,872
Rick van Assen (Rick-VA)

documentation

README

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
Commit count: 19

cargo fmt