Scrape (politely) a web page's HTML and extract the attributes
from each image element (<img>
) on that page.
alt_get(webpage, all_attributes = FALSE)
webpage | A character string describing the URL of a webpage. Must be a
full path including |
---|---|
all_attributes | Logical. Do you want to return all the image
attributes as columns or just |
A tibble object with classes tbl_df
, tbl
and
data.frame
. One row per image element and one column per attribute,
unless (all_attributes = FALSE
), which returns only:
src
The source of the image as a filepath.
alt
The alternative (alt) text for the image.
longdesc
The path to a file that contains a longer
description for complex images (only returned if present).
if (FALSE) { test_url <- "https://www.bbc.co.uk/news" alt_get(webpage = test_url) }