naufalnashif commited on
Commit
ca3127b
·
1 Parent(s): 20e8967

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -25
app.py CHANGED
@@ -65,20 +65,6 @@ def scrape_klikindomaret(nama_barang, num_items):
65
 
66
  return products
67
 
68
- @st.cache_data
69
- def scrape_shopee(nama_barang, num_items):
70
- products = []
71
- page = 1
72
- query = quote(nama_barang)
73
-
74
- url = f'https://shopee.co.id/search?keyword={query}&page={page}'
75
- session = HTMLSession()
76
- response = session.get(url)
77
- response.html.render()
78
- html = response.html.html
79
- st.write(html)
80
- return products
81
-
82
  @st.cache_data
83
  def scrape_tokped(nama_barang, num_items):
84
  products = []
@@ -254,7 +240,7 @@ st.title("Scraping E-Commerce")
254
 
255
  with st.expander("Settings :"):
256
  # Pilihan untuk memilih situs web
257
- selected_site = st.selectbox("Pilih Situs Web :", ["klikindomaret.com", "shopee.co.id", "tokopedia.com", "tokopedia.com(selenium)"])
258
 
259
  nama_barang = st.text_input("Masukkan Nama Barang :")
260
  num_items = st.number_input("Masukkan Estimasi Banyak Data :", min_value = 1, step = 1, placeholder="Type a number...")
@@ -276,16 +262,6 @@ if selected_site == "klikindomaret.com":
276
  hidden_data = scraped_products # Simpan data ke dalam variabel tersembunyi
277
  scraping_done = True # Set scraping_done menjadi True
278
 
279
- if selected_site == "shopee.co.id":
280
- st.error("Jika error, karena sedang dalam pengembangan. Silahkan pilih situs yang lain")
281
- if st.button("Mulai Scraping"):
282
- if not nama_barang:
283
- st.error("Mohon isi Nama Barang.")
284
- else:
285
- scraped_products = scrape_shopee(nama_barang, num_items)
286
- hidden_data = scraped_products # Simpan data ke dalam variabel tersembunyi
287
- scraping_done = True # Set scraping_done menjadi True
288
-
289
  if selected_site in ["tokopedia.com", "tokopedia.com(selenium)"]:
290
  st.error("Jika mengalami error karena sedang dalam pengembangan. Silahkan pilih situs yang lain")
291
  if st.button("Mulai Scraping"):
 
65
 
66
  return products
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  @st.cache_data
69
  def scrape_tokped(nama_barang, num_items):
70
  products = []
 
240
 
241
  with st.expander("Settings :"):
242
  # Pilihan untuk memilih situs web
243
+ selected_site = st.selectbox("Pilih Situs Web :", ["klikindomaret.com", "tokopedia.com", "tokopedia.com(selenium)"])
244
 
245
  nama_barang = st.text_input("Masukkan Nama Barang :")
246
  num_items = st.number_input("Masukkan Estimasi Banyak Data :", min_value = 1, step = 1, placeholder="Type a number...")
 
262
  hidden_data = scraped_products # Simpan data ke dalam variabel tersembunyi
263
  scraping_done = True # Set scraping_done menjadi True
264
 
 
 
 
 
 
 
 
 
 
 
265
  if selected_site in ["tokopedia.com", "tokopedia.com(selenium)"]:
266
  st.error("Jika mengalami error karena sedang dalam pengembangan. Silahkan pilih situs yang lain")
267
  if st.button("Mulai Scraping"):