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 29, 2024
1 parent 1e9bedd commit ae1a41e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scraper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
require 'open-uri'
require 'nokogiri'
require 'date'
require 'scraperwiki'

def valid_url?(url)
url =~ /\A#{URI::regexp(['http', 'https'])}\z/
Expand Down Expand Up @@ -205,17 +206,23 @@ def scrape_calendar_data(year, month)

event_data = scrape_event_details(url)

calendar_data << {
event = {
date: formatted_date,
time: time,
title: title,
url: url,
room: room,
event_data: event_data
}
calendar_data << event
puts "Datum: #{formatted_date}, Zeit: #{time}, Titel: #{title}, URL: #{url}, Raum: #{room}"
end
end

calendar_data.each do |event|
ScraperWiki.save_sqlite([:date, :title], event)
end

calendar_data
else
puts "Ungültige Kalender-URL: #{url}"
Expand Down

0 comments on commit ae1a41e

Please sign in to comment.