Skip to content

Instantly share code, notes, and snippets.

@delucas
Created October 2, 2013 10:55
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 delucas/6791998 to your computer and use it in GitHub Desktop.
Save delucas/6791998 to your computer and use it in GitHub Desktop.
Youtube playlist video scrapper, based on @lucasefe gist: https://gist.github.com/lucasefe/6319125
# encoding: utf-8
require 'mechanize'
require 'csv'
START_URL = 'http://www.youtube.com/playlist?list=PLkuS0waF8krjwcRHzSJMq_nA67mCFi24T'
STDOUT.sync = true
agent = Mechanize.new
page = agent.get START_URL
page.links.each do |link|
if link.text =~ /.*PyConAr.*/i
begin
conf_name = link.text
conf_link = link.click.uri
puts [conf_name, conf_link].map {|e| e.to_s.strip}.to_csv
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