aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/contentviews/html_outline.py
diff options
context:
space:
mode:
Diffstat (limited to 'mitmproxy/contentviews/html_outline.py')
-rw-r--r--mitmproxy/contentviews/html_outline.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/mitmproxy/contentviews/html_outline.py b/mitmproxy/contentviews/html_outline.py
new file mode 100644
index 00000000..d6c51b29
--- /dev/null
+++ b/mitmproxy/contentviews/html_outline.py
@@ -0,0 +1,17 @@
+import html2text
+
+from mitmproxy.contentviews import base
+
+
+class ViewHTMLOutline(base.View):
+ name = "HTML Outline"
+ prompt = ("html outline", "o")
+ content_types = ["text/html"]
+
+ def __call__(self, data, **metadata):
+ data = data.decode("utf-8", "replace")
+ h = html2text.HTML2Text(baseurl="")
+ h.ignore_images = True
+ h.body_width = 0
+ outline = h.handle(data)
+ return "HTML Outline", base.format_text(outline)