看板 R_Language 關於我們 聯絡資訊
[問題類型]: 爬蟲 [軟體熟悉度]: 使用者(已經有用R 做過不少作品) [問題敘述]: 小弟最近在爬遊戲類的文章, 想爬關於一些透過google 自訂搜尋的文章, 但不確定能不能爬, 因此上板詢問各問大大! 謝謝呀! [程式範例]: ## 像是爬以下兩類搜尋網頁之title或href url_1 <- 'https://search.gamer.com.tw/?q=season120' ur1_2 <- 'https://read01.com/search/?q=roguelike' Crawler <- function(urls, css){ results <- urls %>% GET(encoding = 'UTF-8') %>% content %>% html_nodes(css = css) %>% html_text() return(results) } url_1_results <- Crawler(url_1, '.gs-title .gs-title') url_2_results <- Crawler(url_2, '.gs-title .gs-title') ## 兩個結果都抓不到! -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.161.254.204 ※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1502528998.A.2C8.html ※ 編輯: x9060000456 (1.161.254.204), 08/12/2017 17:11:05