dealfront_enrichment.py aktualisiert
This commit is contained in:
@@ -111,10 +111,10 @@ class DealfrontScraper:
|
|||||||
|
|
||||||
def extract_current_page_results(self):
|
def extract_current_page_results(self):
|
||||||
results = []
|
results = []
|
||||||
rows_selector = (By.XPATH, "//table[@id='t-result-table']/tbody/tr[.//a[contains(@class, 't-highlight-text')]]")
|
rows_selector = (By.CSS_SELECTOR, "table#t-result-table tbody tr[id]")
|
||||||
|
|
||||||
try:
|
|
||||||
data_rows = self.driver.find_elements(*rows_selector)
|
data_rows = self.driver.find_elements(*rows_selector)
|
||||||
|
logger.info(f"{len(data_rows)} Datenzeilen zur Extraktion gefunden.")
|
||||||
|
|
||||||
for row in data_rows:
|
for row in data_rows:
|
||||||
try:
|
try:
|
||||||
name = row.find_element(By.CSS_SELECTOR, ".sticky-column a.t-highlight-text").get_attribute("title").strip()
|
name = row.find_element(By.CSS_SELECTOR, ".sticky-column a.t-highlight-text").get_attribute("title").strip()
|
||||||
@@ -126,9 +126,6 @@ class DealfrontScraper:
|
|||||||
results.append({'name': name, 'website': website})
|
results.append({'name': name, 'website': website})
|
||||||
except NoSuchElementException:
|
except NoSuchElementException:
|
||||||
continue
|
continue
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"Fehler bei der Extraktion auf der aktuellen Seite: {e}")
|
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def scrape_all_pages(self, max_pages=10):
|
def scrape_all_pages(self, max_pages=10):
|
||||||
|
|||||||
Reference in New Issue
Block a user