Sha256: 88e259208a3abfa3b621c671d43bf86776e641b97a79c37bb28eadc7927016cc
Contents?: true
Size: 738 Bytes
Versions: 1
Compression:
Stored size: 738 Bytes
Contents
require 'eolclub_scraper/event' require 'nokogiri' require 'chronic' module EolclubScraper class EventParser # This method is extremely fragile, but so far EOLclub.org has been sticking to # the same format, so that may be okay. def parse(content) doc = Nokogiri::HTML.parse(content) description = doc.css('p').first(3).to_s schedule_text = doc.css('p')[1].text.split("\n")[2].split(',').last.strip.split start_time, end_time = schedule_text.last.split(/\W/) Event.new( Chronic.parse( [ schedule_text[0], schedule_text[1], start_time ].join(' ') ), Chronic.parse( [ schedule_text[0], schedule_text[1], end_time ].join(' ') ), description ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
eolclub_scraper-0.0.3 | lib/eolclub_scraper/event_parser.rb |