Which Instagram API should I use to collect public data? - facebook

Does either the Instagram Basic Display API or the Instagram Graph API allow me to simply get any public user's posts/media programatically? Everywhere in the documentation it says "User data" but it feels like I can only get data of the user that got authenticated using the API. I've set up a Facebook dev account and currently spending 4th hour on calling both APIs without success. Can anyone who has used them help me clear this up?

Most likely, Instagram API Date 365, a tool I currently work for, may help you as an alternative to using Instagram Basic Display API or the Instagram Graph API because this API is created especially for scraping bulk data about posts and users.
You can get such post data as post content (text, language, list of hashtags, list of tagged users), owner ID, location ID,
engagement info, etc. Also, it is possible to download comments (selected or on a specific post) and replies to them.
You can view this for more info.

Related

Can I get all posts from instagram based on a specific tag with the new Facebook Graph API?

Right now I am using Instagram API Platform with the "Public Content
- capabilities to read public media on a user's behalf" rights for my app. As it is stated on the website, it will be deprecated on December 11, 2018 and they are pointing to the new Instagram Graph API.
I went through the documentation but could not find what I need. I would like to know if it is possible with the new API to:
Get all posts info (user that posted, the number of followers, caption, likes count and the media itself). With the Mentions API from Instagram Graph API you can get all posts where your Business account is tagged #account, but they require media_id which I don't have, how do I get it?
Get all posts with a specific hashtag, of a specific user (non-business account) within a timeframe. From the comments it is clear that this is not possible for now. Still hope to get an answer to my first question.
I would like to know if the above mentioned are possible with the new API and it would be nice if you can point me to the right API. Thank you in advance
but they require media_id which I don't have, how do I get it?
You can get the list of media id's on which an account has been tagged using the tags endpoint.
v4.0/<account id>?fields=tags
Once you have the list of media items in which the account has been tagged, you can cycle through them and return the following fields each media post.
Returnable Fields: caption, comments, comments_count, like_count, media_type, media_url, owner — The ID of the user who owns the object., timestamp, username
With the owner ID of the post you might be able to look up more of the fields you are looking for, but you will likely run into some permission issues.

How to get user data now with restrictions on instagram platform api?

There have been lots of changes to the facebook api recently, which now includes the instagram api as well. https://www.instagram.com/developer/changelog/
They have shutdown a lot of endpoints way ahead of schedule and has created a huge problem for my application which integrates instagram user data. They have the instagram graph api now, but looks like it can be used only for business accounts (looked like that prima facie). Reading through the news past couple of days, I am really confused about what is available and what is not. My application used to get user data (number of followers, recent posts, reach, likes, etc) using the instagram handle provided by users. Since this is totally restricted on the platform api now, is there a way I can have the same functionality using the new graph api? Or should I look into 3rd party APIs? I am open to asking users for authentication (I already have the facility). Can the user information be fetched after they authenticate my app to do so?
You can use the following Graph API to get all the details for any IG business account.
https://developers.facebook.com/docs/instagram-api/business-discovery

How to get news feed exactly how it appears in facebook homepage newsfeed using api

I am using /me/feed and /me/home to get my feed and my homepage feed respectively.
But the /me/home only shows updates from my friends. I am following many people but not friends with them. My facebook homepage shows all the updates including my friends and the people I am following.
How to get the news feed exactly like the one appears in the fb website?
As #Fabio said, the Graph API does not support it as of now (and I don't think it'll do that in the future). You can only obtain yours and your friends' feeds using the Graph API.
In order to obtain the feeds from a specific person who's not in your friend list, you need a valid User Access Token from that user with a read_stream permission.
There is however a way to read the public feeds of user status updates and page status updates as they are posted to Facebook. This can be done by using the Public Feed API. This will include all feeds that have their privacy set to ‘public’ are included in the stream. Also, you cannot apply to use the API at this time as its access is limited. Its page says:
Access to the Public Feed API is restricted to a limited set of media
publishers and usage requires prior approval by Facebook. You cannot
apply to use the API at this time.
But I think it's just a fancy way of saying that this API is not free and you'll be charged few dollars (which you can find out by getting in touch with someone at Facebook) for using this service.

How to get insights on a Facebook fan page without user login

I'm trying to figure out how to get the total number of comments, posts, likes and fans for any given Facebook fan page and date range using the Facebook API's. I need to be able to do this without the user having to log into Facebook to give the app permissions. This does seem to be possible, as this site is able to do it https://app.conversocial.com/profiler/ .But I don't know how they are doing it.
I've looked into the 'insights' fql table, but this always seems to return empty results. And I've also looked into the 'link_stats' fql table but this doesn't allow a date range to be set.
Does anyone have any idea on how to do this?
You are right. What they are doing is not possible by using the normal Graph API or/and the FQL.
However, Facebook also provides support for two other APIs:
Public Feed API
Keyword Insights API
Access to these APIs is restricted to a limited set of media publishers and usage requires prior approval by Facebook.
I think that they are using the Public Feed API. The documentation of the Public Feed API lists some of the publishers that have been using this API and the site you've mentioned in the question is not in the list. The documentation also doesn't mention anything about getting the Page Insights, but I think it might support this feature (as I see no other way of doing it).
Or, they might be using any other such restricted API which is not yet available to the public and not even documented on the developers website, but is currently in beta/testing phase.
To get the number of fans and the talkabout count, just query the appropriate Open graph ID for the relevant page. For example, for Coca Cola (https://www.facebook.com/cocacola) this is done via
https://graph.facebook.com/40796308305
To get all public infos (Posts etc) use the following request
https://graph.facebook.com/40796308305/feed?access_token={ACCESS_TOKEN}
where {ACCESS_TOKEN} can either be an App Access Token or a personal one. Consider that you can only see public entries.
The ability to query the date ranges is not provided via Facebook ad far as I know. I guess the https://app.conversocial.com/profiler/ application queries each page that is in its index once a day, and saves the results. That's how they're able to provide historical data.
You can try with the following FQL queries or graph API requests for facebook pages,
Graph API
http://graph.facebook.com/nb4cinema
FQL
SELECT name,about,description, fan_count,talking_about_count FROM page WHERE username= 'stackoverflowpage'
In case of FQL tables:
To read the page table you need
no access_token to get public information, or information about public pages that are not demographically restricted.
any valid access_token to get all information about a page that the current session user is able to see.
We have a test fan page. This has poor figures (<10 fans). Statistics are not available due to the lack of fans and likes on that page.
Allthough, conversocial spits out some statistics. They mixed fans and likes to some extent and so my impression is, that they simply parse the page code in order to get what you see.

Integrating Facebook into Google analytics

I want to add the 'Log in with Facebook' option to my website, however I'm unsure how to integrate the information gained when someone logs into my website with Facebook with my current Google Analytics.
Is it possible to link up a visit in Google Analytics with a user who has logged into the site with Facebook to enable me to see things like age, gender etc?
Any help you can give me on this would be much appreciated.
Thanks,
Ben
you may have to do this via a redirection or possibly a frame.
Google Analytics does nolt track individual users, it provides anonymized data. So at the top level, no you cannot do this. However, there are a few more things avaiable to you. One: Facebook provides facebook insights, their own tracking suite, that will give you demographic information on the users of a facebook app or fan page. You site will effectively become a facebook app when you use their user authenication, so you will be able to get insights tracking on you site. At the present moment, facebook insights and google analyitcs do not itegrate or share data. Facebook insight also provides anonymized data, so you will not be able to identify an individual through the tracking.
The final option is, now that you are tracking users through login, you can implement your own tracking info on your site to see what individual users are doing, and attempt to track their preferences.
Its also entirely legal (in the United States at least) to buy access to marketing data and use use your registered user name pool to get additional information.
If you wanted, you could set up a "funnel" in Google.
When a user logs in through Facebook, you could send them to a specific page and then track their progress from there...
http://www.google.com/support/analytics/bin/answer.py?answer=55515
So using this you could get the percentage of users who log in through Facebook... etc.
But to collect information other than that, you would have to get the correct permissions documented here eg. user_birthday (to get the user's Birthday) and query the Graph API from there, thus implementing your own tracking of users.
You can query the Graph API using the various SDKs that Facebook provide explained here.
First of all you should check out this Google document. It explains, how you set a custom unique user id via google analytics.
Further you've to send an event to google analytics (e.g. 'fb_login') via the callback function of your facebook login function.