pablobarbera / Rfacebook

Dev version of Rfacebook package: Access to Facebook API via R
http://cran.r-project.org/web/packages/Rfacebook
350 stars 250 forks source link

How To Include time range in Since..Until Criteria in Addition to date range #127

Closed upchair closed 7 years ago

upchair commented 7 years ago

Dear Pablo,

I need to extract posts/comments everyday from facebook. Such daily data should span a period starting at 12 midnight right through to 23:59 PM at the end of the day.

My problem now is how to include the time component in addition to the date component in the following getpage() function in order to achieve my objective.

fb_page_no_nullz<-getPage(page="gtbank", token=fb_oauth,n=1, since='2017/05/21', until='2017/05/21',feed=TRUE)

Thank you

Richard

pablobarbera commented 7 years ago

Hi @upchair -- You can add the times in the since and until parameters. For example:

fb_page_no_nullz<-getPage(page="gtbank", token=fb_oauth,n=1, since='2017/05/21 00:00:00', until='2017/05/21 23:59:59',feed=TRUE)
upchair commented 7 years ago

Pablo Hi, Thanks for your mail. I included the time in exactly the same way you advised  even before I sent you the mail but I kept getting the following error..... "  Error in rjson::fromJSON(rawToChar(url.data$content)) :   unexpected character '<'  " Could you please help me out with what I need to correct based on this error. Thank You Richard

On Thursday, May 25, 2017 1:22 AM, Pablo Barberá <notifications@github.com> wrote:

Hi @upchair -- You can add the times in the since and until parameters. For example:fb_page_no_nullz<-getPage(page="gtbank", token=fb_oauth,n=1, since='2017/05/21 00:00:00', until='2017/05/21 23:59:59',feed=TRUE) — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

pablobarbera commented 7 years ago

@upchair I honestly have no idea why this could be happening. Everything works for me:


> fb_page_no_nullz<-getPage(page="gtbank", token=token,n=1, since='2017/05/21 00:00:00', until='2017/05/21 23:59:59',feed=TRUE)
1 posts 
> fb_page_no_nullz
       from_id from_name
1 112969359130    GTBank
                                                                                                                                                                                                                 message
1 Welcome to the place where banking is made easier, Welcome to GTWorld.\nDownload here: Play Store: https://play.google.com/store/apps/details… …\nApp Store: https://itunes.apple.com/us/app/gtworld/id1227647130?mt=8
              created_time  type
1 2017-05-21T13:58:54+0000 photo
                                                                                                 link
1 https://www.facebook.com/gtbank/photos/a.138954474130.108646.112969359130/10155531587949131/?type=3
                              id                                  story
1 112969359130_10155531587949131 GTBank with Humble Ejike and 6 others.
  likes_count comments_count shares_count
1        1134             95           37

All I can think of is that maybe it's an authentication error? maybe try with a temporary token to see if that fixes the issue?