Skip to content
Clone
f323ba1
37 lines 911 B Rust
use crate::parse::{EmbedRule, Platform};
use crate::Category;
pub struct Reddit;
impl Platform for Reddit {
fn id(&self) -> &'static str {
"reddit"
}
fn name(&self) -> &'static str {
"Reddit"
}
fn category(&self) -> Category {
Category::Forum
}
fn domains(&self) -> &'static [&'static str] {
&["reddit.com"]
}
fn embed_rule(&self) -> Option<EmbedRule> {
// Reddit oEmbed 声明 height=500
Some(
EmbedRule::frame("https://www.redditmedia.com{path}?embed=true&depth=1&showmedia=true")
.fixed_height(500),
)
}
/// oEmbed 接口,聊天侧联网补全标题 / 简介 / 封面(iframe 仅在平台自有域名下采用)。
fn oembed(&self) -> Option<&'static str> {
Some("https://www.reddit.com/oembed?url={url_enc}")
}
}
pub static PLATFORM: Reddit = Reddit;