implemented spankbang

This commit is contained in:
Simon
2025-06-09 13:08:26 +00:00
parent 0496954f41
commit 673d9aad5b
8 changed files with 338 additions and 96 deletions

View File

@@ -64,6 +64,7 @@ pub struct VideoItem {
pub uploadedAt: Option<u64>, // 1741142954
pub formats: Option<Vec<VideoFormat>>, // Additional HTTP headers if needed
pub embed: Option<VideoEmbed>, // Optional embed information
pub preview: Option<String>
}
#[allow(dead_code)]
impl VideoItem {
@@ -91,6 +92,7 @@ impl VideoItem {
uploadedAt: None,
formats: None, // Placeholder for formats
embed: None, // Placeholder for embed information
preview: None
}
}
pub fn tags(mut self, tags: Vec<String>) -> Self {
@@ -125,10 +127,21 @@ impl VideoItem {
self.formats = Some(formats);
self
}
pub fn add_format(mut self, format: VideoFormat){
if let Some(formats) = self.formats.as_mut() {
formats.push(format);
} else {
self.formats = Some(vec![format]);
}
}
pub fn embed(mut self, embed: VideoEmbed) -> Self {
self.embed = Some(embed);
self
}
pub fn preview(mut self, preview: String) -> Self {
self.preview = Some(preview);
self
}
}
#[derive(serde::Serialize, Debug, Clone)]