Skip to content

Instantly share code, notes, and snippets.

@tsujigiri
Created December 29, 2012 18:18
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 tsujigiri/4408492 to your computer and use it in GitHub Desktop.
Save tsujigiri/4408492 to your computer and use it in GitHub Desktop.
lists all so far released #29C3 recordings by modification date
#!/usr/bin/env ruby
# encoding: utf-8
require 'date'
require 'curb'
require 'nokogiri'
begin
curl = Curl::Easy.perform('http://mirror.fem-net.de/CCC/29C3/mp4-h264-HQ/')
html = Nokogiri::HTML.parse(curl.body_str)
rows = html.css('tr')
header = rows.shift
date_column = header.css('th, td').to_a.
index {|td| td.inner_text.match(/modified/i) }
rows = rows.to_a.sort_by do |r|
r.css("td:nth-child(#{date_column+1})").inner_text
end
puts rows.map {|r| r.css('a').inner_text.sub(/\.(sha1|torrent)$/, '') }.uniq.
select {|r| r.match(/mp4/) }
rescue
print '☠ '
retry
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment