Spaces:
Sleeping
Sleeping
Addiditonal scrapper integration fixes
Browse files- code/app.py +6 -6
- code/web_scraper_allegro.py +0 -5
- code/web_scraper_olx.py +0 -5
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
|
| 103 |
|
| 104 |
-
auction =
|
| 105 |
elif "olx.pl" in url:
|
| 106 |
-
from web_scraper_olx import
|
| 107 |
|
| 108 |
-
auction =
|
| 109 |
elif "ebay." in url:
|
| 110 |
-
from web_scraper_ebay import
|
| 111 |
|
| 112 |
-
auction =
|
| 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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|