yonatankra 1 Posted June 6, 2015 Report Share Posted June 6, 2015 Hi,One of my "target" websites marks certain elements using some attribute.For instance:<a href="blahblah" myMarkingAttr="1">Don't click me</a>While other links would be:<a href="blahblah">I'm the one you want to click</a>I want to create a list of all the <a> elements that are missing the "myMarkingAttr" attribute.Any way to do this? Quote Link to post Share on other sites
HelloInsomnia 1103 Posted June 7, 2015 Report Share Posted June 7, 2015 First get the links that don't contain that text on to a list like this: clear list(%no_myattr) clear list(%links) add list to list(%links, $scrape attribute(<tagname="a">, "outerhtml"), "Delete", "Global") loop($list total(%links)) { set(#next_link, $next list item(%links), "Global") if($contains(#next_link, "myMarkingAttr")) { then { } else { add item to list(%no_myattr, #next_link, "Delete", "Global") } } } Then when you go to get the url it will have to be extracted like this: set(#url, $find regular expression($next list item(%no_myattr), "(?<=href=\\\").*?(?=\\\")"), "Global") Quote Link to post Share on other sites
Asentrix 17 Posted June 8, 2015 Report Share Posted June 8, 2015 Regular Expression is your friend , I know it's tedious and kinda scares people offBut I highly suggest you sit down for an hour or two and take the time to understand it! Regex is needed a lot in ubot and having that knowledge at your disposal is always great Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.