gnumatt.org

If you ever wanted to

Posted by Matt M. on February 24, 2002 at 12:02 AM

If you ever wanted to update all your posts in Blogger to make some sweeping change, like oh say converting to XHTML which means you need to convert <br> tags to <br/>. You might try the following:

  1. Change your template to:
      <blog>
        <Blogger>
          <entry id="<$BlogItemNumber$>">
            <$BlogItemBody$>
          </entry>
        </Blogger>
      </blog>
      
  2. Change your Settings so it publishes the last 999 days of entries. Also change your Blog filename to something like totalarchive
  3. When you publish you now have a file called totalarchive with every post (hopefully) and all the entry ids
  4. Now create a perl script which reads through each entry, grabs the id and makes the text changes. In this case a simple <[Bb][Rr]> to <br/> conversion.
  5. Next use a module like Aaron's excellent Blogger.pm to call editPost to update each entry.
  6. Undo your Settings changes and republish

Boy can I gloss over details. At any rate, when I'm not so tired I'll put together a perl script which does just this. This was inspired by Jako's post and the fact that at one point I converted by hand all Dave's entries to XML.

Tags: (none)
Hierarchy: previous, next