Chuyển tới nội dung chính

CoreLogic

Project: Ezy.Module.Selenium.Search.CoreLogic File chính: CoreLogicWebBrowser.cs (+ CoreLogicWebBrowserHelper.cs)

Module làm giàu dữ liệu (MoreInfo) cho bất động sản trên CoreLogic. Dùng EO.WebBrowser nhúng trong WinForm (không phải Selenium ChromeDriver), đăng nhập qua OAuth.

Nguồn

  • Site: rpp.corelogic.com.au.
  • Trang OAuth: auth.corelogic.asia/as/authorization.oauth2?....

Input

Đọc hàng đợi TextSearch_MoreInfo_Queue, lọc IsSearch == falseType == "TextSearch_CoreLogic_Asia_RP".

CộtVai trò
UrlURL khởi tạo nạp vào browser
TextSearch_Data_IdChuỗi split('_') thành 3 phần: [0] = PK của TextSearch_CoreLogic_Asia_RP, [1] = username, [2] = password
IsSearchCờ hoàn tất
SearchStatusGhi lỗi

Địa chỉ tra cứu lấy từ TextSearch_CoreLogic_Asia_RP.Name.

Login

  • Form login OAuth thực hiện bằng JavaScript injection trên auth.corelogic.asia: điền #username, #password, click #signOnButton qua webView.EvalScript(...).
  • Credential KHÔNG hardcode — đến từ TextSearch_MoreInfo_Queue.TextSearch_Data_Id (phần [1]/[2]) lưu trong DB.

Quan hệ với AutoLoad (giữ phiên sống)

Module riêng AutoLoad chạy ChromeDriver thật, đăng nhập CoreLogic định kỳ (mặc định 5 phút — ReloadIntervalMinutes), giữ phiên sống và xuất cookie (APP2SESSION-XSRF, APP2SESSION) ra Cookies.json, gửi qua UDP socket với message CoreLogic_{path}. Credential của AutoLoad nằm trong Configs/AutoLoadConfig.json (key UserName/Password).

Các bước scrape

  1. StartSearchMoreInfo(item): RefreshCache(), nạp item.Url, chờ tối đa 60s tới khi IsSearch.
  2. Mỗi lần trang nạp xong → handler WebView_LoadCompleted.
  3. Nếu URL là trang OAuth → inject login.
  4. Nếu URL == rpp.corelogic.com.au → đọc #crux-home-greeting xác nhận đã đăng nhập.
  5. Truy DB lấy TextSearch_CoreLogic_Asia_RP theo [0]; chuẩn hóa Name (bỏ "Australia", dấu phẩy) thành address.
  6. Gọi API gợi ý: rpp.corelogic.com.au/api/clapi/suggestions?limit=1&q={address}&suggestionTypes=address.
  7. Trích propertyId từ HTML bằng regex propertyId":[0-9]*.

Output

Đọc/ghi entity TextSearch_CoreLogic_Asia_RP. Nhánh xử lý hiện dừng ở bước lấy propertyId (không có screenshot/PDF trong module này).

Lỗi / edge cases

  • isFailed = true → set IsSearch = true thoát ngay.
  • TextSearch_Data_Id không tách đủ 3 phần → isFailed.
  • Name rỗng / không tìm thấy bản ghi → isFailed.
  • Exception → SearchStatus = GetException(ex) + IsSearch = true.
  • Timeout chờ kết quả: 60s. StartSearchMoreInfo bọc trong lock(_object) → chạy tuần tự. Hết hạn phiên xử lý gián tiếp qua AutoLoad.

Trạng thái: active (phụ thuộc AutoLoad giữ phiên).