Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

feat(api): add description field to SkoolLessonDetail and update lesson detail fetching

Tonho4cc138c48412
diff --git a/src-tauri/src/platforms/skool/api.rs b/src-tauri/src/platforms/skool/api.rs
index 98a589f0..5a2015b8 100644
--- a/src-tauri/src/platforms/skool/api.rs
+++ b/src-tauri/src/platforms/skool/api.rs
@@ -49,6 +49,7 @@ pub struct SkoolLesson {
pub struct SkoolLessonDetail {
pub id: String,
pub name: String,
+ pub description: Option<String>,
pub video_url: Option<String>,
pub files: Vec<SkoolFile>,
}
@@ -404,6 +405,19 @@ pub async fn get_lesson_detail(
.unwrap_or("")
.to_string();
+ let description = metadata
+ .get("description")
+ .or_else(|| metadata.get("content"))
+ .or_else(|| metadata.get("body"))
+ .and_then(|v| {
+ if v.is_string() {
+ v.as_str().map(String::from)
+ } else {
+ Some(serde_json::to_string_pretty(v).unwrap_or_default())
+ }
+ })
+ .filter(|s| !s.trim().is_empty());
+
let video_url = metadata
.get("videoLink")
.and_then(|v| v.as_str())
@@ -437,6 +451,7 @@ pub async fn get_lesson_detail(
Ok(SkoolLessonDetail {
id: lesson_id.to_string(),
name,
+ description,
video_url,
files,
})