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 494eece commit 3c3fda8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions scraper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,14 @@

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

document.css('tbody tr').each do |row|
# Extrahieren der Tagesordnungspunkt-Informationen
top_link = row.css('td.tonr a').first
top_id = top_link['href'][/TOLFDNR=(\d+)/, 1]
top_description = row.css('td.tobetreff div a').text.strip
top_description = row.css('td.tobetreff a').text.strip # Aktualisierter Selektor für den Betreff

# Volle URL für Tagesordnungspunkt-Details
top_url = "https://www.sitzungsdienst-schenefeld.de/bi/to020_r.asp?TOLFDNR=#{top_id}"

# Extrahieren der Beschlussvorlage-Link und ID
vo_link = row.css('td.tovonr a').first
vo_id = vo_link ? vo_link['href'][/VOLFDNR=(\d+)/, 1] : nil
vo_url = vo_link ? "https://www.sitzungsdienst-schenefeld.de/bi/vo020_r.asp?VOLFDNR=#{vo_id}" : "-"
Expand All @@ -57,7 +54,7 @@ def scrape_calendar_data(year, month)
full_url = link ? "https://www.sitzungsdienst-schenefeld.de/bi/#{link}" : nil

if date_raw && full_url
date_parts = date_raw.match(/([A-Za-z]+)(\d+)/)
date_parts = date_raw.match(/([A-Za-z]+)\s+(\d+)/)
if date_parts
formatted_date = "#{date_parts[1]}, #{date_parts[2].rjust(2, '0')}.#{month.to_s.rjust(2, '0')}.#{year}"
puts "Datum: #{formatted_date}, URL: #{full_url}"
Expand All @@ -71,3 +68,4 @@ def scrape_calendar_data(year, month)

# Beispiel: Daten für April 2024 scrapen
scrape_calendar_data(2024, 4)

0 comments on commit 3c3fda8

Please sign in to comment.