Last active
September 29, 2016 09:09
-
-
Save confiks/9ccf878dbb73ab98e52586ecb64aeb80 to your computer and use it in GitHub Desktop.
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
require 'faraday' | |
# require 'byebug' | |
class DownloadTweedeKamer | |
def initialize | |
@scheme = "http://" | |
@domain = "tweedekamerlive.download.kpnstreaming.nl" | |
@path = "/plenairezaal/4500" | |
@conn = Faraday.new( | |
url: "#{@scheme}#{@domain}" | |
) | |
end | |
def run | |
while true | |
playlist = @conn.get("#{@path}/prog_index.m3u8").body | |
playlist.scan( | |
/^segm\d{15}-\d{6}\.ts$/ | |
).reject do |filename| | |
File.exists?(filename) | |
end.each do |filename| | |
`wget #{@scheme}#{@domain}#{@path}/#{filename}` | |
end | |
sleep 20 | |
end | |
end | |
end | |
DownloadTweedeKamer.new.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment