jonathanjordan21 commited on
Commit
8a84171
·
verified ·
1 Parent(s): 4402d45

Update extract.py

Browse files
Files changed (1) hide show
  1. extract.py +5 -5
extract.py CHANGED
@@ -142,11 +142,11 @@ 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
- if row.find_parent(id="det_pkb") or row.find_parent(id="det_swd"):
146
- continue # skip rows inside det_pkb or det_swd
147
- ps = row.find_all("p")
148
- # if len(ps) >= 3 and all(keyword in ps[i].text for i, keyword in enumerate(["Pokok", "Denda", "Total"])):
149
- if not ("Pokok" in row.text or "Denda" in row.text or "Total" in row.text):
150
  total_tagihan.append({
151
  "pokok": ps[0].get_text(strip=True),
152
  "denda": ps[1].get_text(strip=True),
 
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 # skip rows inside det_pkb or det_swd
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) >= 3 and all(keyword in ps[i].text for i, keyword in enumerate(["Pokok", "Denda", "Total"])):
150
  total_tagihan.append({
151
  "pokok": ps[0].get_text(strip=True),
152
  "denda": ps[1].get_text(strip=True),