百度扫码登录优化

This commit is contained in:
lushunming 2025-10-17 11:52:46 +08:00
parent bb57f23567
commit 932e6ebab5
5 changed files with 17 additions and 6 deletions

View File

@ -164,10 +164,16 @@ class BaiDuYunHandler private constructor() {
SpiderDebug.log("百度登录成功设置cookie${bduss}")
cookies = "BDUSS=$bduss"
cookies = generateCooike(loginResponse.resp["set-cookie"])
cache.setUser(User.objectFrom(this.cookies))
if (cookies.isNotEmpty()) {
cache.setUser(User.objectFrom(this.cookies))
//停止检验线程,关闭弹窗
stopService()
Notify.show("百度登录成功")
}
mapOf("success" to true, "bduss" to bduss)
} else {
mapOf("error" to "登录失败: $cleanLoginResponse")

View File

@ -10,6 +10,7 @@ import com.github.catvod.utils.Util
import com.github.catvod.utils.Util.MEDIA
import com.google.gson.JsonObject
import java.util.*
import java.util.concurrent.atomic.AtomicInteger
object BaiduDrive {
private val cache = mutableMapOf<String, String>();
@ -38,10 +39,14 @@ object BaiduDrive {
}
fun processShareLinks(urls: List<String>): Pair<List<String>, List<String>> {
val retry = AtomicInteger(3)
//首先确保cookie不为空
if (cookies.isEmpty()) {
if (cookies.isEmpty() && retry.get() > 0) {
BaiDuYunHandler.get().startScan()
cookies = BaiDuYunHandler.get().token
Thread.sleep(10000)
retry.decrementAndGet()
processShareLinks(urls)
}
if (urls.isEmpty()) return emptyList<String>() to emptyList()

Binary file not shown.

View File

@ -1 +1 @@
61a0fb4612a2a5b5a0586e89e9f1c0d0
11bbc41a3dab2b417fb77d70c031dabf

View File

@ -1,5 +1,5 @@
{
"spider": "https://andoridspidermt.netlify.app/jar/custom_spider.jar;md5;61a0fb4612a2a5b5a0586e89e9f1c0d0",
"spider": "https://andoridspidermt.netlify.app/jar/custom_spider.jar;md5;11bbc41a3dab2b417fb77d70c031dabf",
"lives": [
{
"name": "电视直播",