百度搜索接口
偶尔需要用百度爬点数据,下面展示如何用关键字在百度搜索,抓取相关信息
## 百度搜索接口
"http://www.baidu.com.cn/s?wd=" + key + "&cl=3"
library(rvest)
library(magrittr)
library(xml2)
library(htmltools)
library(stringr)
key <- '宝马'
key%>%HTML()%>%URLencode()%>%paste0("http://www.baidu.com.cn/s?wd=",.,"&cl=3")%>%
read_html()%>%html_nodes('h3 a')%>%html_text()
以上

浙公网安备 33010602011771号