> library(rvest)
> library(plyr)
> city <- 'guangzhou'
> date <- '201709'
> baseUrl <- 'http://lishi.tianqi.com/'
> Url <- paste(baseUrl, city, '/', date, '.html', sep = '')
>
> content <- Url %>%
+ read_html(encoding='GBK') %>%
+ html_nodes('div.flex thalin') %>%
+ html_nodes("li") %>%
+ html_text()
Error in read_xml.raw(raw, encoding = encoding, base_url = base_url, as_html = as_html, :
input conversion failed due to input error, bytes 0xB4 0x39 0xE6 0x9C [6003]
>
> head(content)
Error in head(content) : object 'content' not found
>
R语言rvest爬取天气网中的历史天气信息整体思路 我们进入天气网首页:http://lishi.tianqi.com/,以广州2017年09月历史天气为例,把当前页面切换到广州天气页面,如下图: 继续往下滚动页面,...