Commit
·
8192311
1
Parent(s):
4b95b99
Update app.py
Browse files
app.py
CHANGED
@@ -110,7 +110,12 @@ def scrape_shopee(nama_barang, num_items):
|
|
110 |
for i in soup.find_all('div', class_ = "ie3A+n bM+7UW Cve6sh" ):
|
111 |
products.append(i.text)
|
112 |
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
114 |
except WebDriverException as e:
|
115 |
st.error(f"An error occurred: {e}")
|
116 |
finally:
|
@@ -168,11 +173,15 @@ def scrape_tokped(nama_barang, num_items):
|
|
168 |
if len(products) >= num_items:
|
169 |
products = products[:num_items]
|
170 |
break
|
|
|
171 |
except requests.exceptions.RequestException as e:
|
172 |
-
|
173 |
break
|
174 |
except requests.exceptions.HTTPError as e:
|
175 |
-
|
|
|
|
|
|
|
176 |
break
|
177 |
page += 1
|
178 |
return products
|
|
|
110 |
for i in soup.find_all('div', class_ = "ie3A+n bM+7UW Cve6sh" ):
|
111 |
products.append(i.text)
|
112 |
|
113 |
+
except requests.exceptions.RequestException as e:
|
114 |
+
logging.error(f"Terjadi kesalahan saat mengirim permintaan: {e}")
|
115 |
+
except requests.exceptions.HTTPError as e:
|
116 |
+
logging.error(f"HTTP Error: {e}")
|
117 |
+
except Exception as e:
|
118 |
+
logging.error(f"Terjadi kesalahan yang tidak diketahui: {e}")
|
119 |
except WebDriverException as e:
|
120 |
st.error(f"An error occurred: {e}")
|
121 |
finally:
|
|
|
173 |
if len(products) >= num_items:
|
174 |
products = products[:num_items]
|
175 |
break
|
176 |
+
|
177 |
except requests.exceptions.RequestException as e:
|
178 |
+
logging.error(f"Terjadi kesalahan saat mengirim permintaan: {e}")
|
179 |
break
|
180 |
except requests.exceptions.HTTPError as e:
|
181 |
+
logging.error(f"HTTP Error: {e}")
|
182 |
+
break
|
183 |
+
except Exception as e:
|
184 |
+
logging.error(f"Terjadi kesalahan yang tidak diketahui: {e}")
|
185 |
break
|
186 |
page += 1
|
187 |
return products
|