worddump

0.0.2 • Public • Published

Node.js - worddump

Dump data from a WordPress blog.

Why?

I don't like WordPress anymore. I want to write all of my blog posts in Markdown and control the look, feel, and templating of the results. However, my coding blog Procbits is still a WordPress blog. I need to migrate it.

Installation

npm install worddump

Example

Example to quick dump your Wordpress blog:

var Worddump = require('worddump')
  , batch = require('batchflow')
  , fs = require('fs-extra')
 
 
var wd = new Worddump({url: 'http://yourwordpressblog.com', user: 'USER_NAME', password: 'PASSWORD'});
wd.getPostIds(function(err, postIds) {
  batch(postIds).parallel(8).each(function(i, id, next) {
    wd.getPost(id, function(err, post) {
      wd.getComments(id, function(err, comments) {
        fs.writeFile(post.post_name + '.txt', post.post_content, function(err) {
          fs.writeJSONFile(post.post_name + '-comments.json', comments, function(err) {
            next();
          })
        })
      })
    })
  })
  .error(function(err) {
    console.error(err);
  })
  .end(function() {
    console.log('Done.');
  })
})
 

API

getPostIds(callback)

getPost(postId,[filter],callback)

getComments(postId, callback)

getUsers(callback)

Resources

http://codex.wordpress.org/XML-RPC_WordPress_API

License

(MIT License)

Copyright 2012, JP Richardson jprichardson@gmail.com

Readme

Keywords

Package Sidebar

Install

npm i worddump

Weekly Downloads

1

Version

0.0.2

License

none

Last publish

Collaborators

  • jprichardson