Created
July 24, 2013 09:37
-
-
Save kyungw00k/6069236 to your computer and use it in GitHub Desktop.
Migrate Wordpress to Haroopress using XML-RPC in NodeJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var conf = require('./config.js') | |
, wp = require('wordpress') | |
; | |
// TODO Account Validation | |
// TODO Make Output Directories | |
// | |
// Client Instance | |
// | |
var blog = wp.createClient(conf.account); | |
// | |
// Process Data | |
// | |
blog.getPosts(conf.filter, null, function(error, posts){ | |
if ( error ) { | |
throw new Error(error); | |
} | |
if ( !posts ) { | |
throw new Error("No Articles"); | |
} | |
posts.forEach(function(post, idx){ | |
// TODO mapping wp post to haroopress post | |
if ( post.post_type == 'post' ) { | |
// POST | |
} | |
if ( post.post_type == 'page' ) { | |
// PAGE | |
} | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var config = module.exports = {}; | |
// | |
// Account Information | |
// | |
config.account = { | |
"username" : "[USERNAME]" | |
, "password" : "[PASSWORD]" | |
, "url" : "http://[YOUR-WORDPRESS-URL]" | |
}; | |
// | |
// Filter for post and page | |
// | |
config.filter = { | |
"offset" : "0" | |
, "number" : "4294967295" // MAX DATA SET | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "haroopress-wp-importer", | |
"version": "0.0.1", | |
"private": true, | |
"scripts": { | |
"start": "node app" | |
}, | |
"dependencies": { | |
"wordpress": "*", | |
"markx": "~0.2.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment