feat: implement FacebookBot class for automated group commenting using uiautomator2
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user