From 2230a814d2b04bd27abc77a6c47ecb44fe448277 Mon Sep 17 00:00:00 2001 From: amtoaer Date: Wed, 3 Apr 2024 01:42:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A2=9D=E5=A4=96=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entity/src/entities/favorite.rs | 2 +- entity/src/entities/video.rs | 2 +- src/bilibili/favorite_list.rs | 12 ++++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/entity/src/entities/favorite.rs b/entity/src/entities/favorite.rs index d6e0666..1654598 100644 --- a/entity/src/entities/favorite.rs +++ b/entity/src/entities/favorite.rs @@ -8,7 +8,7 @@ pub struct Model { #[sea_orm(primary_key)] pub id: i32, #[sea_orm(unique)] - pub f_id: i32, + pub f_id: i64, pub name: String, pub path: String, pub created_at: String, diff --git a/entity/src/entities/video.rs b/entity/src/entities/video.rs index 3b9d57b..47ca29f 100644 --- a/entity/src/entities/video.rs +++ b/entity/src/entities/video.rs @@ -8,7 +8,7 @@ pub struct Model { #[sea_orm(primary_key)] pub id: i32, pub favorite_id: i32, - pub upper_id: i32, + pub upper_id: i64, pub upper_name: String, pub upper_face: String, pub name: String, diff --git a/src/bilibili/favorite_list.rs b/src/bilibili/favorite_list.rs index 12e840a..dd69f44 100644 --- a/src/bilibili/favorite_list.rs +++ b/src/bilibili/favorite_list.rs @@ -15,7 +15,7 @@ pub struct FavoriteList<'a> { #[derive(Debug, serde::Deserialize)] pub struct FavoriteListInfo { - pub id: i32, + pub id: i64, pub title: String, } @@ -39,7 +39,7 @@ pub struct VideoInfo { #[derive(Debug, serde::Deserialize)] pub struct Upper { - pub mid: i32, + pub mid: i64, pub name: String, pub face: String, } @@ -103,14 +103,18 @@ impl<'a> FavoriteList<'a> { let mut videos = match self.get_videos(page).await { Ok(v) => v, Err(e) => { - error!("failed to get videos of page {}: {}", page, e); + error!("failed to get videos of favorite {} page {}: {}", self.fid, page, e); break; }, }; + if !videos["data"]["medias"].is_array() { + error!("no medias found in favorite {} page {}", self.fid, page); + break; + } let videos_info = match serde_json::from_value::>(videos["data"]["medias"].take()) { Ok(v) => v, Err(e) => { - error!("failed to parse videos of page {}: {}", page, e); + error!("failed to parse videos of favorite {} page {}: {}", self.fid, page, e); break; }, };