Skip to content

Instantly share code, notes, and snippets.

@rokumatsumoto
Created December 28, 2018 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rokumatsumoto/e7cd7d8f3948995af6b4106fccbb7ab8 to your computer and use it in GitHub Desktop.
Save rokumatsumoto/e7cd7d8f3948995af6b4106fccbb7ab8 to your computer and use it in GitHub Desktop.
hac kura sayfasindaki degisiklikleri takip eder, sesli bildirir. sadece mac os sistemlerde calisir.
require 'nokogiri'
require 'open-uri'
doc = Nokogiri::HTML(open('http://hac.gov.tr/', open_timeout: 100))
File.open("hac.html", "wb") do |f|
f.write(doc.to_html)
end
doc1 = File.open("hac.html") { |f| Nokogiri::HTML(f) }
loop do
puts 'checking ten seconds inverval'
sleep 10
doc2 = Nokogiri::HTML(open('http://hac.gov.tr/', open_timeout: 100))
unless doc1.to_html === doc2.to_html
# $ youtube-dl -i --extract-audio --audio-format mp3 -o "%(title)s-%(id)s.%(ext)s" https://www.youtube.com/watch\?v\=IB0o6uTGu9c
fork { exec 'afplay', "Abdurrahman-Onul-Kabenin-Yollari.mp3" }
# $ killall afplay
break
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment