I'm trying to recover all my email from a web mail hosting site that doesn't support pop3 without a fee. I've tried a few of the obvious ideas and nothing worked. I finally found that the url listed in the 'view' mode has a direct url to the message. I don't have wget on my windows box and didn't want to download a version so I thought, "How hard could a subset of wget be to write in Ruby to download all my email?" Answer: Not hard.
This will get a particular page and print to the screen:
require 'open-uri'
open('http://www.fincher.org/Misc/Pennies'){ |f| print f.read }
This will read a file of urls and print all to the screen:
#Reads first argument as file containing urls and prints them
#usage: ruby wget.rb wget.txt
require 'open-uri'
IO.foreach(ARGV[0]) { |line| open(line){ |f| print f.read } }
No comments:
Post a Comment