fix: Make sure pages are from FOSDEM website

This commit is contained in:
Glenn Y. Rolland 2022-08-21 15:50:54 +02:00
parent 1ffd522e66
commit f0a1d7f136

View file

@ -37,6 +37,11 @@ module FosdemRecorder
def _validate_url(url)
return if url =~ %r{^https://fosdem.org/\d+/schedule/event/.*}
if url =~ %r{^https://fosdem.org/.*}
warn 'ERROR: not a schedule page. URL must contain .../schedule/event/...'
exit 1
end
warn 'ERROR: not a fosdem stream. URL must start with https://fosdem.org/...'
exit 1
end
@ -46,6 +51,14 @@ module FosdemRecorder
mechanize = Mechanize.new
page = mechanize.get(url)
# body_class = page.at('body').attr('class')
# if body_class != 'schedule-event'
# STDERR.puts "ERROR: Not an event schedule page!"
# exit 1
# end
puts body_class
title = page.title
title_sane =
title