pttR handles most of the dirty works to retrieve data from PTT web. It convert posts from PTT web to a dataframe in R. See the package website for details.
You can install pttR from github with:
remotes::install_github("liao961120/pttR", ref = "build")
See vignettes for more detail.