[Greasemonkey] XPath Help: Selecting items before a tag within a span
rich fuller
nuprn1 at gmail.com
Mon Feb 12 15:02:05 PST 2007
Hello All,
I have what seems a fairly simple question but I'm not well versed in xpath.
I have a greasemonkey script used on a forum which takes youtube urls and
rewrites them into embed. The issue is some signatures have youtube urls so
I want to exclude those from the rules. The problem is that the only thing
which signifies a signatures in a post is a hr tag
like so:
<span class="posttext">
This is my post <a href="http://www.youtube.com/watch?v=Fcn4p213Zg8">youtube</a>
some most post stuff. more
<a href="http://www.youtube.com/watch?v=Fcn4p213Zg8">youtoube</a>.
<hr width="15%" size="1" align="left" style="color: black;"/>
start of my sig<br/>
<br/><a href="http://www.youtube.com/watch?v=pxZJKHToioM">Best vid ever</a>
</span>
which repeats over.
Here is my current xpath:
//span[@class='posttext']/a[contains(@HREF, 'youtube.com/watch?v')]
Is it possible to only select the needed urls before the hr tag only? (there
could be multiple youtube urls in a posttext span)
TIA
Rich
More information about the Greasemonkey
mailing list