installed.packages("rvest")
##      Package LibPath Version Priority Depends Imports LinkingTo Suggests
##      Enhances License License_is_FOSS License_restricts_use OS_type Archs
##      MD5sum NeedsCompilation Built
installed.packages("robotstxt")
##      Package LibPath Version Priority Depends Imports LinkingTo Suggests
##      Enhances License License_is_FOSS License_restricts_use OS_type Archs
##      MD5sum NeedsCompilation Built
library(rvest)
library(robotstxt)
## Warning: package 'robotstxt' was built under R version 4.3.3
url <- "https://en.wikipedia.org/wiki/2024_in_film"
page <- read_html(url)
paths_allowed(url)
## Registered S3 method overwritten by 'future':
##   method               from      
##   all.equal.connection parallelly
## Warning: package 'future' was built under R version 4.3.3
## en.wikipedia.org
## 
## [1] TRUE
page <- read_html(url)
highest_grossing <- page %>%
html_element("table.wikitable") %>%
html_table()
print(highest_grossing)
## # A tibble: 10 × 4
##     Rank Title                           Distributor  `Worldwide gross`
##    <int> <chr>                           <chr>        <chr>            
##  1     1 Inside Out 2                    Disney       $1,698,863,816   
##  2     2 Deadpool & Wolverine            Disney       $1,338,073,645   
##  3     3 Moana 2                         Disney       $1,059,242,164   
##  4     4 Despicable Me 4                 Universal    $971,315,095     
##  5     5 Wicked                          Universal    $756,535,681     
##  6     6 Mufasa: The Lion King           Disney       $723,060,982     
##  7     7 Dune: Part Two                  Warner Bros. $715,409,065     
##  8     8 Godzilla x Kong: The New Empire Warner Bros. $572,505,338     
##  9     9 Kung Fu Panda 4                 Universal    $547,689,492     
## 10    10 Sonic the Hedgehog 3            Paramount    $492,162,604
result <- !is.null(highest_grossing) && nrow(highest_grossing) > 0
print(result)
## [1] TRUE