CFM Talks

This is a simple script to scrape cross referenced talks and manuals from the 2023 Come Follow Me New Testament Manual.

I added the results to a google sheet for easy sharing: https://docs.google.com/spreadsheets/d/1pL9pXNHqARiVRszP5pM6M087FjMb4-ntc7Nkz50DfYY/edit?usp=sharing

#scrape talks from come follow me
library(data.table)
library(rvest)
## Warning: package 'rvest' was built under R version 4.2.3
dt_list <- list()
#get links to pages with info
for (PAGE_NUM in seq(1,53)){
  # PAGE_NUM = 1
  PAGE <- as.character(PAGE_NUM)
  if (nchar(PAGE) == 1){
    PAGE <- paste0("0",PAGE)
  } 
  
  print(PAGE)
  search_page_url <- paste0("https://www.churchofjesuschrist.org/study/manual/come-follow-me-for-individuals-and-families-new-testament-2023/",PAGE,"?lang=eng")
  search_page_html <- read_html(search_page_url)
  list_of_links <- html_elements(search_page_html, ".cross-ref")

  for (RAW_LINK in list_of_links){
    # print(RAW_LINK)
    LINK <- paste0("https://www.churchofjesuschrist.org",html_attr(RAW_LINK, "href"))
    print(LINK)
    dt_list[[paste0(PAGE,RAW_LINK)]] <- data.table(week = PAGE, link = LINK)
    
  }
  
}
dt <- rbindlist(dt_list)
fwrite(dt, file = "~/cfm_2023_talks.csv")

Updated: