Commit
·
de84a05
1
Parent(s):
efd3d5c
Update app.py
Browse files
app.py
CHANGED
@@ -21,14 +21,8 @@ def scrape_klikindomaret(nama_barang, num_items):
|
|
21 |
progress_text = "Scraping in progress. Please wait."
|
22 |
my_bar = st.progress(0, text=progress_text)
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
if len (products) > num_items :
|
27 |
-
products = products[:num_items]
|
28 |
-
break
|
29 |
-
|
30 |
-
prop = min(len(products)/num_items, 1)
|
31 |
-
my_bar.progress(prop, text=progress_text)
|
32 |
|
33 |
url = f"https://www.klikindomaret.com/search/?key={query}&categories=&productbrandid=&sortcol=&pagesize=54&page={page}&startprice=&endprice=&attributes=&ShowItem="
|
34 |
response = requests.get(url)
|
@@ -63,7 +57,11 @@ def scrape_klikindomaret(nama_barang, num_items):
|
|
63 |
'price': product_price,
|
64 |
'link': product_link
|
65 |
})
|
66 |
-
|
|
|
|
|
|
|
|
|
67 |
page += 1
|
68 |
|
69 |
time.sleep(1)
|
|
|
21 |
progress_text = "Scraping in progress. Please wait."
|
22 |
my_bar = st.progress(0, text=progress_text)
|
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)
|
|
|
57 |
'price': product_price,
|
58 |
'link': product_link
|
59 |
})
|
60 |
+
prop = min(len(products)/num_items, 1)
|
61 |
+
my_bar.progress(prop, text=progress_text)
|
62 |
+
if len (products) > num_items :
|
63 |
+
products = products[:num_items]
|
64 |
+
break
|
65 |
page += 1
|
66 |
|
67 |
time.sleep(1)
|