我正在刮 Zillow 并希望刮掉所有页面。我正在使用 for 循环,如下所示。但似乎我只收到第一页的结果。
for (page_result in 1:20) {
zillow_url = paste0("https://www.zillow.com/orlando-fl/",page_result,"_p/?searchQueryState=%7B%22
pagination%22%3A%7B%22currentPage%22%3A",page_result,"%7D%2C%22usersSearchTerm%22%3A%22
Orlando%2C%20Fl%22%2C%22mapBounds%22%3A%7B%22west%22%3A-81.6603646328125%2C%22east%22%3A-80.8144173671875%2C%22
south%22%3A28.191492307595613%2C%22north%22%3A28.794962421299882%7D%2C%22
regionSelection%22%3A%5B%7B%22regionId%22%3A13121%2C%22
regionType%22%3A6%7D%5D%2C%22isMapVisible%22%3Atrue%2C%22filterState%22%3A%7B%22sort%22%3A%7B%22value%22%3A%22globalrelevanceex
%22%7D%2C%22ah%22%3A%7B%22value%22%3Atrue%7D%7D%2C%22isListVisible%22%3Atrue%7D")
}
zpg = read_html(zillow_url)
res_all <-NULL
zillow_pg <-tibble(
addr = zpg %>% html_nodes(".list-card-addr") %>% html_text(),
price = zpg %>% html_nodes(".list-card-price") %>% html_text(),
details = zpg %>% html_nodes(".list-card-details") %>% html_text() ,
heading= zpg %>% html_nodes(".list-card-info a") %>% html_text() ,
type = zpg %>% html_nodes(".list-card-statusText") %>% html_text())
res_all <- res_all %>% bind_rows(zillow_pg)