Commit
·
ddbcdcd
1
Parent(s):
ea87ab7
Update app.py
Browse files
app.py
CHANGED
@@ -151,18 +151,23 @@ def scrape_tokped(nama_barang, num_items):
|
|
151 |
|
152 |
for product_info in product_container_list:
|
153 |
link = product_info['href']
|
154 |
-
|
155 |
-
title =
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
|
|
|
|
161 |
rating_element = product_info.find('span', class_='prd_rating-average-text css-t70v7i')
|
162 |
rating = rating_element.text if rating_element else None
|
163 |
-
|
164 |
-
|
165 |
-
|
|
|
|
|
|
|
166 |
|
167 |
products.append({
|
168 |
'link': link,
|
@@ -218,14 +223,14 @@ if selected_site == "klikindomaret.com":
|
|
218 |
scraping_done = True # Set scraping_done menjadi True
|
219 |
|
220 |
if selected_site == "shopee.co.id":
|
221 |
-
|
222 |
-
if st.button("Mulai Scraping"):
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
|
230 |
if selected_site == "tokopedia.com":
|
231 |
#st.error("Sedang dalam pengembangan. Silahkan pilih situs yang lain")
|
|
|
151 |
|
152 |
for product_info in product_container_list:
|
153 |
link = product_info['href']
|
154 |
+
title_element = product_info.find('div', class_="prd_link-product-name css-3um8ox")
|
155 |
+
title = title_element.text.strip() if title_element else None
|
156 |
+
|
157 |
+
harga_element = product_info.find('div', class_="prd_link-product-price css-h66vau")
|
158 |
+
harga = harga_element.text.strip() if harga_element else None
|
159 |
+
|
160 |
+
terjual_element = product_info.find('span', class_="prd_label-integrity css-1sgek4h")
|
161 |
+
terjual = terjual_element.text if terjual_element else None
|
162 |
+
|
163 |
rating_element = product_info.find('span', class_='prd_rating-average-text css-t70v7i')
|
164 |
rating = rating_element.text if rating_element else None
|
165 |
+
|
166 |
+
toko_element = product_info.find('span', class_="prd_link-shop-name css-1kdc32b flip")
|
167 |
+
toko = toko_element.text.strip() if toko_element else None
|
168 |
+
|
169 |
+
asal_product_element = product_info.find('span', class_="prd_link-shop-loc css-1kdc32b flip")
|
170 |
+
asal_product = asal_product_element.text.strip() if asal_product_element else None
|
171 |
|
172 |
products.append({
|
173 |
'link': link,
|
|
|
223 |
scraping_done = True # Set scraping_done menjadi True
|
224 |
|
225 |
if selected_site == "shopee.co.id":
|
226 |
+
st.error("Sedang dalam pengembangan. Silahkan pilih situs yang lain")
|
227 |
+
#if st.button("Mulai Scraping"):
|
228 |
+
# if not nama_barang:
|
229 |
+
# st.error("Mohon isi Nama Barang.")
|
230 |
+
# else:
|
231 |
+
# scraped_products = scrape_shopee(nama_barang, num_items)
|
232 |
+
# hidden_data = scraped_products # Simpan data ke dalam variabel tersembunyi
|
233 |
+
# scraping_done = True # Set scraping_done menjadi True
|
234 |
|
235 |
if selected_site == "tokopedia.com":
|
236 |
#st.error("Sedang dalam pengembangan. Silahkan pilih situs yang lain")
|