Skip to content

Instantly share code, notes, and snippets.

@dmfutcher
Created November 16, 2021 14:15
Show Gist options
  • Save dmfutcher/1392b66181814511d8d75744288a2983 to your computer and use it in GitHub Desktop.
Save dmfutcher/1392b66181814511d8d75744288a2983 to your computer and use it in GitHub Desktop.
Watch for new F1 race documents via FIA doc portal
# Watch the FIA documents portal for new event notes
# (Very quick and dirty but does the job, only tested on macOS)
require 'uri'
require 'net/http'
require 'nokogiri'
previous = nil
while true do
uri = URI('https://www.fia.com/documents/season/season-2021-1108/championships/fia-formula-one-world-championship-14')
res = Net::HTTP.get_response(uri)
if res.is_a?(Net::HTTPSuccess)
page = Nokogiri::HTML(res.body)
document_row = page.css("li.document-row").first
title = document_row.at_css(".title").text.strip
if previous == nil or previous != title
puts "\aNew document: " + title
system("say New document: " + title)
previous = title
end
end
sleep(15)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment