Skip to content

Commit

Permalink
[bilibili.live] Use a fallback image url for empty cover image url
Browse files Browse the repository at this point in the history
  • Loading branch information
SpriteOvO committed Jun 21, 2024
1 parent 52962d4 commit 5cb1b0f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/source/bilibili/live.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct ResponseDataRoom {
uid: u64,
live_status: u64,
uname: String,
cover_from_user: String,
cover_from_user: String, // Empty for no cover (not yet updated)
}

pub struct Fetcher {
Expand Down Expand Up @@ -72,7 +72,12 @@ impl Fetcher {
online: data.live_status == 1,
title: data.title,
streamer_name: data.uname.clone(),
cover_image_url: data.cover_from_user,
cover_image_url: if !data.cover_from_user.is_empty() {
data.cover_from_user
} else {
"https://i1.hdslb.com/bfs/static/blive/live-assets/common/images/no-cover.png"
.into()
},
live_url: format!("https://live.bilibili.com/{}", data.room_id),
}),
source: StatusSource {
Expand Down

0 comments on commit 5cb1b0f

Please sign in to comment.