Last active
December 27, 2015 03:40
-
-
Save dulltz/c9ffc69e69b9e2956674 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'open-uri' | |
| base_urls = %w(http://mgkkk.cocolog-nifty.com/blog/files/ | |
| http://mgkkk.la.coocan.jp/podcast/ | |
| ) | |
| start_i = ARGV[0].nil? ? 0 : ARGV[0].to_i | |
| end_i = ARGV[1].nil? ? 211 : ARGV[1].to_i | |
| base_i=0 | |
| for i in start_i..end_i | |
| begin | |
| puts "start dl:\t#{base_urls[base_i]}episode#{i}.mp4" | |
| open(base_urls[base_i] + "episode#{i}.m4a") do |dlfile| | |
| File.open("episode#{i}.m4a", "wb") do |output| | |
| output.puts dlfile.read | |
| end | |
| end | |
| puts "done dl:\t#{base_urls[base_i]}episode#{i}.mp4" | |
| rescue OpenURI::HTTPError => e | |
| base_i += 1 | |
| break if base_urls[base_i].nil? | |
| retry | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment