Skip to content
Clone
f323ba1
38 lines 982 B Rust
use crate::parse::{EmbedRule, Platform};
use crate::Category;
pub struct Pinterest;
impl Platform for Pinterest {
fn id(&self) -> &'static str {
"pinterest"
}
fn name(&self) -> &'static str {
"Pinterest"
}
fn category(&self) -> Category {
Category::Social
}
fn domains(&self) -> &'static [&'static str] {
&["pinterest.com", "pinterest.co.uk", "pinterest.de", "pin.it"]
}
fn embed_rule(&self) -> Option<EmbedRule> {
Some(EmbedRule::capture(
r"^/pin/(\d+)",
"https://assets.pinterest.com/ext/embed.html?id={id}",
crate::Aspect::Auto,
)
.fixed_height(420))
}
/// oEmbed 接口,聊天侧联网补全标题 / 简介 / 封面(iframe 仅在平台自有域名下采用)。
fn oembed(&self) -> Option<&'static str> {
Some("https://www.pinterest.com/oembed.json?url={url_enc}")
}
}
pub static PLATFORM: Pinterest = Pinterest;