Trafilatura: Advanced Web Scraping and Text Extraction in Python
This repository profile is provided by osrepos.com, an open source repository discovery platform.

Summary
Trafilatura is a robust Python package and command-line tool designed for gathering text and metadata from the web. It simplifies web crawling, scraping, and content extraction, transforming raw HTML into structured data. Widely adopted by major companies and institutions, it offers high efficiency and accuracy for various text processing needs.
Repository Information
Topics
Click on any tag to explore related repositories
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
Introduction
Trafilatura is a cutting-edge Python package and command-line tool designed to gather text and metadata from the Web. It simplifies the process of turning raw HTML into structured, meaningful data, offering essential components for web crawling, downloads, scraping, and extraction of main texts, metadata, and comments. Recognized for its robustness and speed, Trafilatura is widely used by companies like HuggingFace, IBM, and Microsoft Research, as well as by renowned academic institutions.
Installation
Installing Trafilatura is straightforward and can be done using pip:
pip install trafilatura
Examples
Here's how you can use Trafilatura to extract text from a URL or an HTML string:
import trafilatura
from trafilatura.downloads import fetch_url
# Example 1: Extract from a URL
url = "https://adrien.barbaresi.eu/blog/trafilatura-web-scraping.html"
print(f"Extracting from: {url}")
downloaded = fetch_url(url)
if downloaded:
text = trafilatura.extract(downloaded)
print("--- Extracted Content (first 500 characters) ---")
print(text[:500])
print("----------------------------------------------------")
# Example 2: Extract from an HTML string
html_content = """
My Test Page
Main Title
This is an example paragraph with <b>bold text</b>.
- Item 1
- Item 2
"""
print("\nExtracting from an HTML string:")
text_from_html = trafilatura.extract(html_content)
print("--- Extracted Content ---")
print(text_from_html)
print("-------------------------")
Why Use Trafilatura?
Trafilatura stands out for several reasons, making it an excellent choice for your web content extraction needs:
- Efficiency and Accuracy: It consistently outperforms other open-source libraries in text extraction benchmarks, balancing noise limitation with the inclusion of all valid parts.
- Comprehensive Features: It offers advanced web crawling (sitemaps and feeds support), parallel processing, and robust extraction of main text, metadata (title, author, date), and formatting (paragraphs, titles, lists).
- Multiple Output Formats: It supports TXT, Markdown, CSV, JSON, HTML, XML, and TEI, providing flexibility for various applications.
- Modularity and Ease of Use: No database is required, and it's designed to be handy and modular, facilitating integration into your projects.
- Active Maintenance and Community Support: It receives regular updates, feature additions, and optimizations, backed by comprehensive documentation and an active community.
- Focus on Content Quality: It helps focus on the actual content, avoiding noise from recurring elements like headers and footers, and making sense of data and metadata.
Links
- GitHub Repository: https://github.com/adbar/trafilatura
- Official Documentation: https://trafilatura.readthedocs.io/
- PyPI Package: https://pypi.org/project/trafilatura/
Related repositories
Similar repositories that may be relevant next.

AMD Skills: Empowering AI Agents with AMD's Optimized Software Stack
August 16, 2026
AMD Skills is the official catalog of AI agent skills from AMD, designed to empower AI agents with optimized software for AMD hardware. This repository provides knowledge, scripts, and conventions for working with AMD's stack, enabling seamless integration with major coding agents like Cursor, Claude Code, OpenAI Codex, and Gemini CLI.

agent-tackle-box: A Terminal Debugger for LangGraph & LangChain Agents
August 15, 2026
agent-tackle-box is a comprehensive toolkit for developing AI agents, featuring the powerful `agent-debugger`. This terminal debugger provides deep insights into LangGraph and LangChain agents. It allows developers to inspect state, monitor tool calls, and step through Python code, all within a unified Textual UI.

ADR: Uber's Enterprise Security System for AI Agents
August 14, 2026
ADR (Agentic AI Detection and Response) is an enterprise security system developed by Uber to secure AI agents. It offers critical capabilities like observability, security benchmarking, and threat detection, ensuring the safe operation of both employee and customer-facing AI applications. This open-source project is deployed in production at Uber and was accepted to MLSys 2026.

SkillOpt: Optimizing Self-Evolving Agent Skills for LLMs
August 11, 2026
SkillOpt is an innovative text-space optimizer from Microsoft that enables the training of reusable natural-language skills for frozen LLM agents. It approaches skill development with the rigor of deep-learning optimization, using trajectory-driven edits and validation-gated updates. This results in deployable `best_skill.md` artifacts that significantly boost agent performance across various benchmarks and models without modifying model weights.
Source repository
Open the original repository on GitHub.
17 counted GitHub visits