I'm a little bit lost for the moment trying to write my thesis.
I need to collect data from a facebook page, for later use them for network analysis.
I need to collect for each message posted:
ID of the message posted
Content
Type (picture, link, text or game)
ID and name of the person who has posted the message
Date of the creation of the message
If it is case, dates of the possible updates
Number of likes
Names and IDs of the likers
Number of shares
Names and IDs of the sharers
Number of comments
Name and ID of the commentator + content of the comment
Number of page likers at each moment (before each message posted)
Being not from the IT sector, i've got lots of difficulties. What's the easiest way to collect such data?
Moreover, do you think that it's legal to try to get data on public facebook pages?
Use Facebook Graph API. A few lines of simple Java program or perl script will suffice. You will need valid Auth Tokens.
Related
With FQL being phased out I need to achieve the same functions via the Graph API.
My application checks for new posts, comments and replies on a company page every X seconds.
I use 1 FQL to get new comments and replies by doing
SELECT post_id,time,fromid, text,id from comment WHERE time > (lastcheck) and post_id in (select post_id from stream where source_id = (PageID) limit 1000) order by time desc
This appears to work well ,I can add a comment to a 5 month old post and it picks it up.
How can the same be achieved with the Graph API?
I think that if what you have works then you do not need to change it. Contrary to what Facebook wants you to do (use the graph api), not every query can be translated to it. FQL is alive and kicking and used heavily both in the Facebook website and mobile apps.
I would like to find any of my own activity (post, comment, share, etc.) on another user's page or a fan page. That is, obtain a list of all the comments, posts and whatnot that I have made on user XYZ's page, or on SOMETVSHOW's page.
Is that possible at all? I've looked at the different relations that are accessible using the Graph API, but there seems to be no direct way to get this data.
One way to do this is to collect ALL of my own activity and then run this data through a filter that would extract just the comments, post, etc. that I left on a certain user's page or fan page. But that is not really efficient, especially if you have (like me) a very large amount of data to capture in the first place.
Also, I could go the other way and grab ALL of that user's or fan page's activity and the filter out my own posts and comments, but likewise, this would take an eternity and produce huge amounts of data that need to be processed.
Any ideas? Thank you!
You should be able to do this pretty easily via FQL:
SELECT post_id, type, message, created_time, attachment FROM stream
WHERE source_id = PAGE_ID AND actor_id = me() LIMIT 200
You will have the normal limitations of the stream table to deal with, so you may have to page back through these results to get everything you are looking for.
I want to get the most recent updates from my liked Facebook pages (graph.facebook.com/me/likes/). I thought I'd got it working using FQL with the below statement
SELECT source_id, share_count,likes, FROM stream WHERE source_id in (select target_id from connection where source_id=me() and target_type='page') LIMIT 100
However it seems that FB is filtering out a bunch of pages due to their various algorithms. Is there any straight forward way of getting around this? I'd just like to see all messages and decide whats relevant myself.
I was previously jumping onto every single page of my likes via the graph api, but obviously this gets a bit crazy if there are 700 odd likes in my profile.
I develop WP7 app and I'm calling last 20 results from webservice and I wonder how to call next 20 when user goes to the end of listbox?
I have found some topics how to recognize when user reaches end of the list but I'm struggling how to re-call WebService and ask for next entries.
EDIT:
So okay, here is the thing. In my API I have two options:
- take some amount of results (like 10, 20, 30) and then show them all on the list
- second options is to ask API to give me like 3 pages of 20 records on each page
Thinking about second option: okay I can display just 1/3 pages and then when user goes down call another page (already stored on phone) but that makes no sense as user will download all records (even he don't want to see more than top 5...
The only idea is to call next results, but don't know how to re-call webservice on some point
Your problem seems more of a web-services related than a windows phone related. Because if you are getting some data from a web service then the web service provider should ideally provide you with some documentation on how to fetch next/previous records or entries.
Here are two links from Twitter API which gives you some idea on fetching the data in pages.
Getting the home_timeline data
Working with Timelines
Here is another link which gives idea on how to implement paging in a Silverlight Application (I am not sure how far this method is compatible with WP app)
If this data couldn't answer your question, then update your question with some additional data like which url you are using to fetch the first 20 records etc
via the graph api, I create events for facebook pages I have the create_event and manage_pages privileges for.
I post to https://graph.facebook.com/pageId/events with the usual name, location, start_time, street, city parameters. Works perfectly.
However, I haven't found a way to submit a certain place_id for the event (e.g. FB-ID of the venue). This is possible using the web client. When creating an event, you can select a place/venue, the resulting event page shows that place on the map and links to the place page. Events created via the api only show the location name as text.
I tried place_page_id and several others as parameters, but nothing worked.
Has anybody done that successfully?
Thanks
Yes, you can. A poorly documented property of Event is location_id. Works fine.
The way I handle it is to search for type=place and if I find the place in the vast Facebook data store I use the id of that place in the location_id field. If I don't find the right place I use the information I have for street and city. (If you have location_id you really don't need street and city).
No with the current API it is not possible. Here's the only parameters for creating an event available. They are the same for user events as well as page events.
name (string)
start_time (timestamp)
end_time (timestamp)
description (string)
location (string)
privacy_type (string)