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 ae1a41e commit 4b6fd4d
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions scraper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
require 'nokogiri'
require 'date'
require 'scraperwiki'
require 'json'

def valid_url?(url)
url =~ /\A#{URI::regexp(['http', 'https'])}\z/
Expand Down Expand Up @@ -207,20 +208,18 @@ def scrape_calendar_data(year, month)
event_data = scrape_event_details(url)

event = {
date: formatted_date,
time: time,
title: title,
url: url,
room: room,
event_data: event_data
'date' => formatted_date,
'time' => time,
'title' => title,
'url' => url,
'room' => room,
'event_data' => event_data.to_json
}
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)
ScraperWiki.save_sqlite(['date', 'title'], event)
end
end

calendar_data
Expand Down

0 comments on commit 4b6fd4d

Please sign in to comment.