Posted by Pete McBreen 14 Feb 2007 at 08:42
Ruby script for backing up blogs is here. Feedback from testers is appreciated.
Your blog is saved into a YAML file and can either be uploaded back to the original blog or a different one.
Backup or Restore the content of a blog to/from YAML whose host server supports the MetaWebLog API. (Currently supports typo|wordpress|blogger)
Script was originally created by Derek Mahar for migrating posts between blogs and then changed extensively to serve as a backup/restore utility by Pete McBreen
Sample command lines (program prompts for blog password)
ruby backup\_blog.rb username improvingwetware.com backup.yaml 25 typo backup ruby backup\_blog.rb username improvingwetware.com backup.yaml num\_posts typo restore
(the num_posts argument is unused on restore)
Note: typo has bug whereby it ignores createdDate when creating URL, but does show correctly posted x days ago. Clicking on the link on the home page fails but it generates feed OK — puzzling — not fixed yet.
Code uses the metaweblog API
source_posts = blog_client.call( "metaWeblog.getRecentPosts", blog_id, username, password, post_count)
and then saves the posts to a YAML file
f = File.new(backup_filename, "w") f.puts source_posts.to_yaml f.close