getSunnyATM <- function(){
url_A <-c("http://www.sunnybank.com.tw/ATMPlaces.asp?page=1&lmenuid=5&smenuid=101&areaid=1",
"http://www.sunnybank.com.tw/ATMPlaces.asp?page=2&lmenuid=5&smenuid=101&areaid=1",
"http://www.sunnybank.com.tw/ATMPlaces.asp?page=3&lmenuid=5&smenuid=101&areaid=1",
"http://www.sunnybank.com.tw/ATMPlaces.asp?lmenuid=5&smenuid=101&areaid=2",
"http://www.sunnybank.com.tw/ATMPlaces.asp?page=1&lmenuid=5&smenuid=101&areaid=4",
"http://www.sunnybank.com.tw/ATMPlaces.asp?page=2&lmenuid=5&smenuid=101&areaid=4",
"http://www.sunnybank.com.tw/ATMPlaces.asp?page=3&lmenuid=5&smenuid=101&areaid=4",
"http://www.sunnybank.com.tw/ATMPlaces.asp?lmenuid=5&smenuid=101&areaid=5")
mylist <- list()
for (i in 1:length(url_A)){
url <- url_A[i]
res <- GET(url, encoding='big5', user_agent('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36'),
set_cookies('cookiesession1'='5628CEA7YN4YGJINJSOUNT2VFTEG1965'))
res2 <- content(res,"text",encoding='big5')
res2 <- toUTF8(res2)
html <- htmlParse(res2, encoding = "utf8")
tables <- readHTMLTable(html)
data <-tables[[17]]
addr <- str_extract_all(unlist(data[,2]), ".+(號|樓|F)")
addr1 <-str_replace_all(unlist(addr),'[:space:]', "")
data05=data.frame('陽信ATM', data[,1], data[,3], unlist(addr1), stringAsFactors=FALSE)
data06 <- data05[,-5]
colnames(data06) = c("brand_nm", "store_nm", "tel_no", "addr")
data_sum <- data06
mylist=rbind(mylist,data_sum)
}
final_data <- data.frame(brand_nm = mylist$brand_nm, store_nm = mylist$store_nm,
tel_no = mylist$tel_no, addr = mylist$addr, stringsAsFactors = FALSE)
return(final_data)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.