use regex::Regex; use reqwest::Response; use scraper::Selector; use serde::Serialize; use std::collections::HashMap; use validator::Validate; use crate::{ structs::special::{BandcampType, LightspeedType, TwitchType}, util::{ request::{consume_fragment, consume_size, fetch}, result::Error, }, }; use super::{ media::{Image, ImageSize, Video}, special::Special, }; #[derive(Clone, Validate, Debug, Serialize)] pub struct Metadata { #[validate(length(min = 1, max = 256))] url: String, original_url: String, special: Option, #[serde(skip_serializing_if = "Option::is_none")] #[validate(length(min = 1, max = 100))] title: Option, #[serde(skip_serializing_if = "Option::is_none")] #[validate(length(min = 0, max = 2000))] description: Option, #[serde(skip_serializing_if = "Option::is_none")] #[validate] image: Option, #[serde(skip_serializing_if = "Option::is_none")] #[validate] video: Option