【发布时间】:2020-12-11 20:34:22
【问题描述】:
我正在抓取 this 网站并收到一条错误消息,即 tibble 列必须具有兼容的大小。
这种情况我该怎么办?
library(rvest)
library(tidyverse)
url <- "https://www.zomato.com/tr/toronto/drinks-and-nightlife?page=5"
map_dfr(
.x = url,
.f = function(x) {
tibble(
url = x,
place = read_html(x) %>%
html_nodes("a.result-title.hover_feedback.zred.bold.ln24.fontsize0") %>%
html_attr("title"),
price = read_html(x) %>%
html_nodes("div.res-cost.clearfix span.col-s-11.col-m-12.pl0") %>%
html_text()
)
}
) -> df_zomato
提前致谢。
【问题讨论】:
标签: r web-scraping rvest