Get old Facebook posts from public FB page - facebook

For a university research project I need to view some old posts on public Facebook pages from a specific date range (January 22-31 2014.) I was planning just to copy and paste each post but I have run into a problem with some of the pages that generate a very high volume of posts. Facebook will not display past a certain date. Even with scrolling down, at a certain point the posts stop displaying (this is true by month, so it jumps from January 25 directly to December 31 for example).
Here are the pages I am interested in:
https://www.facebook.com/Syrian.Revolution
https://www.facebook.com/Syrian.Truth
I have read about Facebook's Graph API but have had some trouble using it (I don't have a developer's background.) Also the posts are mostly in Arabic so that may be a problem.
I just need the pages' posts, not the comments sections.
Thanks anyone so much for your help, it is very appreciated.

Really depends on what language/environment you're using. As a simplest case, you can just use Graph API Explorer (https://developers.facebook.com/tools/explorer) and make a call:
{{page_id}}/posts
There are a lot of ways you can improve this call for your benefit. For example, you can use a limit parameter to increase the default number of results it retruns.
{{page_id}}/posts?limit=200
By default, this returns a lot of fields, you can limit the fields.
{{page_id}}/posts?limit=200&fields=id,message,created_time
You can visit https://developers.facebook.com/docs/graph-api/reference/page/feed/ to find out which fields are supported.
In order to get results during a certain time-range, you can use the created_time field to determine if a post belongs to a certain time interval.

Related

Can you extract Facebook data by date range using Facepager?

I've been using Facepager for research purposes for almost a year now and I can't figure out how to extract data - public posts, comments and likes from a page, for instance - by date range. While other programs such as Netvizz gives me this option, Facepager seems to fail to do so.
Thank you.
You can use the since and until parameters for this, e.g. set since (left side in parameter settings) to 2017-09-13 (right side) when fetching posts of a page. See the section Time Based Navigation in the Facebook Graph API.
Keep in mind that accessing very old data with the API is limited by Faceebok. Most social media platforms are aligned to the presence :)
BTW: we just opened a Group on Facebook for getting help.

Facebook Pixel Stats GET / Reading

I have a Facebook Pixel on my website that is tracking events. I saw on the Ads Manager dashboard, that the pixel logs my events in a categorized way, i.e.:
PageView, ViewContent, InitiateCheckout, etc.
Although when logging stats, I include some extra parameters like the product_id maybe or other things, that way when the PageView is being logged, at least I will know which product_id it refers to.
The problem is that the Facebook Ads Dashboard doesn't show any of the extra parameters, it only displays the Count field.
After doing some research, I found this link on Facebook Pixel Stats, where they claim:
Use the Facebook Pixel Stats edge to get pixel statistics.
I tried using the Graph API Explorer, and even the iOS FB SDK for it (API Here) they both return an empty data array:
{
"data": [
]
}
I tried multiple parameter combinations, fields, and everything else to no avail.
If anyone knows whether I'm looking at the wrong place, or what not, all I'm interested in is reading those "extra" parameters that I'm appending to every FB Pixel event I log. Thank you!
You need specifing the parameters for it.
Example:
{fb_pixel_id}/stats?aggregation=url
The answer is displayed for a specific period of time in the past - I would say 24 hours.
You can use paging at the bottom of the json response for going back in time: use the link provided in the content of the field 'previous', and you can step back day by day.

How to search Facebook's "invitable_friends" results

I have a Facebook app, and I'd like to allow my users to invite their Facebook friends to my app. The proper endpoint is /me/invitable_friends which is working well. But towards the bottom of that doc page, they recommend implementing a "search box" to filter the results, yet they don't offer any example of how to do this. I've searched around and haven't found anything.
It doesn't appear as though you can pass additional params for filtering the results. Obviously I can filter the results after the fact, but that's not scalable since the API only returns ~20 users at a time. That limit is modifiable (I believe), though it's of course not wise to bump it too high.
So how can I build a search box interface if I can't pass the search text to the endpoint? I must be missing something.
Thanks in advance.
PS - I'm using the JS SDK.
You should probably file a bug.
Based on the documentation the default size is 1000 records (average Facebook friend list size is 300-400)
If you don't see the next parameter at the end of the result under paging then there are no more results.

Facebook Page Comments Using Graph API & Stream Filter

I have my site working using the Facebook Comments Plugin as you can see here http://www.amanzitravel.com/namibia-wildlife-sanctuary
I am trying to use the Graph API to retrieve the comments so they are on the page in a form that is beneficial for SEO (as outlined here https://developers.facebook.com/docs/plugins/comments/).
Ideally I want to see not only all comments, but replies to comments. According to the API (https://developers.facebook.com/docs/graph-api/reference/v2.0/object/comments) using filter=stream should do the trick.
However when I do that I only get the two most recent comments e.g. https://graph.facebook.com/comments/?ids=http://www.amanzitravel.com/namibia-wildlife-sanctuary&filter=stream as opposed to the default https://graph.facebook.com/comments/?ids=http://www.amanzitravel.com/namibia-wildlife-sanctuary where I get all the top level comments but none of the replies.
EDIT: Further to this, it appears to update itself some time later, but when another reply is added it goes back to displaying a subset of all the comments for a period of time. Its unfortunate because it means I can't rely on this to be accurate.
Is there anyway I can make this work properly?

Best way to get all the posts on a group's wall on Facebook

There is a group on Facebook called Pointless Haiku. I would like to download all of the posts that have ever been posted to the group's wall so I can entertain myself with random haiku for hours. So far I have used the graph explorer with this fql query (is that the right terminology?): 2204535003?fields=feed.limit(10000).fields(message), and it gives me some of the wall posts but not all of them (not even the first 10000, which is the limit I set). I don't have a Facebook app, because the only reason I want to do this is to amuse myself. Once I get all of the posts I'll probably just write them to a file and do some postprocessing with Python.
What is the best way to accomplish this? Do I need to create an app just to do this, if I want to do it programmatically?
About your observation that it gives me some of the wall posts but not all of them (not even the first 10000, which is the limit I set)
I think that the Graph Explorer is meant to be a development and debugging tool (sort of like Python's IDLE) rather that a full-power query engine. As such, I believe that it has its own built-in page-size limit that cannot be over-ridden. I believe that limit is 25. Note that this is not the limit of the number of results that are returned. It is the maximum number of results that will be displayed on one page. Depending on the size of your results set, it may take several, or many, pages to display the entire set.
So... if you are in Graph Explorer, and run a query, and get back your results, if you scroll down to the bottom of the results produced by Graph Explorer, you may see something like this:
"paging": {
"previous": "https://graph.facebook.com/...",
"next": "https://graph.facebook.com/... "
}
If you click on the URL following the "next" label, it will take you to the next page of results. And if you keep doing that, eventually you will click your way through all of the pages with all of your results.
I think that the way to get ALL of your results at a single shot is to submit the GET request (which Graph Explorer has helped you to create and debug) programmatically via (say) a Python script, or some other kind of script.
Just as an example, I used this query to get back a list of all of the messages and comments posted to a Facebook group since January 1, 2015. (I ran this query successfully on May 8, 2016, using Graph Explorer v2.6.)
128791213885003/?fields=name,id,description,owner,feed.since(2015-01-01){message,created_time,comments{from,message,created_time,comments{from,message,comments{from,message}}}}
I hope this helps.
You can use Graph Explorer for that.
/me/groups can bring group ids
/group-id/feed will bring groups feeds
Don't forget to Get Access Token with user_groups permission.