hatamo commited on
Commit
a65be27
·
1 Parent(s): 7c3f29a

Addiditonal scrapper integration fixes

Browse files
code/app.py CHANGED
@@ -99,17 +99,17 @@ async def validate_url(url: str = Form(...), max_images: int = Form(3)):
99
  max_images = max(1, min(max_images, 10))
100
 
101
  if "allegro.pl" in url:
102
- from web_scraper_allegro import scrape_allegro_offer
103
 
104
- auction = scrape_allegro_offer(url)
105
  elif "olx.pl" in url:
106
- from web_scraper_olx import scrape_olx_offer
107
 
108
- auction = scrape_olx_offer(url)
109
  elif "ebay." in url:
110
- from web_scraper_ebay import scrape_ebay_offer
111
 
112
- auction = scrape_ebay_offer(url)
113
  else:
114
  return JSONResponse({"error": "Unsupported platform"}, status_code=400)
115
 
 
99
  max_images = max(1, min(max_images, 10))
100
 
101
  if "allegro.pl" in url:
102
+ from web_scraper_allegro import get_allegro_data
103
 
104
+ auction = get_allegro_data(url)
105
  elif "olx.pl" in url:
106
+ from web_scraper_olx import get_olx_data
107
 
108
+ auction = get_olx_data(url)
109
  elif "ebay." in url:
110
+ from web_scraper_ebay import get_ebay_data
111
 
112
+ auction = get_ebay_data(url)
113
  else:
114
  return JSONResponse({"error": "Unsupported platform"}, status_code=400)
115
 
code/web_scraper_allegro.py CHANGED
@@ -143,8 +143,3 @@ def get_allegro_data(url):
143
  except Exception as e:
144
  print(f"Main error occurred: {e}")
145
 
146
- # --- USAGE ---
147
- if __name__ == "__main__":
148
- link = input("Enter the Allegro offer link: ")
149
- data = get_allegro_data(link)
150
- print(json.dumps(data, indent=4, ensure_ascii=False))
 
143
  except Exception as e:
144
  print(f"Main error occurred: {e}")
145
 
 
 
 
 
 
code/web_scraper_olx.py CHANGED
@@ -90,8 +90,3 @@ def get_olx_data(url):
90
  }
91
 
92
 
93
- # --- USAGE ---
94
- if __name__ == "__main__":
95
- link = input("Enter the OLX offer link: ")
96
- data = get_olx_data(link)
97
- print(json.dumps(data, indent=4, ensure_ascii=False))
 
90
  }
91
 
92