First the keep only tags are extracted. Then the remove after and remove before tags are processed. Finally the remove tags are processed. So the content you want must first be contained with a keep only tag, and then not excluded via remove after/before and remove directives. The logic is in web/fetch/simple.py in case you want to look at it.
|