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 b6749db commit 1f6b688
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions scraper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,25 @@
# All that matters is that your final data is written to an SQLite database
# called "data.sqlite" in the current working directory which has at least a table
# called "data".
require 'nokogiri'
require 'open-uri'

def scrape_calendar_data(year, month)
url = "https://www.sitzungsdienst-schenefeld.de/bi/si010_r.asp?MM=#{month}&YY=#{year}"
document = Nokogiri::HTML(URI.open(url))

# Assuming each meeting details are within <tr> tags
document.css('tr').each do |row|
date = row.at_css('td:nth-child(1)').text.strip rescue nil
time = row.at_css('td:nth-child(2)').text.strip rescue nil
meeting = row.at_css('td:nth-child(3)').text.strip rescue nil
location = row.at_css('td:nth-child(4)').text.strip rescue nil

if date && time && meeting && location
puts "Date: #{date}, Time: #{time}, Meeting: #{meeting}, Location: #{location}"
end
end
end

# Example: Scrape data for April 2024
scrape_calendar_data(2024, 4)

0 comments on commit 1f6b688

Please sign in to comment.