我正在練習我在R的網頁抓取代碼,無論我嘗試什麼網站,我都無法通過一個階段。在R的網頁抓取
例如,
https://www.thecompleteuniversityguide.co.uk/league-tables/rankings?s=Music
我的目標是提取所有77所學校的名字(從牛津到倫敦都市)
所以,我想......
library(rvest)
url_college <- "https://www.thecompleteuniversityguide.co.uk/league-tables/rankings?s=Music"
college <- read_html(url_college)
info <- html_nodes(college, css = '.league-table-institution-name')
info %>% html_nodes('.league-table-institution-name') %>% html_text()
從F12,我可以發現所有學校的名字都在班級'.league-table-institution-name'中......這就是爲什麼我用html_nodes寫出這個名字的原因......
我做錯了什麼?
當你在等待的答案,你SHLD prbly閱讀https://www.thecompleteuniversityguide.co.uk/terms-and-conditions/ – hrbrmstr