syntax korrektur
This commit is contained in:
@@ -12,7 +12,7 @@ import csv
|
|||||||
|
|
||||||
# ==================== KONFIGURATION ====================
|
# ==================== KONFIGURATION ====================
|
||||||
class Config:
|
class Config:
|
||||||
VERSION = "1.1.2"
|
VERSION = "1.0.14"
|
||||||
LANG = "de"
|
LANG = "de"
|
||||||
CREDENTIALS_FILE = "service_account.json"
|
CREDENTIALS_FILE = "service_account.json"
|
||||||
SHEET_URL = "https://docs.google.com/spreadsheets/d/1u_gHr9JUfmV1-iviRzbSe3575QEp7KLhK5jFV_gJcgo"
|
SHEET_URL = "https://docs.google.com/spreadsheets/d/1u_gHr9JUfmV1-iviRzbSe3575QEp7KLhK5jFV_gJcgo"
|
||||||
@@ -255,4 +255,33 @@ class DataProcessor:
|
|||||||
print(f"\n[{datetime.now().strftime('%H:%M:%S')}] Verarbeite Zeile {row_num}: {company_name}")
|
print(f"\n[{datetime.now().strftime('%H:%M:%S')}] Verarbeite Zeile {row_num}: {company_name}")
|
||||||
article = self.wiki_scraper.search_company_article(company_name, website)
|
article = self.wiki_scraper.search_company_article(company_name, website)
|
||||||
if article:
|
if article:
|
||||||
company_data = self.w_
|
company_data = self.wiki_scraper.extract_company_data(article.url)
|
||||||
|
else:
|
||||||
|
company_data = {'branche': 'k.A.', 'umsatz': 'k.A.', 'url': '', 'full_infobox': 'k.A.'}
|
||||||
|
|
||||||
|
current_values = self.sheet_handler.sheet.row_values(row_num)
|
||||||
|
new_values = [
|
||||||
|
company_data.get('full_infobox', 'k.A.'), # Spalte G: kompletter Infobox-Text
|
||||||
|
company_data['branche'] if company_data['branche'] != "k.A." else current_values[6] if len(current_values) > 6 else "k.A.",
|
||||||
|
"k.A.",
|
||||||
|
company_data['umsatz'] if company_data['umsatz'] != "k.A." else current_values[8] if len(current_values) > 8 else "k.A.",
|
||||||
|
"k.A.", "k.A.", "k.A.",
|
||||||
|
company_data['url'] if company_data['url'] else current_values[12] if len(current_values) > 12 else "",
|
||||||
|
datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
||||||
|
"k.A.", "k.A.",
|
||||||
|
Config.VERSION
|
||||||
|
]
|
||||||
|
self.sheet_handler.update_row(row_num, new_values)
|
||||||
|
print(f"✅ Aktualisiert: Branche: {new_values[1]}, Umsatz: {new_values[3]}, URL: {new_values[7]}")
|
||||||
|
time.sleep(Config.RETRY_DELAY)
|
||||||
|
|
||||||
|
# ==================== MAIN ====================
|
||||||
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
|
num_rows = int(input("Wieviele Zeilen sollen überprüft werden? "))
|
||||||
|
except Exception as e:
|
||||||
|
print("Ungültige Eingabe. Bitte eine Zahl eingeben.")
|
||||||
|
exit(1)
|
||||||
|
processor = DataProcessor()
|
||||||
|
processor.process_rows(num_rows)
|
||||||
|
print("\n✅ Wikipedia-Auswertung abgeschlossen")
|
||||||
|
|||||||
Reference in New Issue
Block a user