我想从我的WordPress博客中检索帖子的内容.使用RWordPress包可以直接检索类别,标签和标题,但是帖子的内容呢? # Download and load the packageif (!require('RWordPress')) { devtools::install_github(c("duncantl
# 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")
例如,这里是获取类别的代码,我的详细信息在括号中编辑:
Cat <- getCategoryList(login = c([my user name] = '[my password'), .server = 'http://[my blog on].wpengine.com/xmlrpc.php')
链接的SO问题不适用,因为它不使用RWordPress [HTML and CSS and PHP coding].
这个网站是关于在WordPress上发布,而不是从WordPress [publishing, not gettting]中检索.另一个问题是使用xmlrpc和RWordPress以及getPosts调用,但它不依赖于R.
Posts <- getPosts(num = 100, blogid = 0L, login = c([my user name] = '[my password]'), .server = 'http://[my blog name].wpengine.com/xmlrpc.php')
上面的代码返回日期,标题和状态,但不是内容.
谢谢你的任何指导.
*******************首次回答后编辑
在要求RWordPress和XMLRPC,然后定义用于登录和.server的对象之后,这是控制台消息:
> getPageList(blogid = 0L, login = WordPressLogin, .server = WordPressURL) Error in xml.rpc(.server, op, as.integer(blogid), names(login), as.character(login), : Problems
我发现“问题”对我来说不是一个提供信息的错误信息.
告诉我,如果我遗漏了什么,但对我来说,帖子的描述标识符似乎提供了整个文本.RWordpress映射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
我当然使用本地安装的博客,但我认为这应该是远程工作.