Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maxim/wpxml_parser
Convenient WordPress XML dump parser.
https://github.com/maxim/wpxml_parser
Last synced: 4 days ago
JSON representation
Convenient WordPress XML dump parser.
- Host: GitHub
- URL: https://github.com/maxim/wpxml_parser
- Owner: maxim
- License: mit
- Created: 2010-08-14T09:58:25.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2010-08-14T18:02:53.000Z (about 14 years ago)
- Last Synced: 2024-10-06T01:16:36.706Z (about 1 month ago)
- Language: Ruby
- Homepage: http://github.com/maxim/wpxml_parser
- Size: 89.8 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
wpxml_parser
============WordPress (version 3.x and I think there's a plugin for 2.x) can export xml with all your blog posts, comments, etc. This tool can parse the xml file and give you a convenient access to all your posts, comments, categories, etc in a ruby script that _you have to write_.
The cool thing is — you don't even need to have access to your own WordPress database, all you need is to download the xml file from your admin panel.
### Install
gem install wpxml_parser
### Usage
require 'wpxml_parser'
include WpxmlParser
# Blog
blog = Blog.new('dump_of_your_blog.xml')
blog.posts.size # => 51
post = blog.posts.first # =>
# Post
post.title # => "Title of your post"
post.categories # => ["ruby", "rails"]
post.date # =># Conveniences
# You can quickly find a post or a comment by post_id or comment_id respectively
blog.find_post(27) # =>
post.find_comment(32) # =>
# For more info and more accessible properties check out the source code, it's pretty straightforward.### A note on posts
Currently only published posts are included. Drafts, private, etc are skipped. This was done on purpose, since I didn't really use those wordpress features.
### A note on comments
Currently only approved comments are included. This was done on purpose, since I didn't need spam.