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