Skip to content

Instantly share code, notes, and snippets.

@confiks
Last active September 29, 2016 09:09
Show Gist options
  • Save confiks/9ccf878dbb73ab98e52586ecb64aeb80 to your computer and use it in GitHub Desktop.
Save confiks/9ccf878dbb73ab98e52586ecb64aeb80 to your computer and use it in GitHub Desktop.
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