Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Enumerate Elements on webpage
#1
This works, but is super sloppy. Any ideas how to make something like this?

Code:
Copy      Help
opt err 1
str s
IntGetFile "http://www.google.com" s
out
s.findreplace("<img" "<img id=xImageX" 1)
s.findreplace("href" "id=xlinkX href" 1)
s.findreplace(">" ">[]")
ARRAY(str) Images Links
for _i 0 numlines(s)
,_s.getl(s _i)
,HtmlDoc d.InitFromText(_s)
,if Links[Links.len]=Links[Links.len-1]
,,Links.remove(Links.len)
,if !(Links[Links.len-1].len)
,,Links.remove(Links.len-1)
,if Images[Images.len]=Images[Images.len-1] and (!Images[Images.len].len)
,,Images.remove(Images.len)
,if !(Images[Images.len-1].len)
,,Images.remove(Images.len-1)

,Images[]=d.d3.getElementById("xImageX").getAttribute("src" 2)
,Links[]=d.d3.getElementById("xlinkX").getAttribute("href" 2)

out "-----Links-----"
out Links
out "-----Images----"
out Images

Thanks,
Jimmy Vig


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)