Ruby script for downloading rails casts
Ryan Bates continuously provide useful Rails tips in this railscasts.com.
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:
- Check the current files in the download directory (collecting information)
- Grab the rss of railscasts.com
- 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 https://gist.github.com/modsaid/5330545.
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 https://gist.github.com/hammady/5330925
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.
Thanks to Hossam Hammady, an updated platform independent version that utilizes Mechnize (Instead of relying on system call to wget) can be found at https://gist.github.com/hammady/5330925
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.
Comments
https://gist.github.com/samqiu/1472142
Replacing the feed with the Pro feed, does them all.
agent.get(link).save(filename)
After setting the default pluggable parser:
agent.pluggable_parser.default = Mechanize::Download
thanks
https://gist.github.com/modsaid/5330545
I checked the other script too, works so well
Good job.
that's why i call open source, and community collaboration :)
the updated portable script has been added :)