Skip to content

Commit e90b0ef

Browse files
authored
docs: refine information, improve structure and add new pages (#908)
* docs: refine information, improve structure and add new pages * review docs in depth * check landing pages * higher eval floor after #911
1 parent 0213377 commit e90b0ef

50 files changed

Lines changed: 2102 additions & 1060 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.readthedocs.yaml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,19 @@
11
# Read the Docs configuration file for Sphinx projects
22
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
33

4-
# Required
54
version: 2
65

7-
# Set the OS, Python version and other tools you might need
86
build:
97
os: ubuntu-24.04
108
tools:
119
python: "3.13"
12-
# You can also specify other tool versions:
13-
# nodejs: "20"
14-
# rust: "1.70"
15-
# golang: "1.20"
1610

17-
# Build documentation in the "docs/" directory with Sphinx
1811
sphinx:
1912
configuration: docs/conf.py
20-
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
21-
# builder: "dirhtml"
22-
# Fail on all warnings to avoid broken references
23-
# fail_on_warning: true
2413

25-
# Optionally build your docs in additional formats such as PDF and ePub
26-
# formats:
27-
# - pdf
28-
# - epub
14+
formats:
15+
- pdf
2916

30-
# Optional but recommended, declare the Python requirements required
31-
# to build your documentation
32-
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
3317
python:
3418
install:
3519
- method: pip

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## How to contribute
1+
# How to contribute
22

33

44
If you value this software or depend on it for your product,
@@ -8,15 +8,15 @@ Your support will help ensure the sustainability and growth of the project.
88
There are many ways to contribute:
99

1010
* Sponsor the project: Show your appreciation [on GitHub](https://github.com/sponsors/adbar) or [ko-fi.com](https://ko-fi.com/adbarbaresi).
11-
* Find bugs and submit bug reports: Help making Trafilatura an even more robust tool.
11+
* Find bugs and submit bug reports: Help make Trafilatura an even more robust tool.
1212
* Write code: Fix bugs or add new features by writing [pull requests](https://docs.github.com/en/pull-requests) with a list of what you have done.
1313
* Improve the documentation: Write tutorials and guides, correct mistakes, or translate existing content.
1414
* Submit feature requests: Share your feedback and suggestions.
1515

1616

1717
Here are some important resources:
1818

19-
* [List of currently open issues](https://github.com/adbar/trafilatura/issues) (no pretension to exhaustivity!)
19+
* [List of currently open issues](https://github.com/adbar/trafilatura/issues) (not exhaustive!)
2020
* [How to contribute to open source](https://opensource.guide/how-to-contribute/)
2121

2222
A special thanks to all the [contributors](https://github.com/adbar/trafilatura/graphs/contributors) who have played a part in Trafilatura.

README.md

Lines changed: 50 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Trafilatura: Discover and Extract Text Data on the Web
1+
# Trafilatura: Discover Web Content, Extract Text and Metadata
22

33
<br/>
44

@@ -13,81 +13,72 @@
1313
[![Downloads](https://static.pepy.tech/badge/trafilatura/month)](https://pepy.tech/project/trafilatura)
1414
[![Reference DOI: 10.18653/v1/2021.acl-demo.15](https://img.shields.io/badge/DOI-10.18653%2Fv1%2F2021.acl--demo.15-blue)](https://aclanthology.org/2021.acl-demo.15/)
1515

16-
<br/>
17-
18-
<img alt="Demo as GIF image" src="https://raw.githubusercontent.com/adbar/trafilatura/master/docs/trafilatura-demo.gif" align="center" width="80%"/>
1916

20-
<br/>
17+
``` python
18+
>>> from trafilatura import fetch_url, extract
19+
>>> downloaded = fetch_url("https://github.blog/2019-03-29-leader-spotlight-erin-spiceland/")
20+
>>> extract(downloaded)
21+
'Erin Spiceland is a software engineer and ...'
22+
>>> extract(downloaded, output_format="json", with_metadata=True)
23+
'{"title": "Leader spotlight: Erin Spiceland", "author": "Jessica Rudder", "text": "Erin Spiceland is a software engineer and ..."}'
24+
```
2125

2226

2327
## Introduction
2428

25-
Trafilatura is a cutting-edge **Python package and command-line tool**
26-
designed to **gather text on the Web and simplify the process of turning
27-
raw HTML into structured, meaningful data**. It includes all necessary
29+
Trafilatura is a comprehensive **Python package and command-line tool**
30+
designed to **gather text from the Web and turn raw HTML into structured,
31+
meaningful data**. It includes all necessary
2832
discovery and text processing components to perform **web crawling,
2933
downloads, scraping, and extraction** of main texts, metadata and
3034
comments. It aims at staying **handy and modular**: no database is
3135
required, the output can be converted to commonly used formats.
3236

33-
Going from HTML bulk to essential parts can alleviate many problems
34-
related to text quality, by **focusing on the actual content**,
35-
**avoiding the noise** caused by recurring elements like headers and footers
36-
and by **making sense of the data and metadata** with selected information.
37+
Going from raw HTML to essential parts, it **focuses on the actual
38+
content**, **avoids noise** caused by recurring elements (headers,
39+
footers, boilerplate), and **makes sense of the data and metadata**.
3740
The extractor strikes a balance between limiting noise (precision) and
3841
including all valid parts (recall). It is **robust and reasonably fast**.
3942

4043
Trafilatura is [widely used](https://trafilatura.readthedocs.io/en/latest/used-by.html)
41-
and integrated into [thousands of projects](https://github.com/adbar/trafilatura/network/dependents)
42-
by companies like HuggingFace, IBM, and Microsoft Research as well as institutions like
43-
the Allen Institute, Stanford, the Tokyo Institute of Technology, and
44-
the University of Munich.
44+
across [thousands of projects](https://github.com/adbar/trafilatura/network/dependents),
45+
including by HuggingFace, IBM, Microsoft Research, NVIDIA, the Allen Institute for AI, Stanford, and the Internet Archive.
4546

4647

4748
### Features
4849

4950
- Advanced web crawling and text discovery:
50-
- Support for sitemaps (TXT, XML) and feeds (ATOM, JSON, RSS)
51-
- Smart crawling and URL management (filtering and deduplication)
51+
- Support for sitemaps (TXT, XML) and feeds (ATOM, JSON, RSS)
52+
- Smart crawling and URL management (filtering and deduplication)
5253

5354
- Parallel processing of online and offline input:
54-
- Live URLs, efficient and polite processing of download queues
55-
- Previously downloaded HTML files and parsed HTML trees
55+
- Live URLs, efficient and polite processing of download queues
56+
- Previously downloaded HTML files and parsed HTML trees
5657

5758
- Robust and configurable extraction of key elements:
58-
- Main text (common patterns and generic algorithms like jusText and readability)
59-
- Metadata (title, author, date, site name, categories and tags)
60-
- Formatting and structure: paragraphs, titles, lists, quotes, code, line breaks, in-line text formatting
61-
- Optional elements: comments, links, images, tables
59+
- Main text (own rule-based extractor with jusText and readability-lxml as fallbacks)
60+
- Metadata (title, author, date, site name, categories and tags)
61+
- Formatting and structure: paragraphs, titles, lists, quotes, code, line breaks, in-line text formatting
62+
- Optional elements: comments, links, images, tables
63+
- Optional add-ons: language detection, speed optimizations
6264

6365
- Multiple output formats:
64-
- TXT and Markdown
65-
- CSV
66-
- JSON
67-
- HTML, XML and [XML-TEI](https://tei-c.org/)
66+
- TXT and Markdown
67+
- CSV
68+
- JSON
69+
- HTML, XML and [XML-TEI](https://tei-c.org/)
6870

69-
- Optional add-ons:
70-
- Language detection on extracted content
71-
- Speed optimizations
7271

73-
- Actively maintained with support from the open-source community:
74-
- Regular updates, feature additions, and optimizations
75-
- Comprehensive documentation
76-
77-
78-
### Evaluation and alternatives
72+
### Evaluation
7973

8074
Trafilatura consistently outperforms other open-source libraries in text
81-
extraction benchmarks, showcasing its efficiency and accuracy in
82-
extracting web content. The extractor tries to strike a balance between
83-
limiting noise and including all valid parts.
84-
85-
For more information see the [benchmark section](https://trafilatura.readthedocs.io/en/latest/evaluation.html)
75+
extraction benchmarks. For more information see the
76+
[benchmark section](https://trafilatura.readthedocs.io/en/latest/evaluation.html)
8677
and the [evaluation readme](https://github.com/adbar/trafilatura/blob/master/tests/README.rst)
8778
to run the evaluation with the latest data and packages.
8879

8980

90-
#### Other evaluations:
81+
#### Other evaluations
9182

9283
- Most efficient open-source library in *ScrapingHub*'s [article extraction benchmark](https://github.com/scrapinghub/article-extraction-benchmark)
9384
- Best overall tool according to [Bien choisir son outil d'extraction de contenu à partir du Web](https://hal.archives-ouvertes.fr/hal-02768510v3/document)
@@ -96,7 +87,7 @@ to run the evaluation with the latest data and packages.
9687
(Bevendorff et al. 2023)
9788

9889

99-
## Usage and documentation
90+
## Documentation
10091

10192
[Getting started with Trafilatura](https://trafilatura.readthedocs.io/en/latest/quickstart.html)
10293
is straightforward. For more information and detailed guides, visit
@@ -108,12 +99,10 @@ is straightforward. For more information and detailed guides, visit
10899
[With Python](https://trafilatura.readthedocs.io/en/latest/usage-python.html),
109100
[With R](https://trafilatura.readthedocs.io/en/latest/usage-r.html)
110101
- [Core Python functions](https://trafilatura.readthedocs.io/en/latest/corefunctions.html)
111-
- Interactive Python Notebook: [Trafilatura Overview](docs/Trafilatura_Overview.ipynb)
102+
- Interactive Python Notebook: [Trafilatura Overview](docs/Trafilatura_Overview.ipynb) (in the repository)
112103
- [Tutorials and use cases](https://trafilatura.readthedocs.io/en/latest/tutorials.html)
113104

114-
Youtube playlist with video tutorials in several languages:
115-
116-
- [Web scraping tutorials and how-tos](https://www.youtube.com/watch?v=8GkiOM17t0Q&list=PL-pKWbySIRGMgxXQOtGIz1-nbfYLvqrci)
105+
See the [video tutorials playlist](https://www.youtube.com/watch?v=8GkiOM17t0Q&list=PL-pKWbySIRGMgxXQOtGIz1-nbfYLvqrci) (multiple languages).
117106

118107

119108
## License
@@ -123,7 +112,7 @@ This package is distributed under the [Apache 2.0 license](https://www.apache.or
123112
Versions prior to v1.8.0 are under GPLv3+ license.
124113

125114

126-
### Contributing
115+
## Contributing
127116

128117
Contributions of all kinds are welcome. Visit the [Contributing
129118
page](https://github.com/adbar/trafilatura/blob/master/CONTRIBUTING.md)
@@ -135,18 +124,21 @@ Many thanks to the
135124
who extended the docs or submitted bug reports, features and bugfixes!
136125

137126

127+
## Support
128+
129+
**If you value this software or depend on it for your product, consider
130+
sponsoring it and contributing to its codebase.** Your support
131+
[on GitHub](https://github.com/sponsors/adbar) or [ko-fi.com](https://ko-fi.com/adbarbaresi)
132+
will help maintain and enhance this package.
133+
134+
138135
## Context
139136

140137
This work started as a PhD project at the crossroads of linguistics and
141-
NLP, this expertise has been instrumental in shaping Trafilatura over
138+
NLP. This expertise has been instrumental in shaping Trafilatura over
142139
the years. Initially launched to create text databases for research purposes
143140
at the Berlin-Brandenburg Academy of Sciences (DWDS and ZDL units),
144-
this package continues to be maintained but its future depends on community support.
145-
146-
**If you value this software or depend on it for your product, consider
147-
sponsoring it and contributing to its codebase**. Your support
148-
[on GitHub](https://github.com/sponsors/adbar) or [ko-fi.com](https://ko-fi.com/adbarbaresi)
149-
will help maintain and enhance this popular package.
141+
this package continues to be maintained and its future depends on community support.
150142

151143
*Trafilatura* is an Italian word for [wire
152144
drawing](https://en.wikipedia.org/wiki/Wire_drawing) symbolizing the
@@ -155,7 +147,7 @@ are formed.
155147

156148
### Author
157149

158-
Reach out via ia the software repository or the [contact
150+
Reach out via the software repository or the [contact
159151
page](https://adrien.barbaresi.eu/) for inquiries, collaborations, or
160152
feedback. See also social networks for the latest updates.
161153

@@ -198,10 +190,8 @@ acquisition. Here is how to cite it:
198190
Jointly developed plugins and additional packages also contribute to the
199191
field of web data extraction and analysis:
200192

201-
<img alt="Software ecosystem" src="https://raw.githubusercontent.com/adbar/htmldate/master/docs/software-ecosystem.png" align="center" width="65%"/>
193+
<img alt="Diagram of trafilatura and related packages (htmldate, courlan, jusText)" src="https://raw.githubusercontent.com/adbar/htmldate/master/docs/software-ecosystem.png" align="center" width="65%"/>
202194

203195
Corresponding posts can be found on [Bits of
204196
Language](https://adrien.barbaresi.eu/blog/tag/trafilatura.html).
205197

206-
Impressive, you have reached the end of the page: Thank you for your
207-
interest!

0 commit comments

Comments
 (0)