Skip to content

Commit

Permalink
Update VideoDetailView.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
WindowsMEMZ authored Dec 12, 2023
1 parent c19b7a0 commit 4d90f74
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions DarockBili Watch App/Video/VideoDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -691,14 +691,11 @@ struct VideoDetailView: View {
"cookie": "SESSDATA=\(sessdata)",
"referer": "bilibili.com/video/\(videoDetails["BV"]!)"
]
DarockKit.Network.shared.requestString("https://api.darock.top/bili/toav/\(videoDetails["BV"]!)") { respStr, isSuccess in
if isSuccess {
AF.request("https://api.bilibili.com/medialist/gateway/coll/resource/deal", method: .post, parameters: BiliVideoFavourite(rid: Int(respStr)!, csrf: biliJct), headers: headers).response { response in
debugPrint(response)
isLiked ? tipWithText("取消成功", symbol: "checkmark.circle.fill") : tipWithText("收藏成功", symbol: "checkmark.circle.fill")
isFavoured.toggle()
}
}
let avid = bv2av(bvid: videoDetails["BV"]!)
AF.request("https://api.bilibili.com/medialist/gateway/coll/resource/deal", method: .post, parameters: BiliVideoFavourite(rid: avid, csrf: biliJct), headers: headers).response { response in
debugPrint(response)
isLiked ? tipWithText("取消成功", symbol: "checkmark.circle.fill") : tipWithText("收藏成功", symbol: "checkmark.circle.fill")
isFavoured.toggle()
}
}, label: {
VStack {
Expand Down Expand Up @@ -909,7 +906,7 @@ struct BiliVideoCoin: Codable {
let csrf: String
}
struct BiliVideoFavourite: Codable {
let rid: Int
let rid: UInt64
var type: Int = 2
var add_media_ids: Int? = nil
var del_media_ids: Int? = nil
Expand Down

0 comments on commit 4d90f74

Please sign in to comment.