I want to get the total number of members count of my fb group in a HTML document tag (div) which I admin. Need the complete code where I can replace only the ID and APT secret.
This is not directly possible because the Group object in the Graph API doesn't have a members count field. You could iterate through the members list though...
See
https://developers.facebook.com/docs/graph-api/reference/v2.3/group
https://developers.facebook.com/docs/graph-api/reference/v2.3/group/members/
Related
I can use the Facebook Graph API to get a list of group members. The simplest way to do this is to go to the Graph API Explorer and do a GET request of the form {group_id}/members. Is there a way to similarly obtain the members' join date and who they were invited by?
The relevant Graph API doc doesn't seem to mention it. But I know the information is stored by Facebook because it is possible to list all of the group members and their inviters through Facebook itself. Is there a way to get this information through the API?
EDIT: Nothing in the FQL group or group_member API either.
While this information is not available on the API, you can get it by using Selenium to scrape the members page.
First, instantiate a driver and use it to get the members page:
driver.gethttps://www.facebook.com/groups/your group number/members
Then, look for the member information:
containers = driver.find_elements_by_tag_name('td')
Finally, iterate through the web elements, extracting text and parsing resulting list for joined date information:
member_info = container.text.split('\n')
name = member_info[0]
member_since = member_info[-1]
You'll still have to map this information to the user ids, which you can do by looking for another element in the container and using REGEX.
`def parse_id(self, container, name):
hovercard = container.find_element_by_link_text(name).get_attribute('data-hovercard')
regex_id = re.compile('php\?id=(\d*)')
member_id = regex_id.search(hovercard).group(1)
return member_id`
It is indeed stored by Facebook and retrieved for use with internal APIs. For the Graph API however it is not possible to get this information.
All the fields available for a group_member are listed at SELECT column_name FROM column WHERE table_name = "group_member"
I am running the query below and it is returning all of the the adgroups associated with this campaign ID which is provided, I am wondering would it be possible for me to get the ad-statics using the same query for all of the adgroups provided. if so how would i go about doing this. Please take into account I want the data to return all of the data for the adgroups and the statistic for that adgroup
act_10188168/adgroups?end_time=2013-06-02&start_time=2013-06-01&campaign_ids=[60074688]
You need us the adgroupstats API with the list of ad ids received from the previous query.
https://graph.facebook.com/act_{ad_account_id}/adgroupstats?adgroup_ids=[JSON-encoded array of ad group IDs]
Here is a group A. I want to extract the members' group information as the training data set.
For example, group A has a list of 400 members and each member joins a number of different groups.
How can I get the members' information from the group? Can I get members' information by simply using the group id?
You can query the group endpoint using the graph api...
https://graph.faecbook.com/GROUP_ID/members
This will return (quoting facebook docuemntation) :
All of the users who are members of this group (can only currently return the first 500 members).
You will have to use a valid access token and you will only be able to retrieve one if you are administering the group.
I would like to get work place information of a user using FQL.
When I use the Graph API and get the User object, it contains work information, which is essentially a list of the work history. The list elements contain nodes of employer, location, description, etc...
The nodes appear to be pages internally. If I take the id of a node, e.g. from the employer, and use FQL to query a page with that page_id, I do get an object with corresponding information.
My question now is, how do I use FQL to get the same information without accessing the Graph API? What table stores the work-related information, for example how do I find all the page_id of the employers of a given user?
The reason I insist on using FQL only is performance. Of course I could access the Graph API for all the users in question and get the info that way, but I'm looking for an FQL-only solution.
You can get this information from FQL. Read the "user" table and look for the work field. The JSON data returned should be the same format as the one for Graph, i.e., the result is an array and each result should include an "employer" object with an "id" and "name" field.
You will need user_work_history or friends_work_history to access this field.
I am looking to grab the names of facebook users from an array of about 100 ids and store in php variables. Is there a way to do it without making api calls or using curl for each id in a loop?
Yes:
https://graph.facebook.com/?ids=id1,id2,...,idX&fields=name
You can do this:
You can run an FQL query on the 'user' table to get their name.
Here are a few links for more information:
http://developers.facebook.com/docs/reference/fql/
http://developers.facebook.com/docs/reference/fql/user/