Update extract.py
Browse files- extract.py +8 -8
extract.py
CHANGED
@@ -142,16 +142,16 @@ def get_vehicle_info_bs4(nopol: str):
|
|
142 |
all_rows = soup.find_all("div", class_="row")
|
143 |
total_tagihan = []
|
144 |
for row in all_rows:
|
145 |
-
|
146 |
-
|
147 |
if not ("POKOK" in row.text or "DENDA" in row.text or "TOTAL" in row.text):
|
148 |
ps = row.find_all("p")
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
|
156 |
# === 3. Rincian PKB ===
|
157 |
rincians_pkb = []
|
|
|
142 |
all_rows = soup.find_all("div", class_="row")
|
143 |
total_tagihan = []
|
144 |
for row in all_rows:
|
145 |
+
if row.find_parent(id="det_pkb") or row.find_parent(id="det_swd"):
|
146 |
+
continue
|
147 |
if not ("POKOK" in row.text or "DENDA" in row.text or "TOTAL" in row.text):
|
148 |
ps = row.find_all("p")
|
149 |
+
if len(ps) >= 4:
|
150 |
+
total_tagihan.append({
|
151 |
+
"pokok": ps[0].get_text(strip=True),
|
152 |
+
"denda": ps[1].get_text(strip=True),
|
153 |
+
"total": ps[2].get_text(strip=True)
|
154 |
+
})
|
155 |
|
156 |
# === 3. Rincian PKB ===
|
157 |
rincians_pkb = []
|