forked from mitmproxy/mitmproxy
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
30 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
https://snapshots.mitmproxy.org/misc/lxml-3.6.0-cp35-cp35m-win32.whl; sys_platform == 'win32' and python_version == '3.5' | ||
-e .[dev,examples,contentviews] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from mitmproxy.contentviews import html_outline | ||
from test.mitmproxy.contentviews import full_eval | ||
|
||
|
||
def test_view_html_outline(): | ||
v = full_eval(html_outline.ViewHTMLOutline()) | ||
s = b"<html><br><br></br><p>one</p></html>" | ||
assert v(s) | ||
assert v(b'\xfe') |
This file was deleted.
Oops, something went wrong.