implemented spankbang
This commit is contained in:
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user