Rfacebook:对帖子的反应

时间:2017-10-29 12:33:50

标签: r facebook web-scraping rfacebook

我想使用Rfacebook来获取特定帖子的反应(不仅仅是喜欢),但却找不到办法。基本上,我想要一个评论的相同输出,因为我得到一个帖子:

> BBC <- getPage(page="bbcnews", token=fb_oauth, n=5, since="2017-10-03", until="2017-10-06", feed=FALSE, reactions=TRUE, verbose=TRUE)
5 posts > BBC
                              id likes_count      from_id from_name
1 228735667216_10155178331342217        1602 228735667216  BBC News
2 228735667216_10155178840252217        7575 228735667216  BBC News
3 228735667216_10155178915482217        5735 228735667216  BBC News
4 228735667216_10155180617187217        6843 228735667216  BBC News
5  228735667216_1964396086910573        1736 228735667216  BBC News
                                                                                                                                                                                                         message
1                                                                              "What did those people do to deserve that?" \n\nThis woman left the scene of the Las Vegas shooting just moments before it began.
2                                                                                            Puerto Rico: President Donald J. Trump compares Hurricane Maria to a "real catastrophe like Katrina" bbc.in/2yG9gyZ
3                                                                                                                                                  Do mass shootings ever change gun laws? http://bbc.in/2fIbjv0
4                                                                      "Boris asked me to give you this" - The moment comedian Lee Nelson interrupts Prime Minister Theresa May's speech.. by handing her a P45.
5 In her big conference speech, Theresa May talked about council houses and energy prices - but the announcements were overshadowed by a coughing fit and a protester. (Via BBC Politics)\nhttp://bbc.in/2fMCIw3
              created_time  type                                                       link story comments_count shares_count
1 2017-10-03T18:23:36+0000 video https://www.facebook.com/bbcnews/videos/10155178331342217/    NA            406          230
2 2017-10-03T21:34:21+0000 video https://www.facebook.com/bbcnews/videos/10155178840252217/    NA          14722        12284
3 2017-10-03T21:56:01+0000 video https://www.facebook.com/bbcnews/videos/10155178915482217/    NA           3059         2418
4 2017-10-04T11:17:28+0000 video https://www.facebook.com/bbcnews/videos/10155180617187217/    NA           1737         2973
5 2017-10-04T17:16:33+0000 video  https://www.facebook.com/bbcnews/videos/1964396086910573/    NA            636          238
  love_count haha_count wow_count sad_count angry_count
1        125         16        18      1063          20
2        318       1155      5023      1072       23698
3        104         69        61       980         504
4        513       4127        76        10          80
5         83        467        24        11          21

现在,我希望第一篇文章的前5条评论也有如上所述的输出。除了反应(对应于列love_counthaha_countwow_countsad_countangry_count)之外,我使用以下代码获取所有内容:< / p>

> BBC_post <- getPost(BBC$id[1], token=fb_oauth, comments=TRUE, n.comments=5, likes=FALSE, reactions=FALSE)
> BBC_post
$post
       from_id from_name
1 228735667216  BBC News
                                                                                                                            message
1 "What did those people do to deserve that?" \n\nThis woman left the scene of the Las Vegas shooting just moments before it began.
              created_time  type                                                       link                             id
1 2017-10-03T18:23:36+0000 video https://www.facebook.com/bbcnews/videos/10155178331342217/ 228735667216_10155178331342217
  likes_count comments_count shares_count
1        1602            406          230

$comments
            from_id       from_name
1   880124212162441   David Bourton
2 10159595379610445 Valerie Gregory
3 10159810965680122  Nadeem Hussain
4  1657693134252376    Samir Amghar
5 10215327133878123 Shlomo Resnikov
                                                                                                                                                                                                                                                                                    message
1                                                                                                                       It's unfathomable to the rest of the world that there are so many people who believe the killer's right to their guns are greater than their victims right to life.
2                                                                                 That's backwards. The victims didn't do anything. The NRA, the politicians who are bought and paid for by them, including President Trump, and the shooter did. That is where solving the problem begins.
3                                                                                                                                                                            BBC ask Israel the same Question... what did the Palestinians civilians do to deserve an Apartheid regime  !!!
4                                                        Praying and thinking of the victims will not prevent the next shooting. One failed attempt at a shoe bomb and we all take off our shoes at the airport. 274 Mass shootings since January and no change in your regulation of guns.
5 As a Jew , we constantly ask those kind of questions regarding to the holocaust ,”where was god in the holocaust “? Or “How did he allow this horror”? And the answer that facilitates the most is mysterious ways of god are beyond our perception ,we cannot grasp divine calculation .
              created_time likes_count comments_count                                  id
1 2017-10-03T18:25:58+0000         225             71 10155178331342217_10155178338952217
2 2017-10-03T18:29:04+0000          79             45 10155178331342217_10155178346307217
3 2017-10-03T18:28:34+0000          60             38 10155178331342217_10155178345382217
4 2017-10-03T18:32:11+0000          37              3 10155178331342217_10155178354272217
5 2017-10-03T18:44:19+0000          16             20 10155178331342217_10155178380902217

### how do I also display the REACTIONS a comment got? It is not "reactions=TRUE" since that will display the reactions to the post itself and not the comment of the post

有谁知道如何到达那里?或者Rfacebook根本不允许这样做(尚未),因为“对评论做出反应”的特征不久前就被引入了?

非常感谢提前和一切, IVO

0 个答案:

没有答案