11-27-2015, 10:09 PM
Sorry for this basic question, I have it working using the browser and 'get acc' method.
But I was wondering if it is possible with the below code:
My code below get's all H2, I just need the H2 within the <div class="entry">
Or does the below code has only one method:
Grabbing all <div class="entry"> then put HTML in string and then use regex?
If that is the case, then I can do it. But maybe I overlooked an advanced method or other option within below code?
Macro grab_within_certain_div_example
But I was wondering if it is possible with the below code:
My code below get's all H2, I just need the H2 within the <div class="entry">
Or does the below code has only one method:
Grabbing all <div class="entry"> then put HTML in string and then use regex?
If that is the case, then I can do it. But maybe I overlooked an advanced method or other option within below code?
Macro grab_within_certain_div_example
str s
IntGetFile "***WEBSITE URL***" s ;; CHANGE URL!!!
out
HtmlDoc d.InitFromText(s)
ARRAY(MSHTML.IHTMLElement) h2 div
d.GetHtmlElements(h2 "h2") ;; containerTag, containerNameOrIndex => Can not set to grab within <div class="entry"> .... ?
int i
out "-----ALL H2-----"
for i 0 h2.len
,str s2=h2[i].innerText
,out s2
;EXAMPLE HTML, NEED TO GRAB ALL H2 WITHIN SPECIFIC: <div class="entry">
;"TEST 1"
;"TEST 2"
;.....
;<BODY>
;<H2>DO NOT GRAB THIS 1</H2>
;<DIV class="entry">
;,<H2>TEST 1</H2>
;</DIV>
;<DIV class="entry">
;,<H2>TEST 2</H2>
;</DIV>
;<H2>DO NOT GRAB THIS 2</H2>
;</BODY>
;.....
;
;