Commit
·
8dae00d
1
Parent(s):
64cf71d
Update app.py
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ def scrape_klikindomaret(nama_barang, num_items):
|
|
18 |
products = []
|
19 |
page = 1
|
20 |
query = quote(nama_barang)
|
21 |
-
|
22 |
|
23 |
while len(products) < num_items :
|
24 |
if len (products) > num_items :
|
@@ -57,13 +57,11 @@ def scrape_klikindomaret(nama_barang, num_items):
|
|
57 |
'price': product_price,
|
58 |
'link': product_link
|
59 |
})
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
time.sleep(1)
|
66 |
-
placeholder.empty()
|
67 |
page += 1
|
68 |
|
69 |
return products
|
|
|
18 |
products = []
|
19 |
page = 1
|
20 |
query = quote(nama_barang)
|
21 |
+
|
22 |
|
23 |
while len(products) < num_items :
|
24 |
if len (products) > num_items :
|
|
|
57 |
'price': product_price,
|
58 |
'link': product_link
|
59 |
})
|
60 |
+
if len (products) > num_items :
|
61 |
+
products = products[:num_items]
|
62 |
+
break
|
63 |
+
with st.expander("Progress Scraping :"):
|
64 |
+
st.write(f'Terambil {len(products)} data')
|
|
|
|
|
65 |
page += 1
|
66 |
|
67 |
return products
|