require 'open-uri'
open('http://railscasts.com/episodes/archive') do |f|
s=""
f.each do |line|
s<<line
end
allUrls=File.new(File.join("C:", "RailCastsVideoURLs.txt"), "w+")
m=/href="(\/episodes\/.+)"/
urls= s.scan(m)
urls.each { |x|
begin
allUrls.puts x[0].gsub(/\/episodes\//, "http://media.railscasts.com/videos/").gsub(/-/,"_").to_s+".mov"
end
}
allUrls.close
end
请发表评论