imacros Extract all text without href -


need extract text1,text2,text3 (i mean text, until text9 in category)

<h4>category:</h4>  <p><a href="">text1</a>, <a href="">text2</a>, <a href="">text3</a></p>

my imacros code extract text1

tag pos=r1 type=a attr=txt:* extract=txt

q : how extract text in category ?

thanks

to expand on javascript comment, how go it:

extractcategory.js content

// play macro reading category data iimplay("foo.iim"); // last extracted value, i.e. p content var pcontent = iimgetextract(); // parse p using regex, first find tag pairs , drop surrounding tags var result = pcontent.match(/<a(.*?)<\/a>/g).map(function(val){    return val.replace(/<\/?a>/g,'').replace(/<a.+>/g,''); }); // pass generated string macro work iimset("passed_var", result); iimplay("bar.iim"); 

next extractcategory.js, foo.iim content

'your previous code here, line #2 find right p in line #3 in mockup html tag pos=1 type=h4 attr=*  tag pos=r1 type=p attr=* extract=htm 

next extractcategory.js, bar.iim content

'do whatever passed variable containing formatted string 'this output show prompt {{passed_var}} 

when run extractcategory.js run foo.iim code extract p content, parse regex (might want careful here, depending on texts expecting might break) , pass generated string on macro please.

running result text1,text2,text3 desired.

read on http://wiki.imacros.net/iimset() , http://wiki.imacros.net/iimplay() if need further information on how use them.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -