Comments (5)
I may use different heuristics but this is open for debate.
from trafilatura.
Well, I tried to summarise what trafilatura is currently doing, could you confirm or correct please?
from trafilatura.
My bad, I answered question 2.
Title extraction roughly works as you described in your list, with two additional steps:
- First and foremost HTML meta or JSON information is used when available
- Tag attributes are used in some cases, not only tags themselves, e.g.
@class="entry-title"
from trafilatura.
I have a dataset with over 10M home pages, of which 82K (less than 1%) contain a @class="entry-title"
. WP is not popular in this dataset.
75K pages contain a <h1 class="entry-title">
, 56K a h2
, 18K a h3
.
For my dataset h1
and h2
are sufficient.
I'll figure out next how many pages contain a <meta name="description" content="...">
from trafilatura.
That's interesting, feel free to share results if you find anything else, I patched together a series of heuristics but I lack the time to evaluate them properly. Besides, the quick searches I run on my data may also be biased so it's useful to try them on yours.
The manually curated list of X-Path expressions to extract titles is here:
trafilatura/trafilatura/metaxpaths.py
Line 54 in c6f4559
'//*[(self::h1 or self::h2)][contains(@class, "post-title") or contains(@class, "entry-title") or contains(@class, "headline") or contains(@id, "headline") or contains(@itemprop, "headline") or contains(@class, "post__title") or contains(@class, "article-title")]',
'//*[@class="entry-title" or @class="post-title"]',
'//*[(self::h1 or self::h2 or self::h3)][contains(@class, "title") or contains(@id, "title")]',
from trafilatura.
Related Issues (20)
- Function to use part of the heuristics on bare HTML fragments
- metadata extraction problem HOT 8
- XMLSyntaxError during conversion to XML output HOT 1
- Option to convert relative links HOT 1
- Doesn't seem to work with recent charset-normalizer HOT 2
- Check URLs passed to courlan functions `extract_links` and `fix_relative_urls` HOT 1
- Code example for Multi-Threaded downloads seems out of date HOT 4
- Image markdown not included during processing HOT 5
- Code tags are not parsed properly HOT 2
- Is it possible to get the metadata with markdown format? HOT 1
- Redirecting https://twitter.com HOT 1
- `included_images` failed when trying to extract images in a table HOT 7
- author metadata field is null for YouTube videos HOT 1
- Empty h1 blocks non-empty h2 HOT 1
- Use of Signal Prevents Multithreading on Linux HOT 1
- Corrupted Markdown output when TXT+formatting HOT 2
- Web API idea HOT 2
- Installation problem on Mac due to charset version mismatch HOT 1
- Returns horribly bad result for MSN page HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trafilatura.