dealfront_enrichment.py aktualisiert
This commit is contained in:
@@ -9,6 +9,7 @@ from selenium.webdriver.support.ui import WebDriverWait
|
|||||||
from selenium.webdriver.support import expected_conditions as EC
|
from selenium.webdriver.support import expected_conditions as EC
|
||||||
from selenium.common.exceptions import TimeoutException, NoSuchElementException
|
from selenium.common.exceptions import TimeoutException, NoSuchElementException
|
||||||
from selenium.webdriver.common.keys import Keys
|
from selenium.webdriver.common.keys import Keys
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
from config import Config, DEALFRONT_LOGIN_URL, DEALFRONT_CREDENTIALS_FILE, DEALFRONT_TARGET_URL, TARGET_SEARCH_NAME
|
from config import Config, DEALFRONT_LOGIN_URL, DEALFRONT_CREDENTIALS_FILE, DEALFRONT_TARGET_URL, TARGET_SEARCH_NAME
|
||||||
|
|
||||||
@@ -232,13 +233,30 @@ if __name__ == "__main__":
|
|||||||
# Ergebnisse extrahieren
|
# Ergebnisse extrahieren
|
||||||
companies = scraper.extract_current_page_results()
|
companies = scraper.extract_current_page_results()
|
||||||
|
|
||||||
|
# === NEUE, SAUBERE AUSGABE ===
|
||||||
if companies:
|
if companies:
|
||||||
logger.info("===== Extrahierte Firmen (erste Seite) =====")
|
# Erstelle einen pandas DataFrame aus der Ergebnisliste
|
||||||
for company in companies:
|
df = pd.DataFrame(companies)
|
||||||
logger.info(f" - Name: {company['name']}, Webseite: {company['website']}")
|
|
||||||
logger.info("===========================================")
|
# Konfiguriere pandas, um den vollen Text in den Spalten anzuzeigen
|
||||||
|
pd.set_option('display.max_rows', None)
|
||||||
|
pd.set_option('display.max_columns', None)
|
||||||
|
pd.set_option('display.width', 1000)
|
||||||
|
pd.set_option('display.max_colwidth', None)
|
||||||
|
|
||||||
|
print("\n" + "="*80)
|
||||||
|
print(" EXTRAHIERTE FIRMEN (ERSTE SEITE) ".center(80, "="))
|
||||||
|
print("="*80)
|
||||||
|
if not df.empty:
|
||||||
|
print(df.to_string(index=False))
|
||||||
|
else:
|
||||||
|
print(" DataFrame ist leer, obwohl Ergebnisse vorhanden waren. Überprüfung nötig. ".center(80, "-"))
|
||||||
|
print("="*80 + "\n")
|
||||||
|
|
||||||
|
logger.info(f"{len(df)} Firmen erfolgreich in der Konsole ausgegeben.")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logger.warning("Keine Firmen auf der ersten Seite extrahiert.")
|
logger.warning("Keine Firmen auf der ersten Seite extrahiert oder gefunden.")
|
||||||
|
|
||||||
logger.info("Phase 2a Test erfolgreich abgeschlossen. Warte vor dem Schließen...")
|
logger.info("Phase 2a Test erfolgreich abgeschlossen. Warte vor dem Schließen...")
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
|||||||
Reference in New Issue
Block a user