Quellcode durchsuchen

Fix and improve toolbar removal regex

RichardG867 vor 1 Jahr
Ursprung
Commit
870825b30b
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
  1. 1 1
      waybackproxy.py

+ 1 - 1
waybackproxy.py

@@ -397,7 +397,7 @@ class Handler(socketserver.BaseRequestHandler):
 						return self.send_redirect_page(http_version, archived_url, redirect_code)
 
 				# Remove pre-toolbar scripts and CSS.
-				data = re.sub(b'''<script (?:type="text/javascript" )?src="(?:https?:)?//(?:web-static\\.)?archive\\.org/_static/js/.*<!-- End Wayback Rewrite JS Include -->\\r?\\n''', b'', data, count=1, flags=re.S)
+				data = re.sub(b'''(?:<!-- is_embed=True -->\\r?\\n?)?<script (?:type="text/javascript" )?src="[^"]*/_static/js/.*<!-- End Wayback Rewrite JS Include -->\\r?\\n''', b'', data, count=1, flags=re.S)
 				# Remove toolbar. The if_ asset tag serves no toolbar, but we remove it just in case.
 				data = re.sub(b'''<!-- BEGIN WAYBACK TOOLBAR INSERT -->.*<!-- END WAYBACK TOOLBAR INSERT -->''', b'', data, count=1, flags=re.S)
 				# Remove comments on footer.