Last Updated: September 09, 2019
·
1.557K
· felipefontoura

Download Railscasts.com episodes

Do you like download all railscasts.com episodes?

Source: https://gist.github.com/ffontouras/2627853

Gemfile

source "https://rubygems.org"
gem "nokogiri", "~> 1.5.2"

railscasts_downloader.rb

#!/usr/bin/env ruby

require 'rubygems'
require 'nokogiri'
require 'open-uri'

# Consider signing in Railscasts PRO! :D
RAILSCASTS_FEED_URL="railscasts.com pro feed url. it can be accessible by 'Manage Subscription' menu."

doc = Nokogiri::XML(open(RAILSCASTS_FEED_URL))

doc.xpath('//item').each do |item|
title = item.xpath('./title').text
episode = title.match(/#([0-9]+)/)[1]
description = item.xpath('./description').text
video = item.xpath('./enclosure').attr('url').text

p "Downloading episode ##{episode}..."
File.open("./episodes/#{episode}.txt", 'w') {|f| f.write("#{title}\n\n#{description}")}
`wget -c -q -P ./episodes #{video}`
end