Ruby script for downloading rails casts

Ryan Bates continuously provide useful Rails tips in this

I had written a bash script for downloading the videos of the episodes in the past. I do not like streaming much and I'd rather keep the episodes for reference.

One downside of the script is that I had to check the rss feed or the website for new episodes, and run the script manually passing the correct paramters (start and end of episode ids to be downloaded)

Now I decided to get rid of the silly step. so I ported my script to ruby, and it runs down to download whatever episodes are missing using the rss feed and checking what is already present.

The script uses simple-rss gem, so you'll have to get that installed. It also uses wget for downloading. I didn't bother using net/http of ruby, wget is fine for me as a linux user.

The script flow is simple:
  1. Check the current files in the download directory (collecting information)
  2. Grab the rss of
  3. Iterate over rss items and download the ones that are not already present in the download directory
The original script can be found and downloaded from

Windows users will have to override the wget part for downloading. perhaps using net/http or mechanize and making the script more portable,  I'll work on a new version built over mechanize. any contributions are welcomed too :)

Thanks to Hossam Hammady, an updated platform independent version that utilizes Mechnize (Instead of relying on system call to wget)  can be found at

You can also you pro feed if you have a pro subscription to get all episodes.

One advantage of having it as a script is that now it can be added as a cron job that runs periodically keeping our downloads directory updated.


Anonymous said…
sweet thx.
Unknown said…
Good, but it is better to get the download link directly from the feed entry (enclosure tag) to work on Pro episodes as well, as long as the user supplies the Pro feed URL.
mahmoud said…
I'm not sure about pro feeds structure... but i should move the whole thing to github :D
Unknown said…
I used this:
Replacing the feed with the Pro feed, does them all.
Unknown said…
btw you can use mechanize to download files in 1 line.


After setting the default pluggable parser:

agent.pluggable_parser.default = Mechanize::Download

mahmoud said…
true,, and i guess this would make it even portable to windows instead of relying on wget :)...

mahmoud said…
i've posted the current version there to each cloning and upgrading, will make sure to post any updates there...

I checked the other script too, works so well
Unknown said…
I would suggest that you refer to this gist in the post itself, because this blog post appears in the first Google results page when googling "railscasts download".
Good job.
mahmoud said…
Changes applied, Thank you for the tip :)
Unknown said…
And here is the mechanize version, you may also include it in your post :)
mahmoud said…
Thank you

that's why i call open source, and community collaboration :)

the updated portable script has been added :)
Unknown said…
You are welcome :) There is something missing though, displaying download progress, I have found a couple of gems (mechanize-downloader and mechanize-progressbar) but they are kinda outdated and need a patch, its your ride now ;)

Popular posts from this blog

Success of Startups

Prime Numbers Generator

Android Marshmallow highlights