admin管理员组文章数量:1404599
library(tidyverse)
library(rvest)
fruits <- read_html(";)
fruits_df <- fruits %>%
html_elements("._product") %>%
map_dfr(~ tibble(
product = .x %>%
html_element("._product-name-tag a") %>%
html_text2(),
price = .x %>%
html_element("._product-price-inner span") %>%
html_text2(),
price_old = .x %>%
html_element("._product-price-old") %>%
html_text2(),
unit = .x %>%
html_element("._button_unit") %>%
html_text2())) %>%
mutate(date = Sys.Date(),
type = "Fruits and vegetables",
source = "T MARKET", .before = product) %>%
mutate(price = str_replace(price, ",", "."),
price = parse_number(price),
) %>% distinct()
When running this code I'm getting the following error:
Error in open.connection(x, "rb") : cannot open the connection
Can anyone suggest a clue? Thanks!
本文标签:
版权声明:本文标题:r - I'm getting an error "cannot open the connection" when trying to scrape a website with rvest - Sta 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744838181a2627759.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论