🚀 Interesse an diesem Projekt? Sprechen Sie mich an!
💰 Business Value
Extrahiert Firmenkontaktdaten vom Technologiepark Herzogenrath und bereitet sie für Google-Kontakte-Import vor. Python, BeautifulSoup und CSV-Export.
⚙️ Funktionsweise
Die Kern-Mechanik des Projekts im Überblick.
💻 Technische Umsetzung
Das Projekt nutzt Python mit BeautifulSoup für Web-Scraping und CSV-Export im Google-Kontakte-Format.
🐍 Snippet 1: Web-Scraper Core
Lädt die TPH-Firmenverzeichnis-Seite und extrahiert strukturierte Firmendaten per BeautifulSoup.
import requests
from bs4 import BeautifulSoup
def extract_tph_contacts():
url = "https://www.tph.de/firmenverzeichnis"
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) '
'AppleWebKit/537.36'
}
response = requests.get(url, headers=headers)
soup = BeautifulSoup(response.content, 'html.parser')
companies = []
company_headers = soup.find_all('h4')
for header in company_headers:
company_name = header.get_text(strip=True)
# Buchstaben-Navigation überspringen
if company_name in list('ABCDEFGHIJKLMNOPQRSTUVWXYZ'):
continue
company_data = {
'Name': company_name,
'Gebäude': '', 'Etage': '',
'Telefon': '', 'Telefax': '',
'E-Mail': '', 'Internet': ''
}
# Kontaktdaten aus umgebendem Text extrahieren
current = header.next_sibling
text = ""
while current and current.name != 'h4':
if hasattr(current, 'get_text'):
text += current.get_text() + " "
current = current.next_sibling
for line in text.split('\n'):
line = line.strip()
if line.startswith('Gebäude:'):
company_data['Gebäude'] = line.split(':',1)[1].strip()
elif line.startswith('Telefon:'):
company_data['Telefon'] = line.split(':',1)[1].strip()
# E-Mail aus mailto:-Links
parent = header.parent
if parent:
for link in parent.find_all('a', href=True):
href = link.get('href', '')
if href.startswith('mailto:'):
company_data['E-Mail'] = href[7:]
elif 'http' in href:
company_data['Internet'] = href
companies.append(company_data)
return companies
🐍 Snippet 2: Google-Kontakte CSV-Export
Speichert die extrahierten Daten im Google-Kontakte-Importformat mit allen relevanten Feldern.
import csv
def save_to_csv(companies, filename="tph_contacts.csv"):
"""Speichert Kontakte als CSV für Google-Kontakte-Import"""
fieldnames = [
'Name', 'E-mail 1 - Type', 'E-mail 1 - Value',
'Phone 1 - Type', 'Phone 1 - Value',
'Phone 2 - Type', 'Phone 2 - Value',
'Website 1 - Type', 'Website 1 - Value',
'Organization 1 - Type', 'Organization 1 - Name',
'Address 1 - Type', 'Address 1 - Street',
'Address 1 - City', 'Address 1 - Postal Code',
'Address 1 - Country', 'Notes'
]
with open(filename, 'w', newline='', encoding='utf-8') as f:
writer = csv.DictWriter(f, fieldnames=fieldnames)
writer.writeheader()
for c in companies:
writer.writerow({
'Name': c['Name'],
'E-mail 1 - Type': 'Work',
'E-mail 1 - Value': c['E-Mail'],
'Phone 1 - Type': 'Work',
'Phone 1 - Value': c['Telefon'],
'Phone 2 - Type': 'Work Fax',
'Phone 2 - Value': c['Telefax'],
'Website 1 - Type': 'Work',
'Website 1 - Value': c['Internet'],
'Organization 1 - Type': 'Work',
'Organization 1 - Name': c['Name'],
'Address 1 - City': 'Herzogenrath',
'Address 1 - Postal Code': '52314',
'Address 1 - Country': 'Deutschland',
'Notes': f"Gebäude: {c['Gebäude']}\nTPH Herzogenrath"
})
print(f"✅ {len(companies)} Kontakte gespeichert!")
🐍 Snippet 3: Main — Ausführung & Zusammenfassung
Hauptprogramm: Führt den Scraper aus, zeigt Statistiken und speichert in zwei CSV-Formaten.
if __name__ == "__main__":
print("🔍 Extrahiere Firmenkontakte von TPH Herzogenrath...")
companies = extract_tph_contacts()
if companies:
# Statistik
print(f"\n📊 Gefundene Firmen: {len(companies)}")
print(f"Mit E-Mail: {sum(1 for c in companies if c['E-Mail'])}")
print(f"Mit Telefon: {sum(1 for c in companies if c['Telefon'])}")
print(f"Mit Webseite: {sum(1 for c in companies if c['Internet'])}")
# Google-Kontakte Format
save_to_csv(companies)
# Einfaches Format zusätzlich
with open('tph_simple.csv', 'w', newline='',
encoding='utf-8') as f:
w = csv.DictWriter(f, fieldnames=[
'Name','Gebäude','Etage','Telefon','Telefax',
'E-Mail','Internet'])
w.writeheader()
w.writerows(companies)
print("📁 Einfaches CSV: tph_simple.csv")
else:
print("❌ Keine Firmendaten gefunden.")
⚡ In wenigen Tagen zum MVP — mit Vibecoding.
🚀 Gebaut mit Vibecoding
- 📋 2–3 Wochen Requirements
- 🏗️ 2–3 Wochen Architektur
- 💻 3–4 Wochen Implementierung
- 🧪 1–2 Wochen Testing
- ⏱️ Gesamt: 8–13 Wochen
- 🗣️ 0.5 Tage Prompt-Engineering
- ⚡ 2–3 Tage iterative Generierung
- 🔧 1–2 Tage Refinement
- ✅ 1 Tag Testing & Deployment
- ⏱️ Gesamt: 5–7 Tage
🎯 Strategische Erkenntnisse
Jedes Projekt liefert wertvolle Einsichten — technisch wie strategisch. Diese Learnings fließen direkt in Folgeprojekte ein.
Bereit für Ihr nächstes Projekt?
Lassen Sie uns gemeinsam herausfinden, wo Automatisierung und KI den größten Hebel für Ihr Business haben — unverbindlich und pragmatisch.