作者bluecadence (by any other name)
看板R_Language
标题Re: [问题] 用R抓取八卦版
时间Wed May 10 19:50:31 2017
因为你没处理 over18 的 cookie
library(RCurl)
curl <- getCurlHandle()
curlSetOpt(cookie="over18=1", followlocation = TRUE, curl=curl)
url <- '
https://webptt.com/cn.aspx?n=bbs/Gossiping/index20865.html'
html <- getURL(url, curl=curl)
这样应该就没问题了
※ 引述《iwfmf (i @#$%@#$^$%^ f)》之铭言:
: : 再用R爬虫抓取八卦版,但在getURL 时,抓取的资料为空
: [程式范例]:
:
: > url
: [1] "https://webptt.com/cn.aspx?n=bbs/Gossiping/index20865.html"
: > html = getURL(url,ssl.verifypeer = FALSE,encoding="UTF-8")
: > html
: [1] ""
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 104.155.222.243
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/R_Language/M.1494417036.A.7D9.html
1F:推 iwfmf: 解决了 感谢您!! 看来是我原本处理over18的写错 05/11 10:52