Skip to content

Commit

Permalink
Fix user videos no access issue (#57)
Browse files Browse the repository at this point in the history
* Update UserDetailView.swift

* Trying to fix issue

* Trying to fix issue

* Trying to fix issue

* Trying to fix issue

* Trying to fix issue

* Trying to fix issue

* Trying to fix issue

* Trying to fix issue

* Trying to fix issue

* Update NetworkFixView.swift

* Updated UserDetailView.swift
  • Loading branch information
WindowsMEMZ authored Jan 6, 2024
1 parent ea41045 commit f7c1380
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ final class DarockBili_Watch_App_UI_Tests: XCTestCase {
sleep(1)
takeScreenshot(of: app, named: "RMVideoAuthor")
app.swipeLeft()
sleep(2)
sleep(1)
takeScreenshot(of: app, named: "RMVideoAuthorVideos")
sleep(5)
takeScreenshot(of: app, named: "RMVideoAuthorVideos-Waited")
app.navigationBars.buttons.element(boundBy: 0).tap()
sleep(1)
app.swipeLeft()
Expand Down
1 change: 1 addition & 0 deletions DarockBili Watch App/Errors/NetworkFixView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ public func CheckBApiError(from input: JSON) -> Bool {
}
let msg = errorCodeTextDic[code] ?? (input["message"].string ?? "")
tipWithText(msg, symbol: "xmark.circle.fill")
DarockKit.Network.shared.requestString("https://api.darock.top/bili/error/upload/\("Code: \(code)|Message: \(msg)|Build: \(Bundle.main.infoDictionary?["CFBundleVersion"] as! String)|IsLoggedIn: \((UserDefaults.standard.string(forKey: "DedeUserID") ?? "") == "" ? "Yes" : "No")".base64Encoded().replacingOccurrences(of: "/", with: "{slash}"))") { _, _ in return}
return false
}

Expand Down
14 changes: 9 additions & 5 deletions DarockBili Watch App/PersonalCenter/UserDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -564,12 +564,16 @@ struct UserDetailView: View {
func RefreshVideos() {
videos = [[String: String]]()
let headers: HTTPHeaders = [
// "accept-language": "zh-CN,zh;q=0.9",
"cookie": "SESSDATA=\(sessdata);", // buvid3=\(globalBuvid3);buvid4=\(globalBuvid4);
//"User-Agent": "Mozilla/5.0" // Bypass? drdar://gh/SocialSisterYi/bilibili-API-collect/issues/868/1859065874
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9",
"cookie": "\(sessdata == "" ? "" : "SESSDATA=\(sessdata); ")buvid3=\(globalBuvid3); b_nut=\(Date.now.timeStamp); buvid4=\(globalBuvid4);",
"origin": "https://space.bilibili.com",
"referer": "https://space.bilibili.com/\(uid)/video",
"User-Agent": "Mozilla/5.0" // Bypass? drdar://gh/SocialSisterYi/bilibili-API-collect/issues/868/1859065874
]
// FIXME: Apply changes to RefreshArticles method after checking ability.
biliWbiSign(paramEncoded: "mid=\(uid)&ps=50&pn=\(videoNowPage)".base64Encoded()) { signed in
// FIXME: Official Wbi crypto logic for this request seems different from other APIs, some IP can get but some can't. It's hard to fix ~_~
biliWbiSign(paramEncoded: "mid=\(uid)&ps=50&tid=0&pn=\(videoNowPage)&keyword=&order=pubdate&platform=web&web_location=1550101&order_avoided=true&dm_img_list=[]&dm_img_str=V2ViR0wgMS4wIChPcGVuR0wgRVMgMi4wIENocm9taXVtKQ&dm_cover_img_str=VjNEIDQuMkJyb2FkY2".base64Encoded()) { signed in
if let signed {
debugPrint(signed)
DarockKit.Network.shared.requestJSON("https://api.bilibili.com/x/space/wbi/arc/search?\(signed)", headers: headers) { respJson, isSuccess in
Expand Down

0 comments on commit f7c1380

Please sign in to comment.