GoogleRealestate
Project:
Ezy.Module.Selenium.Search.GoogleRealestateFile 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 quaitem.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ột | Vai trò |
|---|---|
Url | Trang property cần mở |
Type | Lọc loại (engine so khớp tên type) |
TextSearch_Data_Id | Khóa liên kết tới bản ghi data |
IsSearch | Cờ done |
Login / Captcha
Không. Mở thẳng URL công khai.
Các bước scrape
StartSearchMoreInfo(item):lock,RefreshCache(),LoadUrl(item.Url), chờ tối đa 60s tới khiIsSearch.- Handler chính
WebView_LoadCompletedchia 2 trường hợp theourl.Contains("/property/"): - TH1 (không phải /property/): click
div.hero-imagemở gallery; đọcspan.hero-thumbnail__image-counterlấy tổng số ảnh; loop bấmpswp__button--arrow--rightđể duyệt, gomimg.pswp__imgsrc (Distinct()); clickdiv.static-map__imgmở Google Map rồiTakeScreenshot_WinformlưuGoogleMapImage; lưuImageURLs = JSON(list ảnh). - TH2 (trang /property/): scroll tới
h2.ma-property-summary__title, chụp Google Map. - Sau cả hai nhánh:
repoData.Update(...), setIsSearch = 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 quaSQLDataContextHelper.LogException. - Update DB lỗi →
SearchStatus = sMessage,isFailed = true.
Trạng thái: active (enrichment).