Skip to content

Commit

Permalink
fix bilibili dynamic push
Browse files Browse the repository at this point in the history
  • Loading branch information
kukume committed Jun 6, 2024
1 parent 4dbd806 commit ac60f06
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ class LoginExtension(
callback("nodeSeekLogin") {
editMessageText("请选择NodeSeek的登陆方式\n注意:使用账号密码登录,可能使用无头浏览器无法通过recaptchav3,通过recaptchav2需要前往/config配置2captcha密钥,建议抓取cookie登录", InlineKeyboardMarkup(
arrayOf(inlineKeyboardButton("使用cookie登陆", "nodeSeekCookieLogin")),
arrayOf(inlineKeyboardButton("使用账号密码登陆", "nodeSeekPasswordLogin")),
// arrayOf(inlineKeyboardButton("使用账号密码登陆", "nodeSeekPasswordLogin")),
))
}
callback("nodeSeekCookieLogin") {
Expand Down
13 changes: 10 additions & 3 deletions src/main/kotlin/me/kuku/telegram/logic/BiliBiliLogic.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,14 @@ object BiliBiliLogic {
biliBiliPojo.rid = descJsonNode.getString("rid")
biliBiliPojo.time = (descJsonNode.getString("timestamp") + "000").toLong()
biliBiliPojo.bvId = descJsonNode.get("bvid")?.asText() ?: ""
biliBiliPojo.isForward = forwardJsonNode != null
if (forwardJsonNode != null) {
biliBiliPojo.isForward = !forwardJsonNode.isNull
if (!forwardJsonNode.isNull) {
biliBiliPojo.forwardBvId = forwardJsonNode["bvid"]?.asText() ?: ""
if (biliBiliPojo.forwardBvId.isEmpty()) {
val rid = forwardJsonNode["rid"].asInt()
if (rid != 0)
biliBiliPojo.forwardBvId = "av$rid"
}
forwardJsonNode.get("timestamp")?.asText()?.let {
biliBiliPojo.forwardTime = (it + "000").toLong()
}
Expand Down Expand Up @@ -91,14 +96,16 @@ object BiliBiliLogic {
biliBiliPojo.ipFrom = location
}
val originStr = cardJsonNode["origin"]?.asText()
if (originStr != null) {
if (originStr != null && (originStr.startsWith("{") || originStr.startsWith("["))) {
val forwardPicList = biliBiliPojo.forwardPicList
val forwardContentJsonNode = originStr.toJsonNode()
if (biliBiliPojo.forwardBvId.isNotEmpty()) {
forwardContentJsonNode["pic"]?.let {
forwardPicList.add(it.asText())
}
}
val ctime = forwardContentJsonNode["ctime"].asInt()
biliBiliPojo.forwardTime = ctime * 1000L
if (forwardContentJsonNode.contains("item")) {
val forwardItemJsonNode = forwardContentJsonNode["item"]
biliBiliPojo.forwardText = forwardItemJsonNode["description"]?.asText() ?: ""
Expand Down

0 comments on commit ac60f06

Please sign in to comment.