Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
xjbeta committed May 26, 2024
2 parents 353e131 + c55bdab commit ccd73f4
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 37 deletions.
4 changes: 2 additions & 2 deletions IINA+.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 0.7.26;
MARKETING_VERSION = 0.7.27;
PRODUCT_BUNDLE_IDENTIFIER = "com.xjbeta.iina-plus";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1064,7 +1064,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 0.7.26;
MARKETING_VERSION = 0.7.27;
PRODUCT_BUNDLE_IDENTIFIER = "com.xjbeta.iina-plus";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
47 changes: 36 additions & 11 deletions IINA+/Utils/VideoDecoder/BiliLive.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,26 @@ class BiliLive: NSObject, SupportSiteProtocol {
guard let data = s.data(using: .utf8),
let json: JSONObject = try? JSONParser.JSONObjectWithData(data) else { return [] }

let list: [BiliLiveRoomList] = try json.value(for: "live-non-revenue-player")

re = list.first?.roomList.enumerated().map {
BiliLiveVideoSelector(
id: $0.element.roomId,
sid: "",
index: $0.offset,
title: $0.element.tabText,
url: "")
} ?? []
return re
if let list: [BiliLiveRoomList] = try? json.value(for: "live-non-revenue-player") {
re = list.first?.roomList.enumerated().map {
BiliLiveVideoSelector(
id: $0.element.roomId,
sid: "",
index: $0.offset,
title: $0.element.tabText,
url: "")
} ?? []
} else {
re = self.findAllRoomIds(s).enumerated().map {
BiliLiveVideoSelector(
id: $0.element,
sid: "",
index: $0.offset,
title: "",
url: "")
}
}
return re
}.then {
self.liveInfos($0.compactMap({ Int($0.id) }))
}.map {
Expand Down Expand Up @@ -172,6 +181,22 @@ class BiliLive: NSObject, SupportSiteProtocol {

return AF.request(u).responseData().map({ $0.data })
}

private func findAllRoomIds(_ str: String) -> [String] {
let key = #""roomId":""#
var re = [String]()

var ss = str
while ss.contains(key) {
ss = ss.subString(from: key)
let rid = ss.subString(to: "\"")
if let _ = Int(rid) {
re.append(rid)
}
}

return re
}
}

struct BiliLiveInfo: Unmarshaling, LiveInfo {
Expand Down
Loading

0 comments on commit ccd73f4

Please sign in to comment.