Skip to content

Commit

Permalink
Update scraper.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
BfB-Schenefeld committed Apr 21, 2024
1 parent 8d7cc8b commit 9ccc443
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scraper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

def scrape_details(url)
document = Nokogiri::HTML(open(url))

document.css('tbody tr').each do |row|
# Tagesordnungspunkt und dessen Beschreibung
top_link = row.css('td.tonr a').first
Expand Down Expand Up @@ -56,8 +56,15 @@ def scrape_calendar_data(year, month)
link = row.at_css('td:nth-child(3) a')['href'] rescue nil
full_url = link ? "https://www.sitzungsdienst-schenefeld.de/bi/#{link}" : nil

# Korrekte Formatierung des Datums
if date_raw
day_part = date_raw[/[A-Za-z]+/].strip
date_part = date_raw[/\d+/]
formatted_date = "#{day_part} #{date_part.rjust(2, '0')}"
end

if date_raw && full_url
puts "Datum: #{date_raw}, URL: #{full_url}"
puts "Datum: #{formatted_date}, URL: #{full_url}"
scrape_details(full_url)
end
end
Expand All @@ -66,3 +73,4 @@ def scrape_calendar_data(year, month)
# Beispiel: Daten für April 2024 scrapen
scrape_calendar_data(2024, 4)


0 comments on commit 9ccc443

Please sign in to comment.