Skip to content

Instantly share code, notes, and snippets.

@lucasefe
Created August 23, 2013 13:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucasefe/6319125 to your computer and use it in GitHub Desktop.
Save lucasefe/6319125 to your computer and use it in GitHub Desktop.
# encoding: utf-8
require 'mechanize'
require 'csv'
START_URL = 'http://www.confreaks.com/events'
STDOUT.sync = true
agent = Mechanize.new
page = agent.get START_URL
page.links.each do |link|
if link.text =~ /Ruby|eurUko/i
begin
conf_name = link.text
conf_page = link.click
conf_page.search(".video").each do |video|
presenters = video.search(".presenters a").map {|a| a.text }
video_link = "http://www.confreaks.com/#{video.search(".title a").attribute("href").text}"
video_name = video.search(".title a").text
video_date = video.search(".post-date strong").text
presenters.each do |p|
puts [
p,
conf_name,
video_name,
video_link,
video_date
].map {|e| e.to_s.strip }.to_csv
end
end
rescue Exception => e
e.message
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment