enrich data

This commit is contained in:
Tour
2025-12-07 06:40:32 +01:00
parent b5ef8029ce
commit 3a77c8b0cd
4 changed files with 988 additions and 1 deletions

View File

@@ -222,9 +222,61 @@ class TroostwijkScraper:
if bidding_data:
formatted_data = format_bid_data(bidding_data)
page_data.update(formatted_data)
# Enhanced logging with new intelligence fields
print(f" Bid: {page_data.get('current_bid', 'N/A')}")
print(f" Status: {page_data.get('status', 'N/A')}")
# NEW: Show followers count (watch count)
followers = page_data.get('followers_count', 0)
if followers > 0:
print(f" Followers: {followers} watching")
# NEW: Show estimated prices for value assessment
est_min = page_data.get('estimated_min_price')
est_max = page_data.get('estimated_max_price')
if est_min or est_max:
if est_min and est_max:
print(f" Estimate: EUR {est_min:.2f} - EUR {est_max:.2f}")
# Calculate and show value gap for bargain detection
current_bid_str = page_data.get('current_bid', '')
if 'EUR' in current_bid_str and 'No bids' not in current_bid_str:
try:
current_bid_val = float(current_bid_str.replace('EUR ', '').replace(',', ''))
value_gap = est_min - current_bid_val
if value_gap > 0:
gap_pct = (value_gap / est_min) * 100
if gap_pct > 20:
print(f" >> BARGAIN: {gap_pct:.0f}% below estimate!")
else:
print(f" Value gap: {gap_pct:.0f}% below estimate")
except:
pass
elif est_min:
print(f" Estimate: From EUR {est_min:.2f}")
elif est_max:
print(f" Estimate: Up to EUR {est_max:.2f}")
# NEW: Show condition information
condition = page_data.get('lot_condition')
if condition:
print(f" Condition: {condition}")
# Show manufacturer/brand if available
brand = page_data.get('brand') or page_data.get('manufacturer')
model = page_data.get('model')
year = page_data.get('year_manufactured')
if brand or model or year:
parts = []
if year:
parts.append(str(year))
if brand:
parts.append(brand)
if model:
parts.append(model)
print(f" Item: {' '.join(parts)}")
# Extract bid increment from nextBidStepInCents
lot_details_lot = bidding_data.get('lot', {})
next_step_cents = lot_details_lot.get('nextBidStepInCents')
@@ -242,7 +294,7 @@ class TroostwijkScraper:
if bid_history:
bid_data = parse_bid_history(bid_history, lot_id)
page_data.update(bid_data)
print(f" Bid velocity: {bid_data['bid_velocity']} bids/hour")
print(f" >> Bid velocity: {bid_data['bid_velocity']:.1f} bids/hour")
# Save bid history to database
self.cache.save_bid_history(lot_id, bid_data['bid_records'])