Skip to content

Commit

Permalink
fix: api, close #116
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed Apr 2, 2024
1 parent d662441 commit cfbd2a4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/xyz/cssxsh/bilibili/BiliClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ open class BiliClient(private val timeout: Long = 15_000L) : Closeable {
prettyPrint = true
ignoreUnknownKeys = System.getProperty(JSON_IGNORE, "true").toBoolean()
isLenient = true
allowStructuredMapKeys = true
coerceInputValues = true
}

val DefaultIgnore: suspend (Throwable) -> Boolean = { it is IOException }
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/xyz/cssxsh/bilibili/api/Api.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const val SPACE_INFO = "https://api.bilibili.com/x/space/wbi/acc/info"

// Video
const val VIDEO_USER = "https://api.bilibili.com/x/space/wbi/arc/search"
const val VIDEO_INFO = "https://api.bilibili.com/x/web-interface/view"
const val VIDEO_INFO = "https://api.bilibili.com/x/web-interface/wbi/view"

// Dynamic
const val DYNAMIC_HISTORY = "https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/space_history"
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/xyz/cssxsh/bilibili/data/Dynamic.kt
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ data class DynamicDescribe(
@SerialName("uid")
val uid: Long = 0,
@SerialName("user_profile")
val profile: UserProfile = UserProfile(),
val profile: UserProfile = UserProfile.Empty,
@SerialName("view")
val view: Long = 0
) {
Expand Down Expand Up @@ -511,7 +511,7 @@ data class DynamicReply(
@SerialName("origin")
override val card: String = "null",
@SerialName("origin_user")
val originUser: UserProfile = UserProfile(),
val originUser: UserProfile = UserProfile.Empty,
@SerialName("user")
val user: UserSimple,
@Transient
Expand Down
8 changes: 6 additions & 2 deletions src/main/kotlin/xyz/cssxsh/bilibili/data/User.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ data class BiliUserInfo(
@SerialName("sign")
override val sign: String,
@SerialName("top_photo")
val topPhoto: String,
val topPhoto: String
) : UserInfo {
override val live: String get() = liveRoom?.link ?: "未开通直播间"

Expand Down Expand Up @@ -91,7 +91,11 @@ data class UserProfile(
val rank: String? = null,
@SerialName("sign")
val sign: String? = null
)
) {
companion object {
val Empty = UserProfile()
}
}

@Serializable
data class UserOfficial(
Expand Down

0 comments on commit cfbd2a4

Please sign in to comment.