Scraping table from web page with rvest

R Markdown for using rvest

This is an the code to use rvest package to scrape table from the website

The table is in multiple pages. I got an empty table and no error. Could someone please help with the issue?


options(stringsAsFactors = FALSE)

url_base <- ""
tbl.clactions <- data.frame(
  "SST" = character(0),
  "Ngày giao kết giao dịch" = character(0),
  "Kỳ hạn còn lại" = character(0),
  "Mã TP" = character(0),
  "Tiền tệ" = character(0),
  "Giá yết"  = character(0),
  "Lợi suất (%/năm)"  = character(0),
  "KLGD"  = character(0),
  "GTGD (đồng)"  = character(0),
  "Ngày thanh toán"  = character(0))

for (i in 1:ceiling(65/10)) {  # total filings: 38, listed 10 per page
  url <- paste0(url_base, i) <- url %>%
    read_html() %>%
    html_nodes(xpath='//*[@id="_tableDatas"]') %>%
 names([[1]] <- names(tbl.clactions)
 tbl.clactions <- bind_rows(tbl.clactions,[[1]]) 

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.