Created
December 29, 2012 18:18
-
-
Save tsujigiri/4408492 to your computer and use it in GitHub Desktop.
lists all so far released #29C3 recordings by modification date
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
#!/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