html - Retrieving specific data from website through excel -
i trying similar below existing example: reference problem
with 1 small exception, need pull rating , # of reviews listing 2 separate cells in excel.
how in way without pulling entire site's data? seems need call specific html tag or use command this, don't know is.
please help!
this code retrieve 2 pieces of information requested , place them on activesheet
sub test() my_url = "http://www.yelp.com/biz/if-boutique-new-york" set html_doc = createobject("htmlfile") set xml_obj = createobject("msxml2.xmlhttp") xml_obj.open "get", my_url, false xml_obj.send html_doc.body.innerhtml = xml_obj.responsetext set xml_obj = nothing set results = html_doc.body.getelementsbytagname("i") each itm in results if instr(1, itm.outerhtml, "star-img", vbtextcompare) > 0 numb_stars = itm.getattribute("title") exit else end if next set results = html_doc.body.getelementsbytagname("span") each itm in results if instr(1, itm.outerhtml, "reviewcount", vbtextcompare) > 0 numb_rev = itm.innertext exit else end if next activecell = numb_stars activecell.offset(1, 0) = numb_rev end sub
Comments
Post a Comment