Browse Source

drop html banner even if altered using text match

Pi 1 year ago
parent
commit
4fb8167947
1 changed files with 3 additions and 1 deletions
  1. 3 1
      mime-inject.py

+ 3 - 1
mime-inject.py

@@ -4,6 +4,7 @@ import sys
 import email
 from base64 import b64encode
 from lxml import html as HTML
+from lxml import etree
 
 def iter(e):
     yield e
@@ -12,7 +13,8 @@ def iter(e):
 
 def drop_banner(h):
     for e in iter(h):
-        if any((x in e.attrib.get('id', []) for x in ('cropswap-banner', 'cropswap-members-banner'))):
+        if any((x in e.attrib.get('id', []) for x in ('cropswap-banner', 'cropswap-members-banner'))) \
+            or etree.tostring(e, method='text', encoding='utf-8').decode('utf-8').replace('click here or ', '').strip() == txt.strip():
             e.drop_tree()
     return HTML.tostring(h).decode("utf-8")