draft/getIkari.R

getIkari <- function(){
  URL='http://www.ikari.com.tw/store.php?search='
  res <- GET(URL, encoding='utf8')
  res2 <- content(res, encoding='utf8')
  
  name <- xpathSApply(res2, '///*[@id="mainContent"]/dl/dd[1]/dl/dd/ul/li/h3/a', xmlValue)
  addr <- xpathSApply(res2, '//*[@id="mainContent"]/dl/dd[1]/dl/dd/ul/li/em[2]', xmlValue)
  tel <- xpathSApply(res2, '//*[@id="mainContent"]/dl/dd[1]/dl/dd/ul/li/em[1]', xmlValue)
  
  name[1] <-"總店"

  return(data.frame(brand_nm='怡客',store_nm=name,addr=addr,tel_no=tel, stringsAsFactors = FALSE))
}
leoluyi/CRMaddress documentation built on May 21, 2019, 5:08 a.m.