Skip to content

Instantly share code, notes, and snippets.

@samqiu
Last active December 9, 2022 03:49
Show Gist options
  • Star 70 You must be signed in to star a gist
  • Fork 48 You must be signed in to fork a gist
  • Save samqiu/1472142 to your computer and use it in GitHub Desktop.
Save samqiu/1472142 to your computer and use it in GitHub Desktop.
Download free Railscast video
#!/usr/bin/ruby
require 'rss'
# Usage
# $ ./railscasts.rb http://railscasts.com/subscriptions/YOURRAILSCASTRSS/\/
# episodes.rss
# OR
# $ ./railscasts.rb
p 'Downloading rss index'
rss_url = ARGV.first ? ARGV.first : 'http://feeds.feedburner.com/railscasts'
rss_string = open(rss_url).read
rss = RSS::Parser.parse(rss_string, false)
videos_urls = rss.items.map { |it| it.enclosure.url }.reverse
videos_filenames = videos_urls.map { |url| url.split('/').last }
existing_filenames = Dir.glob('*.mov')
missing_filenames = videos_filenames - existing_filenames
p "Downloading #{missing_filenames.size} missing videos"
missing_videos_urls = videos_urls.select { |video_url|
missing_filenames.any? { |filename| video_url.match filename }
}
missing_videos_urls.each do |video_url|
filename = video_url.split('/').last
next if File.exists? filename
p filename
p %x(wget #{video_url} -O #{filename}.tmp )
p %x(mv #{filename}.tmp #{filename} )
end
p 'Finished synchronization'
@zhangjingqiang
Copy link

It's so good!

Copy link

ghost commented Feb 11, 2012

nice .

@asachs
Copy link

asachs commented May 9, 2012

Thanks this helps :)

@vibhoo
Copy link

vibhoo commented Oct 18, 2012

Thanks man its really a great help to us. . . .!! keep the good work like this :)

@gberger
Copy link

gberger commented Mar 31, 2013

I modified this to make it work on Windows:

https://gist.github.com/gberger42/5281081

@gguerrero
Copy link

Great stuff! :P
Thanks a bunch!

@thoughtpunch
Copy link

Can you even download the pro episodes? Wonder what @ryanb thinks of this

@samqiu
Copy link
Author

samqiu commented Jun 7, 2013

@thoughtpunch No, is only download free episdoes.

But, now you can use your own PRO subscription RSS URL for downloading.

@HarshTrivedi
Copy link

Thanx a lot For this!!!

@sgsheg
Copy link

sgsheg commented Jun 28, 2014

Thanks a lot!

@Abdenasser
Copy link

thanks a lot @samqiu , for those who wants to download the PRO EPISODES you can find them all from this torrent https://kickass.so/railscasts-pro-episodes-16-417-t8650471.html .. enjoy 😃

@mirzalazuardi
Copy link

thanks a lot

@sandeep1988
Copy link

thank you very much it's will be very helpful for us..

@lalithr95
Copy link

Awesome :)

@osazemeu
Copy link

thanks alot

@theterminalguy
Copy link

thanks a zillion

@Confidence7
Copy link

this is good! Thanks a million

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment