diff --git a/serverPython/facebook_bot.py b/serverPython/facebook_bot.py index 31a100d..47f9f74 100644 --- a/serverPython/facebook_bot.py +++ b/serverPython/facebook_bot.py @@ -35,8 +35,9 @@ class FacebookBot: has_image = self.push_image_to_gallery(local_image_path) logging.info(f"Khởi động Facebook và vào Group ID: {group_id}...") - # Dùng lệnh ADB shell để mở thẳng Deep Link của Group - self.d.shell(f'am start -a android.intent.action.VIEW -d "fb://group/{group_id}"') + # Dùng lệnh ADB shell để mở thẳng URL của Group (Ép mở bằng app Facebook) + # Dùng https:// thay vì fb:// vì một số Group bị lỗi deep link "Không hiển thị" + self.d.shell(f'am start -a android.intent.action.VIEW -d "https://www.facebook.com/groups/{group_id}" com.facebook.katana') time.sleep(8) # Đợi load giao diện group self.dump_ui_for_debug("fb_step1_open_group.xml") diff --git a/serverPython/main.py b/serverPython/main.py index f630d6a..6e6cab3 100644 --- a/serverPython/main.py +++ b/serverPython/main.py @@ -93,8 +93,8 @@ def post_facebook_comment(req: FacebookCommentRequest): logging.info(f"Đã xóa ảnh tạm: {local_image_path}") if isinstance(result, dict) and "status" in result: - if result["status"] == "error": - raise HTTPException(status_code=500, detail=result.get("message")) + # Trả về luôn JSON kết quả, n8n sẽ nhận HTTP 200 và tiếp tục vòng lặp + # Ngay cả khi status == "error", ta vẫn muốn n8n chạy tiếp nhóm khác return result return {"status": "success", "message": "Hoàn tất"}