Hi everyone! First time posting here. I have a vector of URLs, and I'm hoping to scrape each of them and get a vector - not a list - of the results. Anyway, here's a small portion of the URL vector:
links_short <- c("https://fronterasdesk.org/content/1619790/response-criticism-mexican-president-says-sonora-getting-adequate-federal-support", "https://fronterasdesk.org/content/1619779/mexican-security-head-highlights-sonoran-violence-hotspots-drop-kidnapping", "https://fronterasdesk.org/content/1619264/hermosillo-looks-grow-recycling-pepenadores-hope-preserve-their-role")
I've tried a lot of things, but the best I'm able to do is get a list returned, not a vector. Here's the code I used to do that:
map(links_short, function(x) {
page <- read_html(x)
sizehtml <- html_nodes(page, ".file-size")
size <- html_text(sizehtml)
str_replace_all(size, c("\\(" = "",
"\\)" = "",
" " = "",
"MB" = ""))
})
My end goal is to be able to add a column of the results to a dataframe with those URLs, but have just been playing around with a vector of the URLs to learn. Any insight is appreciated! Thanks!