filter description

This commit is contained in:
2025-11-28 22:34:43 +01:00
parent b23725e2a3
commit 943a147420
5 changed files with 150 additions and 2 deletions

View File

@ -222,6 +222,11 @@ class KleinanzeigenScraper:
if not zip_code:
return None
desc = None
desc_elem = soup.find("p", id="viewad-description-text")
if desc_elem:
desc = desc_elem.text.strip()
listing = {
"title": title,
"price": price,
@ -231,6 +236,7 @@ class KleinanzeigenScraper:
"date_added": date_added.isoformat() if date_added else None,
"image": first_image,
"url": url,
"desc": desc,
}
# Add coordinates
@ -275,6 +281,7 @@ def main():
# Search for listings
print("Step 1: Searching for listing URLs...")
listing_urls = scraper.search_listings(search_term, max_pages, min_price, max_price)
#listing_urls = ["https://www.kleinanzeigen.de/s-anzeige/cube-nuroad-pro-fe-2023-58-cm-l-/3226095826-217-23527"]
print(f"Found {len(listing_urls)} listings\n")
if len(listing_urls) > 0:
@ -294,6 +301,7 @@ def main():
print(f" Date: {listing['date_added']}")
print(f" Coordinates: {listing.get('lat')}, {listing.get('lon')}")
print(f" Image: {listing['image']}")
print(f" Description: {listing['desc']}")
else:
print("Failed to scrape listing")