Commit
·
2097450
1
Parent(s):
1c6a22b
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,9 @@ def scrape_klikindomaret(nama_barang, num_items):
|
|
22 |
|
23 |
|
24 |
while len(products) < num_items :
|
25 |
-
|
|
|
|
|
26 |
|
27 |
url = f"https://www.klikindomaret.com/search/?key={query}&categories=&productbrandid=&sortcol=&pagesize=54&page={page}&startprice=&endprice=&attributes=&ShowItem="
|
28 |
response = requests.get(url)
|
@@ -62,9 +64,7 @@ def scrape_klikindomaret(nama_barang, num_items):
|
|
62 |
my_bar.progress(prop, text=progress_text)
|
63 |
time.sleep(1)
|
64 |
my_bar.empty()
|
65 |
-
|
66 |
-
products = products[:num_items]
|
67 |
-
break
|
68 |
page += 1
|
69 |
|
70 |
return products
|
|
|
22 |
|
23 |
|
24 |
while len(products) < num_items :
|
25 |
+
if len (products) > num_items :
|
26 |
+
products = products[:num_items]
|
27 |
+
break
|
28 |
|
29 |
url = f"https://www.klikindomaret.com/search/?key={query}&categories=&productbrandid=&sortcol=&pagesize=54&page={page}&startprice=&endprice=&attributes=&ShowItem="
|
30 |
response = requests.get(url)
|
|
|
64 |
my_bar.progress(prop, text=progress_text)
|
65 |
time.sleep(1)
|
66 |
my_bar.empty()
|
67 |
+
|
|
|
|
|
68 |
page += 1
|
69 |
|
70 |
return products
|