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

GoogleRealestate

Project: Ezy.Module.Selenium.Search.GoogleRealestate File chính: GoogleRealestateWebBrowser.cs (+ GoogleRealestateWebBrowserHelper.cs)

Module làm giàu dữ liệu (MoreInfo) cho listing bất động sản. Không tìm theo từ khóa — mở trực tiếp URL property đã có và bóc ảnh + ảnh Google Map. Dùng EO.WebBrowser trong WinForm.

Nguồn

  • Site: realestate.com.au. URL property truyền vào qua item.Url (lấy từ hàng đợi DB). Phân nhánh theo URL chứa /property/.

Input

Đọc hàng đợi TextSearch_MoreInfo_Queue (engine lọc !IsSearch).

CộtVai trò
UrlTrang property cần mở
TypeLọc loại (engine so khớp tên type)
TextSearch_Data_IdKhóa liên kết tới bản ghi data
IsSearchCờ done

Login / Captcha

Không. Mở thẳng URL công khai.

Các bước scrape

  1. StartSearchMoreInfo(item): lock, RefreshCache(), LoadUrl(item.Url), chờ tối đa 60s tới khi IsSearch.
  2. Handler chính WebView_LoadCompleted chia 2 trường hợp theo url.Contains("/property/"):
  3. TH1 (không phải /property/): click div.hero-image mở gallery; đọc span.hero-thumbnail__image-counter lấy tổng số ảnh; loop bấm pswp__button--arrow--right để duyệt, gom img.pswp__img src (Distinct()); click div.static-map__img mở Google Map rồi TakeScreenshot_Winform lưu GoogleMapImage; lưu ImageURLs = JSON(list ảnh).
  4. TH2 (trang /property/): scroll tới h2.ma-property-summary__title, chụp Google Map.
  5. Sau cả hai nhánh: repoData.Update(...), set IsSearch = true.

Output

Entity TextSearch_Data_Google_RealEstate. Ghi: ImageURLs (JSON list ảnh property), GoogleMapImage (đường dẫn screenshot map). Các field khác (Address, Beds, BathRooms, LandSize, PropertyType, PropertyPrice, Agency/Agent JSON…) không được set trong file này — module chỉ bổ sung ảnh + map.

Lỗi / edge cases

  • Property không có ảnh → SearchStatus = "This property does not have images.".
  • Exception → isFailed = true, SearchStatus = GetException(ex), IsSearch = true; log qua SQLDataContextHelper.LogException.
  • Update DB lỗi → SearchStatus = sMessage, isFailed = true.

Trạng thái: active (enrichment).