getFishNoodle <- function(){
url_link <-'http://www.fishnoodle.com.tw/shopsinfo'
res_link <- GET(url_link)
res_link <- content(res_link,'text', encoding = 'utf8')
html_link<- htmlParse(res_link, encoding = "utf8")
link <- cssApply(html_link, '#food_bg>div>a ', cssLink)
link <- str_replace_all(link,'/shopsinfo/','')
result<-list()
url <-list()
for(i in 1:length(link)){
url[[i]]<-sprintf('http://www.fishnoodle.com.tw/shopsinfo/%s',link[i])
res <- GET(url[[i]], encoding= "big5")
url<-'http://www.fishnoodle.com.tw/shopsinfo/taipei'
res <- GET(url)
res <- content(res,'text', encoding = 'utf8')
html <- htmlParse(res, encoding = "utf8")
data <- cssApply(html, '#add', cssCharacter)
data <- str_replace_all(data,'\\\r|\\\n|\\\t','')
data <- unlist(strsplit(data,':')) #用\n分隔資料
data <- matrix(data, ncol=3, byrow=TRUE)
store_nm <-data[,1]
tel_no <-data[,3]
addr <-data[,2]
addr <- str_replace_all(addr,'訂餐專線|美食街','')
if(length(store_nm)>0){
result[[i]]<-data.frame(brand_nm='甘泉魚麵',store_nm,tel_no,addr, stringsAsFactors = FALSE)
}
}
data_fin <- do.call(rbind, result)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.