{"id":4055,"library":"inscriptis","title":"inscriptis","description":"Inscriptis is a Python-based HTML to text conversion library, command line client, and Web service (v2.7.1). It specializes in providing high-quality, layout-aware text representations of HTML content, including support for nested tables and a subset of CSS, and offers optional annotated output. The library is actively maintained with regular releases addressing new Python versions and feature enhancements.","status":"active","version":"2.7.1","language":"python","source_language":"en","source_url":"https://github.com/weblyzard/inscriptis","tags":["html-to-text","converter","text-extraction","nlp","web-scraping"],"install":[{"cmd":"pip install inscriptis","lang":"bash","label":"Core library"},{"cmd":"pip install inscriptis[web-service]","lang":"bash","label":"With Web service (FastAPI/Uvicorn)"}],"dependencies":[{"reason":"Used for fetching web content.","package":"requests","optional":false},{"reason":"HTML parsing backend.","package":"lxml","optional":false},{"reason":"Required for the optional web-service.","package":"fastapi","optional":true},{"reason":"Required for the optional web-service.","package":"uvicorn","optional":true}],"imports":[{"symbol":"get_text","correct":"from inscriptis import get_text"}],"quickstart":{"code":"import urllib.request\nfrom inscriptis import get_text\n\nurl = \"https://www.informationscience.ch\"\ntry:\n    with urllib.request.urlopen(url) as response:\n        html_content = response.read().decode('utf-8')\nexcept Exception as e:\n    html_content = f\"<html><body><p>Error fetching URL: {e}</p></body></html>\"\n\ntext = get_text(html_content)\nprint(text)","lang":"python","description":"Convert HTML from a URL to plain text, preserving layout and structure. The example fetches content from 'https://www.informationscience.ch' and prints its text representation."},"warnings":[{"fix":"If using `XmlAnnotationProcessor`, be aware of the new `<content>` root element. The name can be overwritten by providing the `root_element` parameter to the processor call.","message":"The `XmlAnnotationProcessor` (introduced in 2.6.0) now requires a mandatory root element. The generated XML will contain a `<content>` root element by default. If you were using this processor directly, your XML output structure will change.","severity":"breaking","affected_versions":">=2.6.0"},{"fix":"Upgrade your Python environment to version 3.10 or newer (up to <3.15) to maintain compatibility with `inscriptis`.","message":"Support for Python 3.9 has been removed as of version 2.7.0. Python 3.8 support was deprecated in 2.5.1 and subsequently removed.","severity":"deprecated","affected_versions":">=2.7.0 (for Python 3.9), >=2.5.1 (for Python 3.8)"},{"fix":"For long-running services processing many complex HTML documents, monitor memory usage and consider restarting processes periodically or optimizing the HTML input where possible. This is a characteristic of `lxml` rather than a direct `inscriptis` bug.","message":"When processing very complex HTML pages, `inscriptis` (which uses `lxml` internally) may exhibit increased memory consumption due to `lxml`'s tendency to reuse memory rather than releasing it back to the operating system.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'activ':53 'address':58 'annot':48 'awar':29 'base':7 'client':15 'command':13 'content':34 'convers':11 'convert':69 'css':44 'enhanc':64 'extract':72 'featur':63 'high':25 'high-qual':24 'html':8,33,66 'html-to-text':65 'includ':35 'inscripti':1,2 'layout':28 'layout-awar':27 'librari':12,51 'line':14 'maintain':54 'nest':38 'new':59 'nlp':73 'offer':46 'option':47 'output':49 'provid':23 'python':6,60 'python-bas':5 'qualiti':26 'regular':56 'releas':57 'represent':31 'scrape':76 'servic':18 'special':21 'subset':42 'support':36 'tabl':39 'text':10,30,68,71 'text-extract':70 'v2.7.1':19 'version':61 'web':17,75 'web-scrap':74","created_at":"2026-04-12T03:39:03.903658+00:00","updated_at":"2026-04-16T15:45:19.987667+00:00","problems":[{"fix":"Install the library using pip: `pip install inscriptis`","cause":"The 'inscriptis' library has not been installed in your Python environment or is not accessible within the current environment.","error":"ModuleNotFoundError: No module named 'inscriptis'"},{"fix":"Remove the `.decode()` call if the input is already a string, or ensure the input is a `bytes` object before calling `.decode()`. For example, if reading from a network or file, ensure you obtain `bytes` before decoding: `html_content_bytes.decode('utf-8')`.","cause":"You are attempting to call the `.decode()` method on a Python 3 string (`str`) object, which is already Unicode. The `.decode()` method is only applicable to `bytes` objects to convert them to `str`.","error":"AttributeError: 'str' object has no attribute 'decode'"},{"fix":"Convert the `str` object to a `bytes` object using the `.encode()` method with the appropriate encoding, typically UTF-8: `some_string_variable.encode('utf-8')`.","cause":"A function or method within `inscriptis` or a related library (like `lxml` which `inscriptis` uses) expects a `bytes` object, but it received a standard Python 3 string (`str`).","error":"TypeError: a bytes-like object is required, not 'str'"},{"fix":"When using `XmlAnnotationProcessor`, be aware that the output will include a `<content>` root element by default. If you need a different root element, specify it using the `root_element` parameter: `XmlAnnotationProcessor(root_element='my_root')`.","cause":"Inscriptis version 2.6.0 and later changed the `XmlAnnotationProcessor` to require a root element, which defaults to `<content>`. Older code using this processor directly might not provide this, leading to a change in the XML output structure.","error":"XmlAnnotationProcessor now requires a mandatory root element."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.7.4","cli_name":"inscriptis","cli_version":"sh: 1: inscriptis: not found","type":"library","homepage":"https://inscriptis.informatik.uni-mannheim.de","github":"https://github.com/weblyzard/inscriptis","docs":"https://inscriptis.readthedocs.io/en/latest/","changelog":null,"pypi":"https://pypi.org/project/inscriptis/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-29","next_check":"2026-07-28","install_tag":null}}