Twitter has started adding "follow topic" posts interspersed with the normal home timeline. I'd like to filter them out. Twitter actively obfuscates the timeline source to hinder efforts like this.
Here's what I understand about the theory: the rule should be able to identify a post containing a deeply nested child that has the text "Follow Topic" in it, like so:
then it should filter the post containing such a span, which would be this parent level
In practice I got as far as
twitter.com##div:nth-child(n):has-text(/\bFollow Topic/i)
but this filters any post if it has any mention of the phrase "Follow Topic" anywhere inside it, including e.g. in the body of the text, and occasionally it breaks the entire timeline.
How should I write a rule for ublock origin to filter out this sort of thing?
To filter a node that contains another node, you can use the xpath() function.
For example, to hide the article containing a recommended topic, I use:
twitter.com##:xpath(//article[.//span[starts-with(@aria-label,"Recommended Topic:")]])