Facebook Api Public Posts - javascript

I want to grab the posts from a public Facebook group using the Facebook api. I have been reading the documentation and I haven't found a way to grab that data without logging in. But using the graph explorer I do not need to log in to get the data so there must be a way.
Is there anyway to do this using the javascript Facebook api?

you can use,
https://graph.facebook.com/fbusername/posts?fields=full_picture,message,created_time&date_format=F/d/Y&limit=10&access_token=useapptoken
you can use App token instead user access token.

Related

How can I add the ability to extract and post tweets onto the site when user submits link?

I'm making a rails application, I want users to post their tweets by submitting a link [of the tweet]. I'm guessing its done with javascript/twittera api. Things needed to be extracted:
tweet owner
tweet + image
link to user profile page
Twitter REST API requires oAuth authentication. So, you would have to provide access token with all of your API calls. oAuth specification allows you to get access token through javascript as well. So you might want to look into that.
If you decide on using REST API, I would suggest moving this to server-side. You would be able to save user tweet urls and data.
Alternatively, if you are just playing with javascript and want to do this for yourself, you can simply see in your browser's developer tools where official Twitter widgets are getting tweet data and use that edges. I remember myself doing this several years ago.
But, please note. These urls are not public and official way of working with twitter data. So, they may change at any time and break your code.

Is there any rest API to get ratings from a public Facebook page?

I have a web application that gets information from different platforms which is working fine. I want to get ratings of a public Facebook page without login and without any access token using javascript. Is there any rest API or open API which can help me get these ratings without all heck of login and access token ?
https://developers.facebook.com/docs/graph-api/reference/page/ratings/
A Page Access Token is required for all methods.
That means, you have to manage the Page if you want to get the ratings with the API. There is no way to get ratings for any public Page if you donĀ“t manage it.

How to make Youtube Data Search API open for public usage?

Currently, I can use Youtube Data API to search for videos. However, I must be logged in onto my google account. Is it possible to conduct searches without logging in into an arbitrary google account? This way any user can just search without logging in.
I am using Youtube api in javascript
Search is a special case, where users don't have to log in through OAuth2. But you will need to provide your API key to authorize the access uf API usage.
Here's the example. HTML and JS
You'll need an API key so that any searching done through your app can be properly analyzed, routed, etc. If you're using v3 of the data API (which you should now that it's in production), you can easily request a key as you would get access to any google API:
Visit https://code.google.com/apis/console and register your
project (don't forget to give it a project ID)
From that project dashboard, select the Youtube API under the
'Services' tab.
Since you just want to do searching, under the 'API
Access' tab you can create a browser app key (part of the 'Simple
API Access' section). That generated key should be appended to all
REST calls.
If you still need to use v2 of the API for some reason, you can create your key here:
https://code.google.com/apis/youtube/dashboard/gwt/index.html

Can I get public graph API data without a token?

I'd like to display a list of public Facebook events that I post on a separate webpage so it's easier to keep updated - just update Facebook and the next call to the graph API shows my current events.
I've got the javascript SDK working on the page, but the graph API seems to always want an access token for me to request any data, even public stuff. I obviously don't want a user to have to log in to my web page just to see some events. Is there a way to request public event data without an access token? Or can I add a hardcoded access token that is only available for use by my Facebook app?
I just checked and, no, you can't access public events without a token.
But yes, you can have an access token just to retrieve this (for instance, if you already have an app, you can use your user token for it).
My suggestion is that you access the graph api only once after you add/update your events, and store the result in a static place (json, db, static file, etc) so that you can easily show it when needed instead of making requests to the graph api every time.

Grabbing facebook feed in website

I develop mobile websites for my clients. This particular client would like some facebook wall activity to be displayed on the website. I have looked into the facebook graph api and am getting confused on authentication.
I need the blah in https://graphs.facebook.com/clientsfacebookid/feed?access_token=blah
in order to grab the info i want. I read about authentication and all of that but it doesn't seem to serve my purposes.. For example a lot of the stuff I read about getting a token is related to creating apps and stuff - which is not what I'm trying to do. A lot of ways to authenticate redirect users to log in or grant access to the information but this also doesn't seem like it fits my scenario.
Should I just talk to my client and get them to send me an access code or set up some stream so I can grab an updated access code anytime I need it OR is there some built in functionality in the API that I could benefit from using.
Any thoughts?
P.S. I am trying to implement this via an ajax call in javascript.
Thanks!
What you'll need to do is create a Facebook App and have your client add this to their page. You can then get an OAuth token for this app and use it to query the client's feed. See the Facebook documentation for authenticating as an app for details.
It's actually far simpler if you just want to grab the data from the page. Create an App, but you don't need to add it to the actual page. You can generate an App Access Token by following the instruction on the Facebook Developer Website.
Then, all you need to do is call the Graph API with the generated access_token. E.g.:
https://graph.facebook.com/{page_id}/feed?access_token={app_access_token}
You can then use the data returned by Facebook to display selected posts from the page.
The Page Admin doesn't need to add the app to the page, and this method can be used to scrape any published page. The posts on Pages is public anyway, you just need an access_token to access the page.
If you want a simple way to learn and have an example of a working model try out fourgefeed.com its a simple framework with a simple to implement example kinda like jquery.

Categories