getRoberta <- function(){
##百貨專櫃
url <-"http://www.robertadicamerino-uomo.com.tw/store.php?type=1"
res <- GET(url, encoding='utf8')
res2 <- content(res,"text",encoding='utf8')
html <- htmlParse(res2, encoding = "utf8")
store <- cssApply(html,"#storelistbox > div > div > div.title", cssCharacter)
addr <- cssApply(html,"#storelistbox > div > div > div.address", cssCharacter)
tel <- cssApply(html,"#storelistbox > div > div > div.phone", cssCharacter)
data01 = data.frame('Roberta', unlist(store), unlist(tel), unlist(addr), '百貨專櫃', stringAsFactors=FALSE)
data02 <- data01[,-6]
colnames(data02) = c("brand_nm", "store_nm", "tel_no", "addr","kind")
##特許經銷商
url <-"http://www.robertadicamerino-uomo.com.tw/store.php?type=2"
res <- GET(url, encoding='utf8')
res2 <- content(res,"text",encoding='utf8')
html <- htmlParse(res2, encoding = "utf8")
store <- cssApply(html,"#storelistbox > div > div > div.title", cssCharacter)
addr <- cssApply(html,"#storelistbox > div > div > div.address", cssCharacter)
tel <- cssApply(html,"#storelistbox > div > div > div.phone", cssCharacter)
data11 = data.frame('Roberta', unlist(store), unlist(tel), unlist(addr), '特許經銷商', stringAsFactors=FALSE)
data12 <- data11[,-6]
colnames(data12) = c("brand_nm", "store_nm", "tel_no", "addr", "kind")
data_sum = rbind(data02, data12)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.