How can RWordPress get blog content?

I would like to get the content of posts from my WordPress blog. Using the RWordPress package, you can easily get categories and tags and headers, but what about message content?

 # Download and load the package if (!require('RWordPress')) { devtools::install_github(c("duncantl/XMLRPC", "duncantl/RWordPress")) } library(RWordPress) # list all the functions in the package lsf.str("package:RWordPress") 

Here, for example, is the code for getting the categories, with my specification copied in brackets:

 Cat <- getCategoryList(login = c([my user name] = '[my password'), .server = 'http://[my blog on].wpengine.com/xmlrpc.php') 

The related SO question is not applicable since it does not use RWordPress [HTML and CSS and PHP coding] .

This site is about publishing on WordPress, not extracting it from WordPress [posting, not getting] . Another question uses xmlrpc, like RWordPress, and the call to getPosts, but it does not rely on R.

 Posts <- getPosts(num = 100, blogid = 0L, login = c([my user name] = '[my password]'), .server = 'http://[my blog name].wpengine.com/xmlrpc.php') 

The code above returns dates, names and status, but not content.

Thanks for any recommendations.

******************** Edit after the first answer

After requesting RWordPress and RWordPress , and then defining an object to log in and for .server, here is the console message:

 > getPageList(blogid = 0L, login = WordpressLogin, .server = WordpressURL) Error in xml.rpc(.server, op, as.integer(blogid), names(login), as.character(login), : Problems 

I find that β€œProblems” is not an informative error message for me.

+6
source share
1 answer

Tell me if something is missing for me, but for me the message id description seems to deliver all the text.

RWordpress displays all functions in XML-RPC wp

 if (!require('RWordPress')) { devtools::install_github(c("duncantl/XMLRPC", "duncantl/RWordPress")) } library(RWordPress) options(WordpressLogin = c(myusername = 'mypassword'), WordpressURL = 'http://localhost/myblog/wordpress/xmlrpc.php') # library(knitr) # can refer this page # http://codex.wordpress.org/XML-RPC_wp #Rwordpress has a one to one mapping getCategories() #get a list of pages getPageList() # pick one id from above list id=27 getPage(pageid = id) # description seems to have all the text of post, even though the # document is sparse getPage(pageid = id)$description #similarly for posts getPost(postid = 6)$description 

Of course, I use a locally installed blog, but I believe that this should work remotely.

+2
source

All Articles