Expand description
§german-impressum-extractor
Extract structured data from German B2B website text — specifically the Impressum page that German websites are legally required to expose under TMG §5.
§Why this crate exists
Germany requires every commercial website to publish a structured “Impressum” listing the legal entity, managing directors, address, contact info, and tax identifiers. This metadata is invaluable for B2B research, lead enrichment, compliance checks, and CRM tooling — yet existing scrapers usually leave you with raw HTML and a few hopeful regexes. This crate gives you a battle-tested, well-tested parser that handles the common cases (and many edge cases).
§Features
- 🇩🇪 German-aware: handles
ä,ö,ü,ß, common abbreviations, obfuscated emails (info [at] firma [dot] de), German phone formats (E.164 normalization), and address patterns. - 📦 Zero async runtime needed; pure synchronous parsing.
- 🔍 Granular: each extractor (emails, phones, address, persons, register numbers, etc.) is separately callable.
- 🪪 Pulls out: HR-Nummer, HR-Court, USt-IdNr., Steuernummer, IBAN, BIC.
- 📠 Fax / Telefax detection, kept separate from phone numbers.
- 👥 Geschäftsführer / Inhaber / Vorstand / Verantwortlicher (§18 MStV) name extraction with role tag.
- 🏢 Legal-form detection: GmbH, GmbH & Co. KG, UG, AG, KG, OHG, GbR, e.K., eG, SE.
- 📅 Year-founded heuristics (“gegründet 1973” / “seit 1985” / “founded in 1990”).
§Quick start
use german_impressum_extractor::extract_all;
let text = "
Musterreinigung GmbH & Co. KG
Geschäftsführer: Dr. Hans Müller und Anna Schmidt
Hauptstraße 12, 10115 Berlin
Tel: +49 30 1234567
E-Mail: info@musterreinigung.de
Eingetragen im Handelsregister Berlin HRB 12345 B
USt-IdNr.: DE 123456789
Gegründet 1985
";
let data = extract_all(text);
assert_eq!(data.emails, vec!["info@musterreinigung.de"]);
assert!(data.phones.contains(&"+493012345-67".replace('-', "")));
assert_eq!(data.legal_form.as_deref(), Some("GmbH & Co. KG"));
assert_eq!(data.hr_number.as_deref(), Some("HRB 12345 B"));
assert_eq!(data.vat_id.as_deref(), Some("DE123456789"));
assert_eq!(data.year_founded, Some(1985));
assert!(data.persons.iter().any(|p| p.last_name.as_deref() == Some("Müller")));§Granular use
All field extractors are public if you want to call them independently:
use german_impressum_extractor::{extract_emails, extract_phones};
let emails = extract_emails("Schreiben Sie an info [at] beispiel [dot] de");
assert_eq!(emails, vec!["info@beispiel.de"]);
let phones = extract_phones("Telefon: 030/123 45 67");
assert_eq!(phones[0], "+49301234567");Structs§
- Address
- A single postal address (one per address-bearing text block).
- Extracted
- Container for everything
extract_allreturns. - Person
- A single person mentioned in the Impressum (typically a managing director).
- Scored
- A value paired with a heuristic confidence in
0.0..=1.0. - Scored
Extracted - Scored counterpart of
crate::Extracted: the same fields, each annotated with a confidence. Returned bycrate::extract_all_scored.
Functions§
- extract_
address - Extract the first German address (
(postcode, city, street)) from text. - extract_
addresses - Extract every postal address on the page — one
Addressper text block that contains a postcode/city and/or a street, in document order, with exact duplicates removed. - extract_
all - Extract every supported field from a free-form text blob.
- extract_
all_ scored - Extract every supported field with a heuristic confidence score per field.
- extract_
bic - Extract a BIC / SWIFT code (uppercased). Only accepted when it appears in a
banking context (
BIC,SWIFT, orBankverbindungnearby) to avoid matching ordinary uppercase words. - extract_
de_ mail - Extract a De-Mail address, when labeled “De-Mail:”.
- extract_
dispute_ resolution_ url - Extract the EU Online-Dispute-Resolution (OS-Plattform) URL, if present.
- extract_
emails - Return all email addresses (plain and obfuscated
info [at] domain [dot] de), lowercased and deduplicated. Code-fragment false positives (invalid TLDs like.css/.js, known junk domains) are filtered out. - extract_
fax - Extract a labeled Fax / Telefax number, normalized to
+49…. - extract_
hr_ court - Extract the Handelsregister court that follows an
Amtsgerichtlabel (e.g."Berlin","Berlin (Charlottenburg)"). - extract_
hr_ number - Extract the HR (Handelsregister) number (e.g.
HRB 12345 B). - extract_
iban - Extract a German IBAN, normalized without spaces (e.g.
DE89370400440532013000). - extract_
legal_ form - Detect the German legal form mentioned in the text (e.g. “GmbH”, “GmbH & Co. KG”, “AG”).
- extract_
persons - Extract Geschäftsführer / Inhaber / Vorstand / Verantwortlicher persons.
- extract_
phones - Return all German phone numbers normalized to
+49…(digits only). - extract_
professional_ chamber - Extract the responsible professional chamber (“zuständige Kammer” / “Berufskammer”), when labeled.
- extract_
register_ type - Extract the Handelsregister section —
"HRA"or"HRB"— from the HR number. - extract_
supervisory_ authority - Extract the supervisory authority (“Aufsichtsbehörde”), when labeled.
- extract_
tax_ number - Extract a Steuernummer (local German tax number), e.g.
"28/815/0815 1". - extract_
vat_ id - Extract the German VAT-ID (USt-IdNr., format
DE+ 9 digits). - extract_
year_ founded - Extract the company’s founding year.