作者x9060000456 (你好)
看板R_Language
标题[问题] 关於Google自订搜寻类之爬虫
时间Sat Aug 12 17:09:55 2017
[问题类型]:
爬虫
[软体熟悉度]:
使用者(已经有用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://webptt.com/cn.aspx?n=bbs/R_Language/M.1502528998.A.2C8.html
※ 编辑: x9060000456 (1.161.254.204), 08/12/2017 17:11:05