簡體   English   中英

R中使用RVest和XML2提取表進行Web抓取

[英]Web scraping in R with rvest and XML2 extract table

我希望從示例URL https://www.valueresearchonline.com/funds/fundSelector/returns.asp?cat=10&exc=susp%2Cclose&rettab=st提取具有排名和回報的表格

到目前為止嘗試過rvest

#Reading the HTML code from the website
webpage <- read_html(urlString)

#Using CSS selectors to scrap the section
tables <- webpage %>% html_node("tr") %>% html_text()
tables <- html_node(".fundtool_cat") %>% html_text()

我需要一個帶有方案名稱的數據框/表,以及所提及的所有期間的等級和收益。希望能有所幫助。

希望這可以幫助!

library(rvest)
urlString <- "https://www.valueresearchonline.com/funds/fundSelector/returns.asp?cat=10&exc=susp%2Cclose&rettab=st"
urlString %>%
  read_html() %>%
  html_nodes(xpath='//*[@id="fundCatData"]/table[1]') %>%
  html_table(fill=T)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM