所以我正在用R写一个网络刮刀来搜索zillow,了解西澳州每个县的房屋中值。我正在使用rvest包,这里是有问题的代码:
URL <- "https://en.wikipedia.org/wiki/List_of_counties_in_Washington"
wiki <- html(URL)
#Getting the list of counties in WA
counties <- wiki %>%
html_nodes(".wikitable td:nth-child(1) a") %>%
html_text()
#Putting together a list to pull my search terms from
searchTerms <- list()
for(i in 1:length(counties)) {
searchTerms[[i]] <- paste0(counties[i], ", WA", sep="")
}
searchTerms <- gsub(",", "", searchTerms)
searchTerms <- gsub(" ", "-", searchTerms)
homeValues <- list()
#Getting the HTML for each county using the search terms in the URL,
#eventually it will pull the homeValues data from that HTML.
for(j in 1:length(searchTerms)){
zillowURL <- paste0("www.zillow.com/", searchTerms[j], "/home-values/", sep="")
zillowHTML <- html(zillowURL)
}
我还没有完成,当然,但是当我运行此代码时,我收到错误消息
&#34;错误:文件www.zillow.com/Adams-County-WA/home-values/没有 存在&#34;
,华盛顿州亚当斯县是华盛顿州第一个按字母顺序排列的县。我的猜测是,这与Zillow的网站如何运作有关?当我在浏览器中访问上述URL时,它可以正常工作。
答案 0 :(得分:5)
尝试修改代码中的一行:
<android.support.design.internal.NavigationMenuItemView
...
android:textAppearance="?attr/textAppearanceListItem"
然后不应出现错误消息。整个网址都是必需的,包括&#34; http://&#34;在开始时,哪些Web浏览器认为是理所当然的。