|
|
@@ -16,7 +16,7 @@ DB.ensure_table!(TABLE)
|
|
|
def abs_url(base, href)
|
|
|
h = href.to_s.strip
|
|
|
return nil if h.empty?
|
|
|
- return h if h.start_with?(“http://”, “https://”)
|
|
|
+ return h if h.start_with?("http://", "https://")
|
|
|
URI.join(base, h).to_s
|
|
|
rescue URI::InvalidURIError
|
|
|
h
|
|
|
@@ -28,33 +28,33 @@ REF_RX = /\bK-DA\d+\/20\d{2}\b/i
|
|
|
def parse_items(doc, base_url)
|
|
|
rows = []
|
|
|
|
|
|
- # Each DA is a <li class=”generic-list__item”> with a PDF link in the title
|
|
|
- # Link text: “K-DA016/2026 41 George Road, Nook - proposed 2 Lot Subdivision (submissions by 21/04/2026)”
|
|
|
- doc.css(“li.generic-list__item”).each do |li|
|
|
|
- link = li.at_css(“h3.generic-list__title a, a[href$='.pdf']”)
|
|
|
+ # Each DA is a <li class="generic-list__item"> with a PDF link in the title
|
|
|
+ # Link text: "K-DA016/2026 41 George Road, Nook - proposed 2 Lot Subdivision (submissions by 21/04/2026)"
|
|
|
+ doc.css("li.generic-list__item").each do |li|
|
|
|
+ link = li.at_css("h3.generic-list__title a, a[href$='.pdf']")
|
|
|
next unless link
|
|
|
|
|
|
- raw_text = link.text.gsub(/\(PDF File[^)]*\)/i, “”).gsub(/\s+/, “ “).strip
|
|
|
- pdf_href = link[“href”].to_s
|
|
|
+ raw_text = link.text.gsub(/\(PDF File[^)]*\)/i, "").gsub(/\s+/, " ").strip
|
|
|
+ pdf_href = link["href"].to_s
|
|
|
|
|
|
ref_match = raw_text.match(REF_RX)
|
|
|
next unless ref_match
|
|
|
|
|
|
ref = ref_match[0]
|
|
|
- rest = raw_text.sub(ref, “”).strip
|
|
|
+ rest = raw_text.sub(ref, "").strip
|
|
|
|
|
|
- # Extract on-notice date: “(submissions by 21/04/2026)”
|
|
|
- on_raw = rest[/\(submissions\s+by\s+([^)]+)\)/i, 1]&.strip || “”
|
|
|
+ # Extract on-notice date: "(submissions by 21/04/2026)"
|
|
|
+ on_raw = rest[/\(submissions\s+by\s+([^)]+)\)/i, 1]&.strip || ""
|
|
|
on_dt = Util.parse_aus_date(on_raw)
|
|
|
|
|
|
- # Strip the on-notice clause and split “address - description”
|
|
|
- body = rest.sub(/\s*\(submissions\s+by\s+[^)]+\)/i, “”).strip
|
|
|
+ # Strip the on-notice clause and split "address - description"
|
|
|
+ body = rest.sub(/\s*\(submissions\s+by\s+[^)]+\)/i, "").strip
|
|
|
if (m = body.match(/\A(.+?)\s+-\s+(.+)\z/))
|
|
|
address = m[1].strip
|
|
|
description = m[2].strip
|
|
|
else
|
|
|
address = body
|
|
|
- description = “Development Application”
|
|
|
+ description = "Development Application"
|
|
|
end
|
|
|
|
|
|
next if address.empty?
|