修复小红书和哔哩哔哩回复后互动全流程

This commit is contained in:
2026-11-29 13:01:55 +08:00
parent 681c0678b5
commit 38dbc070a1
11 changed files with 202 additions and 46 deletions
+2 -2
View File
@@ -13,8 +13,8 @@ android {
applicationId = "com.jieliu.app" applicationId = "com.jieliu.app"
minSdk = 26 minSdk = 26
targetSdk = 35 targetSdk = 35
versionCode = 49 versionCode = 50
versionName = "0.1.48" versionName = "0.1.49"
} }
compileOptions { compileOptions {
@@ -110,9 +110,10 @@ internal class BilibiliAdapter(
engageActionButton(ui, { page -> engageActionButton(ui, { page ->
if (!navigation.matchesVideo(page, video)) return@engageActionButton null if (!navigation.matchesVideo(page, video)) return@engageActionButton null
page.visibleByViewId(viewId).singleOrNull { page.visibleByViewId(viewId).singleOrNull {
it.enabled && page.bounds.contains(it.bounds) && BilibiliLabels.videoAction(it.description, action) it.enabled && it.clickable && it.checked != null && page.bounds.contains(it.bounds) &&
BilibiliLabels.videoAction(it.description, action)
} }
}, action, "已$action", action, diagnostic) }, UiNode::checked, action, diagnostic)
} catch (error: CancellationException) { } catch (error: CancellationException) {
throw error throw error
} catch (error: Exception) { } catch (error: Exception) {
@@ -325,6 +325,8 @@ internal class BilibiliComments(
var sawList = false var sawList = false
var sawCompleteList = false var sawCompleteList = false
var sawOriginalBelowFirst = false var sawOriginalBelowFirst = false
var lastClippedViewport: Rect? = null
var expansionAttempts = 0
fun readOpenedThread(): ThreadScope? = ui.inspect { page -> fun readOpenedThread(): ThreadScope? = ui.inspect { page ->
sawHeading = sawHeading || page.hasDetailHeading() sawHeading = sawHeading || page.hasDetailHeading()
if (page.hasEditor()) return@inspect null if (page.hasEditor()) return@inspect null
@@ -335,9 +337,19 @@ internal class BilibiliComments(
val original = rows.firstOrNull()?.takeIf { it.target == target } val original = rows.firstOrNull()?.takeIf { it.target == target }
if (original == null) { if (original == null) {
sawOriginalBelowFirst = sawOriginalBelowFirst || rows.any { it.target == target } sawOriginalBelowFirst = sawOriginalBelowFirst || rows.any { it.target == target }
// 原评论常在滚动后才进视图,多滚几次再等。 val clipped = BilibiliComposeComments.clippedOriginalViewport(page, list, target)
if (clipped != null) {
// This swipe only exposes more of the same verified thread. The full row is still required below.
val previous = lastClippedViewport
if (expansionAttempts < 2 && (previous == null || clipped.top < previous.top)) {
lastClippedViewport = clipped
expansionAttempts++
ui.scrollUpInside(clipped)
}
return@inspect null
}
val backward = AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD val backward = AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD
if (movedToRoot < 3 && list.supports(backward)) { if (lastClippedViewport == null && movedToRoot < 3 && list.supports(backward)) {
movedToRoot++ movedToRoot++
list.act(backward) list.act(backward)
} }
@@ -359,7 +371,7 @@ internal class BilibiliComments(
if (thread == null) thread = ui.await(6_500, ::readOpenedThread) if (thread == null) thread = ui.await(6_500, ::readOpenedThread)
if (thread == null) { if (thread == null) {
diagnostic("哔哩哔哩评论详情诊断 标题=$sawHeading 列表=$sawList 完整列表=$sawCompleteList " + diagnostic("哔哩哔哩评论详情诊断 标题=$sawHeading 列表=$sawList 完整列表=$sawCompleteList " +
"原评论位于非首行=$sawOriginalBelowFirst 向前滚动尝试=$movedToRoot") "原评论位于非首行=$sawOriginalBelowFirst 向前滚动尝试=$movedToRoot 展开详情尝试=$expansionAttempts")
if (!sawHeading && !sawList && ui.inspect { threadEntryOnMain(it, scope, target) != null } == true) { if (!sawHeading && !sawList && ui.inspect { threadEntryOnMain(it, scope, target) != null } == true) {
return false return false
} }
@@ -157,10 +157,12 @@ internal object BilibiliComposeComments {
list: UiNode, list: UiNode,
target: (author: String, body: String) -> CommentTarget, target: (author: String, body: String) -> CommentTarget,
): List<BilibiliComments.Row> { ): List<BilibiliComments.Row> {
if (!isList(page, list)) return emptyList() val detail = detail(page)?.takeIf { it.list === list }
if (detail == null && list(page) !== list) return emptyList()
val siblings = page.children(list) val siblings = page.children(list)
return siblings.mapIndexedNotNull { index, row -> return siblings.mapIndexedNotNull { index, row ->
val identity = rowIdentity(page, list, row) ?: return@mapIndexedNotNull null val detailStart = detail?.header?.bounds?.bottom.takeIf { index == 0 }
val identity = rowIdentity(page, list, row, detailStart) ?: return@mapIndexedNotNull null
val author = identity.author.text val author = identity.author.text
val body = identity.body val body = identity.body
val reply = footerAction(page, list, row, REPLY_LABELS) ?: return@mapIndexedNotNull null val reply = footerAction(page, list, row, REPLY_LABELS) ?: return@mapIndexedNotNull null
@@ -191,13 +193,32 @@ internal object BilibiliComposeComments {
/** The native count must account for every visible nested row before proving a full thread. */ /** The native count must account for every visible nested row before proving a full thread. */
fun completeThread(page: UiPage, list: UiNode, nestedCount: Int): Boolean { fun completeThread(page: UiPage, list: UiNode, nestedCount: Int): Boolean {
if (!page.complete || detail(page)?.list !== list) return false if (!page.complete) return false
val counts = page.children(list).flatMap { page.children(it) }.mapNotNull { marker -> val detail = detail(page)?.takeIf { it.list === list } ?: return false
val rows = page.children(list)
val counts = rows.flatMap { page.children(it) }.mapNotNull { marker ->
if (marker.className != TEXT_VIEW || marker.clickable || !list.bounds.contains(marker.bounds)) return@mapNotNull null if (marker.className != TEXT_VIEW || marker.clickable || !list.bounds.contains(marker.bounds)) return@mapNotNull null
THREAD_TOTAL.matchEntire(marker.text)?.groupValues?.get(1)?.toIntOrNull() THREAD_TOTAL.matchEntire(marker.text)?.groupValues?.get(1)?.toIntOrNull()
} }
if (counts.singleOrNull() != nestedCount) return false if (counts.singleOrNull() != nestedCount) return false
return page.children(list).count { rowIdentity(page, list, it) != null } == nestedCount + 1 return rows.withIndex().count { (index, row) ->
val detailStart = detail.header.bounds.bottom.takeIf { index == 0 }
rowIdentity(page, list, row, detailStart) != null
} == nestedCount + 1
}
/** A partly raised reply sheet can expose the original's identity above a clipped footer. */
fun clippedOriginalViewport(page: UiPage, list: UiNode, target: CommentTarget): Rect? {
if (!page.complete || !list.scrollable) return null
val detail = detail(page)?.takeIf { it.list === list } ?: return null
if (list.bounds.top - detail.header.bounds.bottom < detail.header.bounds.height()) return null
val first = page.children(list).firstOrNull() ?: return null
if (first.bounds.top != list.bounds.top || first.bounds.bottom != list.bounds.bottom) return null
val identity = rowIdentity(page, list, first) ?: return null
if (identity.author.text != target.author || identity.body.description != target.text ||
footerAction(page, list, first, REPLY_LABELS) != null
) return null
return Rect(list.bounds)
} }
private fun composeList(page: UiPage, compose: UiNode, staticDetailPanel: UiNode? = null): UiNode? = private fun composeList(page: UiPage, compose: UiNode, staticDetailPanel: UiNode? = null): UiNode? =
@@ -222,13 +243,17 @@ internal object BilibiliComposeComments {
} == 1 } == 1
} }
private fun rowIdentity(page: UiPage, list: UiNode, row: UiNode): Identity? { private fun rowIdentity(page: UiPage, list: UiNode, row: UiNode, detailStart: Int? = null): Identity? {
if (row.className != VIEW || row.directParent() !== list || !row.biliClick() || row.editable || if (row.className != VIEW || row.directParent() !== list || !row.biliClick() || row.editable ||
row.bounds.width() < list.bounds.width() * .90 || !list.bounds.contains(row.bounds) row.bounds.width() < list.bounds.width() * .90
) return null ) return null
val visible = Rect(row.bounds)
// The first detail row can begin at the header edge, above the list's top inset.
if (visible.top == detailStart && visible.top < list.bounds.top) visible.top = list.bounds.top
if (!list.bounds.contains(visible)) return null
val children = page.children(row) val children = page.children(row)
val author = children.singleOrNull { val author = children.singleOrNull {
it.className == BUTTON && it.biliClick() && row.bounds.contains(it.bounds) && it.className == BUTTON && it.biliClick() && visible.contains(it.bounds) &&
it.text.isNotBlank() && it.text == it.description it.text.isNotBlank() && it.text == it.description
} ?: return null } ?: return null
// A short author name has a square touch target that extends past the rendered label. // A short author name has a square touch target that extends past the rendered label.
@@ -238,7 +263,7 @@ internal object BilibiliComposeComments {
val body = children.singleOrNull { val body = children.singleOrNull {
it.className == VIEW && !it.clickable && !it.editable && it.text.isEmpty() && it.description.isNotBlank() && it.className == VIEW && !it.clickable && !it.editable && it.text.isEmpty() && it.description.isNotBlank() &&
it.bounds.top >= bodyTop && it.bounds.left <= author.bounds.centerX() && it.bounds.top >= bodyTop && it.bounds.left <= author.bounds.centerX() &&
it.bounds.width() >= row.bounds.width() * .50 && row.bounds.contains(it.bounds) it.bounds.width() >= row.bounds.width() * .50 && visible.contains(it.bounds)
} ?: return null } ?: return null
return Identity(author, body) return Identity(author, body)
} }
@@ -41,21 +41,36 @@ internal fun engageActionButton(
donePrefix: String, donePrefix: String,
name: String, name: String,
diagnostic: (String) -> Unit, diagnostic: (String) -> Unit,
): EngagementAction = engageActionButton(ui, find, { node ->
when {
node.description.startsWith(donePrefix) -> true
node.description.startsWith(pendingPrefix) -> false
else -> null
}
}, name, diagnostic)
/** [readChecked] returns null when the button's current state cannot be verified. */
internal fun engageActionButton(
ui: AccessibleUi,
find: (UiPage) -> UiNode?,
readChecked: (UiNode) -> Boolean?,
name: String,
diagnostic: (String) -> Unit,
): EngagementAction { ): EngagementAction {
ui.pace() ui.pace()
val button = ui.await(3_000) { val button = ui.await(3_000) {
ui.inspect { page -> find(page)?.let { it.description to it.bounds } } ui.inspect { page -> find(page)?.let { Triple(it.description, it.bounds, readChecked(it)) } }
} }
if (button == null) { if (button == null) {
diagnostic("${name}未找到按钮") diagnostic("${name}未找到按钮")
return EngagementAction.FAILED return EngagementAction.FAILED
} }
val (description, bounds) = button val (description, bounds, checked) = button
if (description.startsWith(donePrefix)) { if (checked == true) {
diagnostic("${name}已是目标状态 $description") diagnostic("${name}已是目标状态 $description")
return EngagementAction.SKIPPED return EngagementAction.SKIPPED
} }
if (!description.startsWith(pendingPrefix)) { if (checked == null) {
diagnostic("${name}状态无法识别 $description") diagnostic("${name}状态无法识别 $description")
return EngagementAction.FAILED return EngagementAction.FAILED
} }
@@ -64,7 +79,7 @@ internal fun engageActionButton(
val dispatched = ui.touch(x, y, x, y, 85) val dispatched = ui.touch(x, y, x, y, 85)
diagnostic("${name}触屏($x,$y)=$dispatched") diagnostic("${name}触屏($x,$y)=$dispatched")
val flipped = ui.await(5_000) { val flipped = ui.await(5_000) {
ui.inspect { page -> true.takeIf { find(page)?.description?.startsWith(donePrefix) == true } } ui.inspect { page -> true.takeIf { find(page)?.let(readChecked) == true } }
} == true } == true
diagnostic("${name}核对=$flipped") diagnostic("${name}核对=$flipped")
return if (flipped) EngagementAction.DONE else EngagementAction.FAILED return if (flipped) EngagementAction.DONE else EngagementAction.FAILED
@@ -8,10 +8,21 @@ import com.jieliu.app.task.PendingComment
import com.jieliu.app.task.TemplatePhoto import com.jieliu.app.task.TemplatePhoto
import java.io.Closeable import java.io.Closeable
import java.security.MessageDigest import java.security.MessageDigest
import java.util.concurrent.CancellationException
import kotlin.math.abs import kotlin.math.abs
enum class XiaohongshuNoteKind { ANY, IMAGE, VIDEO } enum class XiaohongshuNoteKind { ANY, IMAGE, VIDEO }
internal enum class XiaohongshuEngagementControl(val label: String) {
LIKE("点赞"), FAVORITE("收藏");
val donePrefix = "已$label"
// The same toolbar can use a space before the counter only while the button is unselected.
private val description = Regex("(?:已)?$label(?:\\s*[0-9]+(?:\\.[0-9]+)?(?:万|亿)?\\+?)?")
fun matches(value: String): Boolean = description.matches(value)
}
internal class XiaohongshuAdapter( internal class XiaohongshuAdapter(
private val spec: PlatformSpec, private val spec: PlatformSpec,
private val ui: AccessibleUi, private val ui: AccessibleUi,
@@ -412,8 +423,8 @@ internal class XiaohongshuAdapter(
it.bounds.centerY() >= y(.76f) && it.bounds.centerX() <= x(.49f) && it.isNativeClick() } ?: return null it.bounds.centerY() >= y(.76f) && it.bounds.centerX() <= x(.49f) && it.isNativeClick() } ?: return null
val toolbar = prompt.directParent()?.takeIf { it.className == "android.view.ViewGroup" } ?: return null val toolbar = prompt.directParent()?.takeIf { it.className == "android.view.ViewGroup" } ?: return null
val buttons = nodes.filter { it.directParent() === toolbar && it.className == "android.widget.Button" && it.isNativeClick() } val buttons = nodes.filter { it.directParent() === toolbar && it.className == "android.widget.Button" && it.isNativeClick() }
if (buttons.count { likeLabel.matches(it.description) } != 1 || if (buttons.count { XiaohongshuEngagementControl.LIKE.matches(it.description) } != 1 ||
buttons.count { favoriteLabel.matches(it.description) } != 1) return null buttons.count { XiaohongshuEngagementControl.FAVORITE.matches(it.description) } != 1) return null
if (buttons.count { commentLabel.matches(it.description) && it.bounds.centerX() >= x(.75f) } != 1) return null if (buttons.count { commentLabel.matches(it.description) && it.bounds.centerX() >= x(.75f) } != 1) return null
return NoteControls(author, more, toolbar) return NoteControls(author, more, toolbar)
} }
@@ -648,28 +659,32 @@ internal class XiaohongshuAdapter(
/** 回复确认后点击笔记底部工具栏的点赞和/或收藏。状态前缀「已」表示已完成,不重复点击以免误取消。 */ /** 回复确认后点击笔记底部工具栏的点赞和/或收藏。状态前缀「已」表示已完成,不重复点击以免误取消。 */
override fun engage(video: VideoContext, like: Boolean, favorite: Boolean): EngagementResult { override fun engage(video: VideoContext, like: Boolean, favorite: Boolean): EngagementResult {
if (!like && !favorite) return EngagementResult() val note = activeNote?.takeIf { it.video.key == video.key }
fun only(enabled: Boolean, action: EngagementAction) = if (enabled) action else EngagementAction.SKIPPED return EngagementResult(
val failed = EngagementResult(only(like, EngagementAction.FAILED), only(favorite, EngagementAction.FAILED)) like = if (like) engageButton(note, XiaohongshuEngagementControl.LIKE) else EngagementAction.SKIPPED,
return try { favorite = if (favorite) engageButton(note, XiaohongshuEngagementControl.FAVORITE) else EngagementAction.SKIPPED,
val note = activeNote?.takeIf { it.video.key == video.key } ?: return failed
EngagementResult(
only(like, engageActionButton(ui, { page -> page.engagementButton(note, likeLabel) },
likePendingPrefix, engagementDonePrefix, "点赞", diagnostic)),
only(favorite, engageActionButton(ui, { page -> page.engagementButton(note, favoriteLabel) },
favoritePendingPrefix, engagementDonePrefix, "收藏", diagnostic)),
) )
}
private fun engageButton(note: NoteBinding?, control: XiaohongshuEngagementControl): EngagementAction {
if (note == null || commentNote != null) return EngagementAction.FAILED
return try {
engageActionButton(ui, { page -> page.engagementButton(note, control) },
control.label, control.donePrefix, control.label, diagnostic)
} catch (error: CancellationException) {
throw error
} catch (_: Exception) { } catch (_: Exception) {
failed EngagementAction.FAILED
} }
} }
/** 笔记工具栏里的互动按钮。小红书不暴露资源 ID,只能按描述识别。 */ /** 笔记工具栏里的互动按钮。小红书不暴露资源 ID,只能按描述识别。 */
private fun UiPage.engagementButton(note: NoteBinding, label: Regex): UiNode? { private fun UiPage.engagementButton(note: NoteBinding, control: XiaohongshuEngagementControl): UiNode? {
if (nodes.any { it.editable && (it.focused || it.hasDraft()) }) return null
val toolbar = boundNote(note)?.toolbar ?: return null val toolbar = boundNote(note)?.toolbar ?: return null
return nodes.filter { return nodes.filter {
it.directParent() === toolbar && it.className == "android.widget.Button" && it.isNativeClick() && it.directParent() === toolbar && it.className == "android.widget.Button" && it.isNativeClick() &&
label.matches(it.description) bounds.contains(it.bounds) && toolbar.bounds.contains(it.bounds) && control.matches(it.description)
}.singleOrNull() }.singleOrNull()
} }
@@ -712,13 +727,6 @@ internal class XiaohongshuAdapter(
private companion object { private companion object {
const val COUNTER = "(?:\\s+[0-9]+(?:\\.[0-9]+)?(?:万|亿)?\\+?)?" const val COUNTER = "(?:\\s+[0-9]+(?:\\.[0-9]+)?(?:万|亿)?\\+?)?"
val likeLabel = Regex("(?:已)?点赞$COUNTER")
val favoriteLabel = Regex("(?:已)?收藏$COUNTER")
// 工具栏按钮描述形如「点赞 298」,已操作时加「已」前缀。
const val likePendingPrefix = "点赞"
const val favoritePendingPrefix = "收藏"
const val engagementDonePrefix = "已"
val commentLabel = Regex("评论$COUNTER") val commentLabel = Regex("评论$COUNTER")
val zeroComments = Regex("评论\\s+0") val zeroComments = Regex("评论\\s+0")
val whitespace = Regex("\\s+") val whitespace = Regex("\\s+")
@@ -132,7 +132,11 @@ internal class XiaohongshuComments(
fun close() { fun close() {
val session = active ?: return val session = active ?: return
if (session.inline) { if (session.inline) {
if (ui.inspect { page -> matchesNote(page, session.note) && !page.hasActiveDraft() } != true) { // Returning from the ownership menu is asynchronous. Wait without acting on any window.
val restored = ui.await(4_000) {
ui.inspect { page -> true.takeIf { matchesNote(page, session.note) && !page.hasActiveDraft() } }
}
if (restored != true) {
throw PlatformException("小红书原笔记或评论草稿状态已变化") throw PlatformException("小红书原笔记或评论草稿状态已变化")
} }
} else { } else {
@@ -232,7 +232,7 @@ internal class TaskRunner(
receiptPhase("打开目标应用") { platform.launch() } receiptPhase("打开目标应用") { platform.launch() }
} }
status("正在定位待核对的$contentUnit") status("正在定位待核对的$contentUnit")
val video = receiptPhase("定位原$contentUnit") { locateVideo(platform.search(type.name), checkpoint) } val video = receiptPhase("定位原$contentUnit") { locateVideoForReceipt(type.name, checkpoint, pending) }
requireRunning(cancelled) requireRunning(cancelled)
store.appendLog("已重新定位待核对的原$contentUnit") store.appendLog("已重新定位待核对的原$contentUnit")
status("正在打开待核对的${contentUnit}评论区") status("正在打开待核对的${contentUnit}评论区")
@@ -244,6 +244,21 @@ internal class TaskRunner(
.also { requireRunning(cancelled) } .also { requireRunning(cancelled) }
} }
private fun locateVideoForReceipt(typeName: String, checkpoint: TaskCheckpoint, pending: PendingComment): VideoContext {
val title = pending.title.trim()
if (bilibili && title.isNotBlank() && title != typeName) {
try {
return locateVideo(platform.search(title), checkpoint, pending.videoKey)
} catch (error: Exception) {
if (error is CancellationException || (error !is PlatformException && error !is IllegalStateException)) {
throw error
}
requireRunning(cancelled)
}
}
return locateVideo(platform.search(typeName), checkpoint, pending.videoKey)
}
private inline fun <T> receiptPhase(stage: String, action: () -> T): T = try { private inline fun <T> receiptPhase(stage: String, action: () -> T): T = try {
action() action()
} catch (error: Exception) { } catch (error: Exception) {
@@ -0,0 +1,25 @@
package com.jieliu.app.platform
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
class XiaohongshuEngagementControlTest {
@Test fun toolbarRecognizesBothStatesWithOrWithoutSpaces() {
listOf("点赞 3053", "点赞3053", "已点赞3054", "已点赞 3054", "点赞", "已点赞1.2万+").forEach {
assertTrue(it, XiaohongshuEngagementControl.LIKE.matches(it))
}
listOf("收藏 1037", "收藏1037", "已收藏1038", "已收藏 1038", "收藏", "已收藏2万").forEach {
assertTrue(it, XiaohongshuEngagementControl.FAVORITE.matches(it))
}
}
@Test fun toolbarDoesNotUseOtherActionsOrCommentTextAsButtons() {
listOf("收藏 1037", "取消点赞", "已点赞 3054 次", "评论点赞 2").forEach {
assertFalse(it, XiaohongshuEngagementControl.LIKE.matches(it))
}
listOf("已点赞3054", "收藏夹 1037", "已收藏 1038 次", "评论 607").forEach {
assertFalse(it, XiaohongshuEngagementControl.FAVORITE.matches(it))
}
}
}
@@ -332,6 +332,29 @@ class TaskRunnerTest {
assertEquals(pending.copy(armedAtEpochMs = null), legacy.checkpoint.pending) assertEquals(pending.copy(armedAtEpochMs = null), legacy.checkpoint.pending)
} }
@Test fun bilibiliRecheckSearchesTheSavedTitleBeforeFallingBackToTheContentType() {
val plan = plan(firstType).copy(platformId = "bilibili")
val pending = PendingComment("video-0", "原视频标题", "已提交的话术", targetKey = "original",
targetAuthor = "测试用户", armedAtEpochMs = System.currentTimeMillis())
for (titleUnavailable in listOf(false, true)) {
val store = RecordingStore(TaskCheckpoint("bili-title-recheck", plan).startVideo(pending.videoKey).arm(pending))
val platform = FakePlatform(store).apply {
recheckResult = CommentPublishResult.CONFIRMED
onSearch = { query ->
if (titleUnavailable && query == pending.title) throw PlatformException("标题搜索暂不可用")
}
}
execute(store, platform, recheckPending = true)
val expectedSearches = if (titleUnavailable) listOf(pending.title, firstType.name) else listOf(pending.title)
assertEquals(expectedSearches, platform.searches)
assertEquals(listOf(pending.videoKey to pending), platform.rechecks)
assertEquals(0, platform.publishCalls)
assertEquals(Outcome.SENT, store.checkpoint.receipts.single().outcome)
}
}
@Test fun browseUsesOnlySelectedTypeWithoutOpeningTheCommentPanel() { @Test fun browseUsesOnlySelectedTypeWithoutOpeningTheCommentPanel() {
val plan = plan(firstType, secondType).copy(selectedTypeId = secondType.id, replyMode = ReplyMode.BROWSE) val plan = plan(firstType, secondType).copy(selectedTypeId = secondType.id, replyMode = ReplyMode.BROWSE)
val store = RecordingStore(TaskCheckpoint("browse", plan)) val store = RecordingStore(TaskCheckpoint("browse", plan))
@@ -712,6 +735,7 @@ class TaskRunnerTest {
val unavailable = mutableSetOf<String>() val unavailable = mutableSetOf<String>()
var knownBaseline = false var knownBaseline = false
var recheckResult = CommentPublishResult.UNCERTAIN var recheckResult = CommentPublishResult.UNCERTAIN
var onSearch: (String) -> Unit = {}
var onScroll: () -> Unit = {} var onScroll: () -> Unit = {}
var onPrepare: (Boolean) -> Unit = {} var onPrepare: (Boolean) -> Unit = {}
var beforePublish: () -> Unit = {} var beforePublish: () -> Unit = {}
@@ -739,6 +763,7 @@ class TaskRunnerTest {
override fun search(keyword: String): VideoContext { override fun search(keyword: String): VideoContext {
searches.add(keyword) searches.add(keyword)
onSearch(keyword)
nextKey = firstVideoBySearch.getOrPut(keyword) { nextKey } nextKey = firstVideoBySearch.getOrPut(keyword) { nextKey }
return showVideo("样片-$keyword") return showVideo("样片-$keyword")
} }
+27 -1
View File
@@ -1,6 +1,32 @@
# 拾见开发进度 # 拾见开发进度
最近更新于 2026-11-28 22:48(UTC+8)。以下按开发轮次倒序记录。 最近更新于 2026-11-29 13:01(UTC+8)。以下按开发轮次倒序记录。
## 2026-11-29 · 拾见 0.1.49 小红书与哔哩哔哩回复后互动
- 小红书关闭图文评论区时,会等待本人菜单退出后重新核对同一笔记及草稿状态。点赞和收藏分别按各自开关执行。互动标签兼容数字前有空格和无空格两种原生格式,仍从同一笔记的工具栏定位按钮。
- 哔哩哔哩在原评论长图裁切时,只在核对作者和正文完全一致后尝试展开详情。识别首行时兼容原评论卡片上缘与列表轻微重叠,仍要求完整原评论操作栏和回复线程。原失败视频的 39 条子回复未完整出现在列表中,真机按规则安全跳过并结束任务。
- 哔哩哔哩核对已提交回复时,优先用保存的完整标题搜索,必要时再用原内容类型搜索,两条路径均核对原视频标识。点赞收藏改读对应按钮的原生勾选状态,同一状态不会重复点击。
- vivo Android 12、小红书 9.54.0。12:56 在一条未互动的新图文笔记命中关键词,同一任务确认一条本人回复并写入 `SENT`。两项互动均回读成功,平台原生标签由「点赞 1542」「收藏 408」变为「已点赞1543」「已收藏409」。
- 同一真机、哔哩哔哩 9.21.0。最终装机包先复核前一条已发送回复和两项已勾选状态,确认时没有重发或重复点击。随后在另一条初始点赞、收藏均未勾选的视频上跑正式任务,12:59 命中关键词并提交。13:00 同一任务重新定位原视频,核对原评论下的本人回复并写入一条 `SENT`,随后点赞、收藏各一次并读到两项勾选状态翻转。核对的目标与预检一致,无待确认发送。
- 94 项 JVM 单元测试通过,Lint 为 0 个错误、5 个既有警告。哔哩哔哩 15 项评论回放及互动状态回放通过。最终调试 APK 通过 v2 签名校验,装机文件与本地 SHA-256 一致。真机配置、原检查点、运行日志和无障碍设置均已恢复并核对。
## 2026-11-29 · 拾见 0.1.48 四平台真机验收
- 在 vivo Android 12 上使用 0.1.48,装机 APK 的 SHA-256 与本地构建一致。每个平台验收 5 个不同内容,每个内容最多回复一次,两项互动开关同时开启。使用现有纯文字话术,搜索词为 `chatgpt`,抖音、小红书和哔哩哔哩的评论关键词为 `gpt`,快手用 `chatgpt`。
| 平台 | 内容数 | 确认回复 | 点赞状态变化 | 收藏状态变化 | 全流程通过 |
| --- | ---: | ---: | ---: | ---: | ---: |
| 抖音 39.8.0 | 5 | 2 | 2 | 2 | 2 |
| 小红书 9.54.0 | 5 | 3 | 0 | 0 | 0 |
| 哔哩哔哩 9.21.0 | 5 | 0 | 0 | 0 | 0 |
| 快手 14.10.40.51486 | 5 | 1 | 1 | 1 | 1 |
- 抖音第 1、4 条命中关键词、确认回复并读到两项互动的状态翻转。第 2 条内容无法识别,第 3、5 条未找到可回复的匹配评论。
- 小红书第 2、3、4 条均在原评论下核对到本人回复。每次写入 `SENT` 后收起评论区时均报「小红书原笔记或评论草稿状态已变化」,两项互动均未触发。通过原测试检查点继续完成剩余用例,第 1、5 条未找到可回复的匹配评论。
- 哔哩哔哩开始时需手动打开官方搜索页。第 1、2、3、5 条未找到可回复的匹配评论。第 4 条两次进入回复详情后均无法核对原评论,停在提交前。已归档两次失败证据,在临时测试检查点中隔离第 4 条以继续第 5 条。第 4 条按失败计。
- 快手第 3 条命中关键词,在原评论下核对到本人文字回复,随后读到点赞和收藏的状态翻转。第 1、2、4、5 条未找到可回复的匹配评论。
- 本轮最终确认 6 条回复和 3 条全流程通过,无待核对发送。小红书的回复后互动、哔哩哔哩的回复与后续互动仍待通过。测试回执与日志已归档,手机原配置、原检查点、运行日志和无障碍设置已恢复并核对。
## 2026-11-28 · 拾见 0.1.48 哔哩哔哩和快手评论区恢复 ## 2026-11-28 · 拾见 0.1.48 哔哩哔哩和快手评论区恢复