Rfacebook包getpage()命令只从Facebook Pages检索几个帖子 [英] Rfacebook Packages getpage() command only retrieving a few posts from Facebook Pages

查看:113
本文介绍了Rfacebook包getpage()命令只从Facebook Pages检索几个帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近尝试了pblobarbera的Rfacebook软件包,它的效果很好。我有这个小问题,我正在分享代码。

  install.packages(Rfacebook)#从CRAN 
库(devtools)
install_github(Rfacebook,pablobarbera,subdir =Rfacebook)

库(Rfacebook)
# ://developers.facebook.com/tools/explorer
token< - **********

page< - getPage(DarazOnlineShopping令牌,n = 1000)

getPage 作品,但它只从我在命令中使用的Facebook页面检索14条记录。在原始帖子中,pablobarbera使用的例子中,他从纽约人回访了所有的帖子,但是当我尝试了同样的命令时,Facebook要求我减少帖子数量,我几乎没有设法获得20个帖子。这是Pablo bera使用的命令:

  page<  -  getPage(humansofnewyork,token,n = 5000)

我以为我正在使用临时令牌访问,为什么Facebook没有给我所需的数据,但是我完成了哇,Facebook的Oauth进程和相同的结果。



=h2_lin>解决方案

getPage()命令对我来说很好,我在主页上手动计算了14条帖子(包括照片)。这可能是达拉斯在线购物有多个页面,并且您使用的页面名称只返回主页面的结果,当(我假设)想要所有的结果。



getPage()也接受页面ID。您可能需要收集与Daraz Online Shopping相关联的ID列表,循环并调用它们,并将输出结合起来以获得所需的结果。



要查找这些ID可以写入一个刮板(或手动搜索所有)查看页面源并搜索唯一页面ID。搜索 content =fb:// page /?id = 将突出显示源代码中页面ID的位置。


I recently tried Rfacebook package by pablobarbera, which works quite well. I am having this slight issue, for which I am sharing the code.

install.packages("Rfacebook")  # from CRAN
library(devtools)
install_github("Rfacebook", "pablobarbera", subdir = "Rfacebook")

library(Rfacebook)
# token generated here: https://developers.facebook.com/tools/explorer 
token <- "**********"

page <- getPage("DarazOnlineShopping", token, n = 1000)

getPage command works, but it only retrieves 14 records from the Facebook page I used in the command. In the example used by pablobarbera in the original post he retreived all the posts from "Humans of New York", but when I tried the same command, facebook asked me to reduce the number of posts, and I hardly managed to get 20 posts. This is the command used by Pablo bera:

page <- getPage("humansofnewyork", token, n = 5000)

I thought I was using temporary token access that why Facebook is not giving me the required data, but I completed the wholo Facebook Oauth Process, and the same result.

Can somebody look into this, and tell why this is happening.

解决方案

The getPage() command looks fine to me, I manually counted 14 posts (including photos) on the main page. It could be that Daraz Online Shopping has multiple pages and that the page name you are using only returns results from the main page, when (I assume) you want results from all of them.

getPage() also accepts page IDs. You might want to collect a list of IDs associated with Daraz Online Shopping, loop through and call each of them and combine the outputs to get the results you need.

To find this out these IDs you could write a scraper (or manually search for them all) that views the page source and searches for the unique page ID. Searching for content="fb://page/?id= will highlight the location of the page ID in the source code.

这篇关于Rfacebook包getpage()命令只从Facebook Pages检索几个帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆