From 26c72fedb87bd1225f2e08b9f35eaace24e08aca Mon Sep 17 00:00:00 2001 From: Victor Phan Date: Thu, 23 Jul 2026 14:23:57 +0700 Subject: [PATCH] feat: implement FacebookBot class for automated group commenting using uiautomator2 --- serverPython/facebook_bot.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/serverPython/facebook_bot.py b/serverPython/facebook_bot.py index 47f9f74..fc44461 100644 --- a/serverPython/facebook_bot.py +++ b/serverPython/facebook_bot.py @@ -53,11 +53,12 @@ class FacebookBot: comment_btn = None for _ in range(7): # Thử vuốt tối đa 7 lần - # Thử quét bằng Regex (Không phân biệt hoa thường) ở cả description và text - c_desc_vn = self.d(descriptionMatches="(?i).*bình luận.*") - c_text_vn = self.d(textMatches="(?i).*bình luận.*") - c_desc_en = self.d(descriptionMatches="(?i).*comment.*") - c_text_en = self.d(textMatches="(?i).*comment.*") + # Sửa lỗi: Nút Thích có description là "bày tỏ cảm xúc về bình luận" nên Regex .*bình luận.* sẽ bắt nhầm nút Thích! + # Do đó ta chỉ tìm đúng chữ Bình luận đứng đầu, hoặc chữ Comment. + c_desc_vn = self.d(descriptionMatches="(?i)^bình luận$") + c_text_vn = self.d(textMatches="(?i)^bình luận$") + c_desc_en = self.d(descriptionMatches="(?i)^comment$") + c_text_en = self.d(textMatches="(?i)^comment$") if c_desc_vn.exists: comment_btn = c_desc_vn; break if c_text_vn.exists: comment_btn = c_text_vn; break