draft/getYoungMan.R

getYoungMan <- function(){   
  URL='http://www.youngman.com.tw/shoplist.jsp?s=shop&amp;city='
  res <- GET(URL, encoding='utf8')
  res2 <- content(res, encoding='utf8')  
  name <- xpathSApply(res2, '//*[@id="CONTENT02"]/table/tr/td/p/a', xmlValue)  
  addr <- xpathSApply(res2, '//*[@id="CONTENT02"]/table/tr/td[2]/p', xmlValue)  
  addr <- addr[-length(addr)]  
  tel <- xpathSApply(res2, '//*[@id="CONTENT02"]/table/tr/td[3]/p', xmlValue)
  
  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.