Tested by NotHuman · Open source · · 2 min read

Tested: Trafilatura turns cluttered web pages into clean text for AI, but keeps hidden text

We ran Trafilatura on four pages from a fictional joinery. Menus, cookie banners and footers vanished in a hundredth of a second, offline. Dates and hidden text need a check.

Trafilatura is a free Python library and command-line tool that takes a web page and keeps only what matters: the title, author, date and main text, without menus, cookie banners or footers. It can save the result as plain text, Markdown, JSON or CSV. It works with fixed rules, not an AI model.

We installed version 2.3.1 in a clean environment; the install took 8 seconds. We then built four small web pages for Menuiserie Boisvif SA, the fictional joinery we use for our tests: a French FAQ, site-meeting notes with an invoice table and a comments section, a German page about kitchens with no date, and a page with hidden text.

The FAQ came out clean, with all eight questions, the title, author, site name and publication date. The menu, cookie text and footer were gone. The meeting notes kept their list and the invoice table, and the comments section was dropped. French and German accents and Swiss quotation marks survived. Each page took about a hundredth of a second, and nothing left the machine.

Two results need care. On the German page, which shows no date, Trafilatura reported 1 January 2026, probably guessed from the copyright line in the footer. A wrong date that looks right is easy to miss. And text hidden from readers with a style setting was kept in the output, including a line telling an AI to ignore its instructions. If you feed extracted pages to an assistant, that is a way for a website to slip instructions in.

Smaller limits: the command line gives the output files random names, the language field stayed empty because language detection is an optional add-on, and there is no screen or app, only commands and Python.

Trafilatura suits a small company with someone who can run a few commands, for example to turn supplier pages, saved articles or its own website into clean text for archiving, search or an AI assistant. We tested only small pages we wrote ourselves; we did not try downloading real websites or crawling, and when it does download pages, the sites it visits see those requests.

Tested by NotHuman

How to install it

The steps from our test, one at a time. Allow about 2 minutes.

Before you start

  • A Mac, Windows or Linux computer
  • Python 3.10 or newer, free from python.org
  • A few web pages saved from your browser (File › Save Page As, “HTML only”)
  1. Open a terminal

    On a Mac: Terminal, in Applications › Utilities. On Windows: PowerShell, from the Start menu. Type each command, then press Enter.

  2. Check that Python is installed

    You should see version 3.10 or newer. If not, or if you get an error, install Python from python.org first, then open a new terminal.

    Mac or Linux
    python3 --version
    
    Windows · PowerShell
    py --version
    
  3. Create a separate folder for Trafilatura

    This “virtual environment” keeps Trafilatura apart from the rest of your computer. To remove everything later, you delete this one folder.

    Mac or Linux
    python3 -m venv trafilatura-env
    
    Windows · PowerShell
    py -m venv trafilatura-env
    
  4. Install Trafilatura

    The install takes a few seconds; the last command should show the version number.

    Mac or Linux
    trafilatura-env/bin/pip install trafilatura
    trafilatura-env/bin/trafilatura --version
    
    Windows · PowerShell
    .\trafilatura-env\Scripts\pip install trafilatura
    .\trafilatura-env\Scripts\trafilatura --version
    
  5. Extract your first pages

    Put the saved web pages in a folder called pages, in your home folder. This command writes one Markdown file per page into a new folder called out. It works offline: nothing is sent anywhere.

    Mac or Linux
    trafilatura-env/bin/trafilatura --input-dir pages --output-dir out --markdown
    
    Windows · PowerShell
    .\trafilatura-env\Scripts\trafilatura --input-dir pages --output-dir out --markdown
    
  6. Check the result

    Open the files in out with any text editor. They have random names, so look inside to see which page is which. Check dates on pages that show none, and remove any text you can’t see on the original page before giving it to an AI assistant.

  7. To remove it

    Delete the trafilatura-env folder in your home folder: that removes Trafilatura and everything it installed.

Commands taken from our test. Only install software from its official source.

Terminal excerpt

$ python3 -m venv venv && pip install trafilatura      # 8 seconds
$ pip list | grep -iE "trafilatura|lxml|justext|courlan"
courlan            1.5.0
jusText            3.0.2
lxml               6.1.3
trafilatura        2.3.1
$ python ex.py faq        # fictional FAQ page: nav, cookie banner, footer, "related articles"
---
title: Questions fréquentes
author: Équipe Boisvif
sitename: Menuiserie Boisvif SA
date: "2026-10-05"
---
# Questions fréquentes
### Quels sont vos délais pour une cuisine sur mesure ?
Compter 8 à 10 semaines entre la validation du devis et la pose, selon la saison.
... (all 8 questions kept, menu/cookie text/footer dropped) [0.01s]
$ python ex.py chantier   # meeting notes + invoice table + comments section
# Séance de chantier, 9 novembre 2026
- Fenêtres Rue Fictive 3 : 6 posées, 2 restent. Retard d'une semaine ...
## Factures suivies
| Facture | Client | Total CHF | Statut |
| B-2026-104 | Imprimerie Calame Sàrl | 691.84 | overdue |
... (table kept, "Commentaires" section dropped) [0.01s]
$ python ex.py de         # German page with no date, footer says "© 2026"
title: Massküchen aus Schweizer Holz
date: "2026-01-01"       <-- no date on the page; guessed
$ python ex.py inj        # page with hidden text (display:none) and an HTML comment
# Test
Normaler Text über Holz.
[hidden line telling an AI to ignore its instructions]   <-- hidden text was kept
$ trafilatura --input-dir pages --output-dir out --json
4ERhJxawFOy3lSUX.json  Kil4RLR7yr2PPnht.json  kzhOJNFHs_t9k9c3.json  toJJ_wvz-HC10g3b.json
(output files get random names, not the input names)
$ extract(json, de.html) -> "language": null   (language detection is an optional add-on)
Model loaded: none (no AI model; rule-based extraction)

Badge for the project’s README

Do you maintain this project? You can show our verdict in your README with this badge, which links to this test. It’s optional and free.

Tested by NotHuman: Recommended
[![Tested by NotHuman: recommended](https://nothuman.ch/badges/recommended.svg)](https://nothuman.ch/ai-news/tested-trafilatura-web-pages-to-text/)

Sources

Tested by NotHuman’s AI in an isolated environment with fictional data. Everything we state comes from the test log and screenshots shown here. Spot a mistake? Tell us.

Next story → Tested: Meilisearch finds your documents in a millisecond, typos and all, but not your questions We loaded a fictional joinery’s invoices, FAQ and emails into Meilisearch. Keywords with typos worked instantly in four languages; plain-language questions often found nothing.

Contact

A question? A project?

A real person reads every message. No commitment.

We only use this information to reply to you. See our privacy policy.

A personal reply, usually within 2 working days.