Created
November 16, 2021 14:15
-
-
Save dmfutcher/1392b66181814511d8d75744288a2983 to your computer and use it in GitHub Desktop.
Watch for new F1 race documents via FIA doc portal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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