Update extract.py
Browse files- extract.py +9 -5
extract.py
CHANGED
@@ -68,14 +68,16 @@ def scrape_vehicle(driver):
|
|
68 |
try:
|
69 |
all_rows = driver.find_elements(By.CSS_SELECTOR, "div.row")
|
70 |
for row in all_rows:
|
71 |
-
|
|
|
72 |
cols = row.find_elements(By.TAG_NAME, "p")
|
73 |
-
print("[COLS TOTAL]", cols)
|
74 |
-
if len(cols) >=
|
75 |
total_tagihan.append({
|
76 |
"pokok": cols[0].text.strip(),
|
77 |
"denda": cols[1].text.strip(),
|
78 |
"total": cols[2].text.strip(),
|
|
|
79 |
})
|
80 |
except Exception as e:
|
81 |
print("Gagal parsing total tagihan:", e)
|
@@ -85,8 +87,9 @@ def scrape_vehicle(driver):
|
|
85 |
try:
|
86 |
pkb_rows = driver.find_elements(By.CSS_SELECTOR, "#det_pkb .row")[1:] # skip header
|
87 |
for row in pkb_rows:
|
|
|
88 |
cols = row.find_elements(By.TAG_NAME, "p")
|
89 |
-
print("[COLS PKB]", cols)
|
90 |
if len(cols) >= 3:
|
91 |
rincians_pkb.append({
|
92 |
"pokok": cols[0].text.strip(),
|
@@ -101,8 +104,9 @@ def scrape_vehicle(driver):
|
|
101 |
try:
|
102 |
swd_rows = driver.find_elements(By.CSS_SELECTOR, "#det_swd .row")[1:] # skip header
|
103 |
for row in swd_rows:
|
|
|
104 |
cols = row.find_elements(By.TAG_NAME, "p")
|
105 |
-
print("[COLS SWD]", cols)
|
106 |
if len(cols) >= 3:
|
107 |
rincians_swd.append({
|
108 |
"pokok": cols[0].text.strip(),
|
|
|
68 |
try:
|
69 |
all_rows = driver.find_elements(By.CSS_SELECTOR, "div.row")
|
70 |
for row in all_rows:
|
71 |
+
print("[ROW TOTAL]", row.text)
|
72 |
+
if not ("Pokok" in row.text or "Denda" in row.text or "Total" in row.text):
|
73 |
cols = row.find_elements(By.TAG_NAME, "p")
|
74 |
+
print("[COLS TOTAL]", [x.text for x in cols])
|
75 |
+
if len(cols) >= 4:
|
76 |
total_tagihan.append({
|
77 |
"pokok": cols[0].text.strip(),
|
78 |
"denda": cols[1].text.strip(),
|
79 |
"total": cols[2].text.strip(),
|
80 |
+
"jenis": cols[3].text.strip()
|
81 |
})
|
82 |
except Exception as e:
|
83 |
print("Gagal parsing total tagihan:", e)
|
|
|
87 |
try:
|
88 |
pkb_rows = driver.find_elements(By.CSS_SELECTOR, "#det_pkb .row")[1:] # skip header
|
89 |
for row in pkb_rows:
|
90 |
+
print("[ROW PKB]", row.text)
|
91 |
cols = row.find_elements(By.TAG_NAME, "p")
|
92 |
+
print("[COLS PKB]", [x.text for x in cols])
|
93 |
if len(cols) >= 3:
|
94 |
rincians_pkb.append({
|
95 |
"pokok": cols[0].text.strip(),
|
|
|
104 |
try:
|
105 |
swd_rows = driver.find_elements(By.CSS_SELECTOR, "#det_swd .row")[1:] # skip header
|
106 |
for row in swd_rows:
|
107 |
+
print("[ROW SWD]", row.text)
|
108 |
cols = row.find_elements(By.TAG_NAME, "p")
|
109 |
+
print("[COLS SWD]", [x.text for x in cols])
|
110 |
if len(cols) >= 3:
|
111 |
rincians_swd.append({
|
112 |
"pokok": cols[0].text.strip(),
|