Skip to content

Commit

Permalink
Fix unlock area limit for playViewUnite
Browse files Browse the repository at this point in the history
Fix #1098
  • Loading branch information
zjns committed May 16, 2023
1 parent a5214eb commit 1815d54
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -308,16 +308,18 @@ class BangumiPlayUrlHook(classLoader: ClassLoader) : BaseHook(classLoader) {
// Only handle pgc video
if (param.result != null && typeUrl != PGC_ANY_MODEL_TYPE_URL)
return@hookAfterMethod
val extraContent = request.callMethodAs<Map<String, String>>("getExtraContentMap")
val seasonId = extraContent.getOrDefault("season_id", "0")
val reqEpId = extraContent.getOrDefault("ep_id", "0").toLong()
if (seasonId == "0" && reqEpId == 0L)
return@hookAfterMethod
val supplement = supplementAny?.callMethod("getValue")
?.callMethodAs<ByteArray>("toByteArray")
?.let { PlayViewReply.parseFrom(it) } ?: playViewReply {}
if (needProxyUnite(response, supplement)) {
try {
val serializedRequest = request.callMethodAs<ByteArray>("toByteArray")
val req = PlayViewUniteReq.parseFrom(serializedRequest)
val seasonId = req.extraContentMap["season_id"].takeIf { it != "0" }
?: lastSeasonInfo["season_id"] ?: "0"
val reqEpId = req.extraContentMap["ep_id"]?.toLongOrNull() ?: 0L
val (thaiSeason, thaiEp) = getThaiSeason(seasonId, reqEpId)
val content = getPlayUrl(reconstructQueryUnite(req, supplement, thaiEp))
countDownLatch?.countDown()
Expand Down

0 comments on commit 1815d54

Please sign in to comment.