diff --git a/readability/encoding.py b/readability/encoding.py index 37cc815..406550f 100644 --- a/readability/encoding.py +++ b/readability/encoding.py @@ -1,5 +1,8 @@ import re -import chardet +try: + import cchardet +except ImportError: + import chardet import sys diff --git a/setup.py b/setup.py index 63465c5..0720ae7 100755 --- a/setup.py +++ b/setup.py @@ -16,12 +16,17 @@ if sys.platform == 'darwin': print("Using lxml<2.4") lxml_requirement = "lxml<2.4" +speed_deps = [ + "cchardet", +] + test_deps = [ # Test timeouts "timeout_decorator", ] extras = { + 'speed': speed_deps, 'test': test_deps, }