From f0a1d7f136a09fefb26e208de35ea02c8750a9e8 Mon Sep 17 00:00:00 2001 From: Glenn Date: Sun, 21 Aug 2022 15:50:54 +0200 Subject: [PATCH] fix: Make sure pages are from FOSDEM website --- lib/fosdem_recorder/cli.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/fosdem_recorder/cli.rb b/lib/fosdem_recorder/cli.rb index dbac748..2dc1913 100755 --- a/lib/fosdem_recorder/cli.rb +++ b/lib/fosdem_recorder/cli.rb @@ -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