naufalnashif commited on
Commit
8a9efb5
·
1 Parent(s): 5ed8b1d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -13,17 +13,18 @@ def scrape_e_commerce(nama_barang, num_items):
13
  query = quote(nama_barang)
14
 
15
 
16
- #while len(products) < num_items :
17
- for percent in range(num_items):
 
 
 
18
  progress_text = "Scraping in progress. Please wait."
19
  my_bar = st.progress(len(products), text=progress_text)
20
 
21
  prop = min(len(products) / num_items,1)
22
  my_bar.progress(prop, text=progress_text)
23
 
24
- if len (products) > num_items :
25
- products = products[:num_items]
26
- break
27
 
28
  url = f"https://www.klikindomaret.com/search/?key={query}&categories=&productbrandid=&sortcol=&pagesize=54&page={page}&startprice=&endprice=&attributes=&ShowItem="
29
  response = requests.get(url)
 
13
  query = quote(nama_barang)
14
 
15
 
16
+ while len(products) < num_items :
17
+ if len (products) > num_items :
18
+ products = products[:num_items]
19
+ break
20
+
21
  progress_text = "Scraping in progress. Please wait."
22
  my_bar = st.progress(len(products), text=progress_text)
23
 
24
  prop = min(len(products) / num_items,1)
25
  my_bar.progress(prop, text=progress_text)
26
 
27
+
 
 
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)