I succeeded (more or less) in importing my ancient Blogger posts into Drupal.
I used
this guide as a base, but the database format has changed significantly with Drupal version 4.7. node and node_revisions have been broken out into two tables, making the SQL generated by the php template not work. As a result, I had to change it slightly, to the following:
<?php $nid = 213; <Blogger> $iid = '<$BlogItemNumber$>'; $nid++; $node=array(); $node['title']=<<<ENDOFSTRING <$BlogItemTitle$> ENDOFSTRING; if (trim($node['title']) == "") $node['title'] = "title"; $node['body']=<<<ENDOFSTRING <$BlogItemBody$> ENDOFSTRING; $node['date']=strtotime('<$BlogItemDateTime$>'); $node['number']='<$BlogItemNumber$>'; $node['permalink']='<$BlogItemPermalinkURL$>'; echo "INSERT INTO node_revisions (nid, vid, title, uid, timestamp, teaser, body, format) VALUES(".$nid.", ".$nid.", '".addslashes($node['title'])."', 1, ".$node['date'].", '".addslashes($node['body'])."', '".addslashes($node['body'])."', 3);\
\
"; echo "INSERT INTO node (nid, vid, type, title, uid, created, changed, comment, promote, moderate, sticky) VALUES(".$nid.", ".$nid.", 'story', '".addslashes($node['title'])."', 1, ".$node['date'].", ".$node['date'].", 2, 1, 0, 0);\
\
"; <BlogItemComments> $comment=array(); $comment['number']='<$BlogCommentNumber$>'; $comment['body']=<< <$BlogCommentBody$> ENDOFSTRING; $comment['author']=<<<ENDOFSTRING <$BlogCommentAuthor$> ENDOFSTRING; $comment['date']=strtotime('<$BlogCommentDateTime$>'); echo "insert into comments (nid, subject, comment, hostname, timestamp, thread, name) values(".$nid.", 'comment', '".addslashes($comment['body'])."', '127.0.0.1', '".$comment['date']."', '1/', '".addslashes($comment['author'])."');\
\
"; </BlogItemComments> </Blogger> ?> The changes should be self-explanatory. I also needed to do some escaping of $-values (whether symbolic dollar amounts, or inline perl/php), and I made a slight mistake on time settings, so I had to do a quick series of
update node_revisions set timestamp = timestamp + 39600 where nid > 213; update node set created = created + 39600 where nid > 213; update node set changed = created where nid > 213; (yes, I know the last two could be combined) to account for an 11-hour time difference in posts. This wasn't a big deal, and after two to five years, who'd notice?
Because of the table drift in versions, I didn't mess with any of the php teaser fixes on the page mentioned above. I didn't want to mangle things more than I already had. I also didn't worry much about comments, because I never enabled them on Blogger.
In all, though, it was a pretty simple conversion, other than having > 500 posts titled "title" that I decided to change to "Untitled" for no good reason.
Comments [0]