facebook post a youtube video to stream.publish - facebook

I'm using the facebook SDK for iOS, but I assume that doesn't matter as every facebook platform has the post option for stream.publish
I can send a regular post just fine, but when I post a YouTube video it shows up as a link rather than a YouTube video. Is there a different option other than stream.publish I should use to accomplish posting a video?
I tried video.upload and video.publish, but neither worked. What should I do? Thanks.

I'm more familiar with the C# SDK but it shouldn't be that different.
Are you specifying the post type as a link?
Ex.
args["message"] = msg_txt;
args["title"] = title;
args["type"] = "link";
args["link"] = "http://www.youtube.com/watch?v=blahblah";
args["source"] = "http://www.youtube.com/v/" + YouTubeVideoID + "?version=3&rel=0";
Can you provide a code snippet of what you are doing?

Related

Facebook Live Stream Static URL

I was curious as to if there is anyway to have a certain page on Facebook have a static URL for it's Live Streams. I want this so I can use that static URL and embed it on a website (Weebly or Wordpress). Does anyone know of a way to do this?
Any and all input is greatly appreciated.
Thanks much!
No, currently there is no such direct feature provided by Facebook to achieve what you want to do. But there is definitely an indirect way of doing this using Facebook Graph API.
Indirect method of doing so:
Use your page ID to get status of last live video of your page.
/Page_ID?fields=live_videos.limit(1){status}
If you get status field as 'LIVE', it means your video is still LIVE on your page. Then, use the returned Video Id of Live video to make next request.
You can get the embed html of the live video using this request:
/Video_ID?fields=embed_html
Use the returned embed_html to embed live video in your wordpress site.
You just need to write the script that executes the above task and embed video conditionally if the status of video is LIVE otherwise not.
This is a pretty old question, but here's my solution:
Make a GET request to https://facebook.com/PAGE_ID/live
Capture the redirect - this request redirects to the URL you want
How I did it in Node.JS
const https = require("follow-redirects").https;
const PageID = "nexe32"
let redirected = false;
https.get({
host: 'facebook.com',
path: `/${PageID}/live`,
headers: {
"User-Agent": 'curl/7.43.0'
},
beforeRedirect: (opts) => {
if(!redirected) {
redirected = true;
} else {
console.log(opts.href); // the URL you want
redirected = false;
}
}
});
``

how to implement facebook feed using ionic framework for hybrid app

I am working on a hybrid mobile app using ionic and cordova, In the app I am sharing pictures with comments in social media. I want to impliment "facebook feed" method to share pictures in facebook with custom comments.
I have tried ngCordova's Facebook plugin but I faced some Issues in that, where the issue ticket is still open in the plugin builder's github. So I removed this plugin.
I have seen ngOpenFB but there I have'nt found $openFB.ui() method for feed dialog.
I want to know that is there any plugin available by which I can impliment Facebook feed for image sharing in my app.
Thanks in advance.
Please have a look for your facebook integration in your hybrid app nicraboy
// Add to openfb.js and use it.
function ui(method,obj) {
var method = method || 'GET',
params = obj || {},
xhr = new XMLHttpRequest(),
url;
params['access_token'] = tokenStore.fbAccessToken;
params['redirect_uri'] = 'http://localhost:8100/#/tab/chats';
params['display'] = 'popup';
params['sdk'] = 'joey';
params['app_id'] = 'APP Id in Integer';
url = 'https://www.facebook.com/v2.6/dialog/' + method + '?' + toQueryString(params);
window.open(url, '_open', 'location=no,clearcache=no');
//window.open(url, '_self', 'location=no,clearcache=no');
}
Also have a look at this repo: https://github.com/srameshr/ionic-starter-oauth

AS3: Post to Facebook Wall - Error #2032

I am currently developing an app with which visitors of an event can take pictures using a webcam and upload them to Facebook using an AS3-application. I know I can connect to Facebook, because I can log the user out using the API and I can get all the information. The problem is that I can't post to their wall for some reason. I keep getting the following error:
error #2032: stream error. url: https://graph.facebook.com/********/feed
I use the following code to post to Facebook:
private function postFB(e:Event=null):void {
var _params:Object = new Object();
_params.uid = Facebook.getAuthResponse().uid;
_params.access_token = Facebook.getAuthResponse().accessToken;
_params.message = "I was at the Thanksgiving Day Event.";
//_params.picture = _bitmap;
Facebook.api("/me/feed", postComplete, _params, "POST");
}
As I've said before, I know I am connected to facebook because if I change "POST" to "GET" in my api-call, I get all the information of my account. I have the correct permissions as far as I know (read_stream, publish_stream, user_photos). I use GraphAPI_Web_1_8_1.swc as an api.
The documentation on the entire api is very poor, so I am trying to figure out the problem. It's been a few years since I've tried any of this, so my code has probably aged too far by now. So, any ideas what I'm doing wrong?
publish_stream is deprecated (since years?), you need to use publish_actions.
If that does not work, make sure the Access Token includes all the permissions, you can test this in the Debugger: https://developers.facebook.com/tools/debug/
Side note: AS3 is not getting used very often anymore, the last version of the the AS3 SDK is from 2011. It may be a good idea to switch to the JavaScript SDK.

Read Facebook Post

I am writing a web application using c#.net 4.0 to read post in a specific Facebook page.
E.g. http://www.facebook.com/pages/Public-Service-Association/164106710269112
I used Facebook C# SDK from http://github.com/facebook/csharp-sdk/
Please help me to read the posts using above SDK?
Thanks.
After you follow the tutorial, after you declare a JSON for your results, simple get their Profile Feed:
Facebook.FacebookAPI api = new Facebook.FacebookAPI(token); //place your access token
JSONObject result = api.Get(#"/nzpsa/feed");

Is there a way to insert an #mention into a Facebook status update posted with pyfacebook?

I have some code like the following in my application:
message = "Hi, #John Doe!"
postID = fb.stream.publish(
message = loader.render_to_string('wall_post.phtml', {'message':message}),
action_links = simplejson.dumps([{'text': "Check out blah", 'href': "http://blah.dev"}]),
target_id = 'nf'
)
Is there any way to represent a facebook #mention in the message string so that facebook converts it to a profile link for the mentioned user?
I've also been looking for an answer to this. The facebook website uses the format:
#[139730900025:PhotoGrabber] is awesome
to represent the links but I haven't been able to make that work. I re-posted a thread on the facebook forum under the "Stream" category since your post wasn't getting any attention:
http://forum.developers.facebook.com/viewtopic.php?id=47885
Mention it's partially available by open graph now. You can use only when posting an open graph ACTION
Check:
https://developers.facebook.com/docs/opengraph/mention_tagging/
It seems still impossible to use #mention tagging in classic feed posting via API
I'm pretty sure this is impossible at the moment. If it were posible by using the format that tam7t suggested it should work... Your best bet is asking them to add that to their api stream parser.
This is not possible at the moment, sorry.
AFAIK facebook's API does not allow this. The only approach that I know of at the moment would be to write a screen scraper to do these posts using the format described by tam7t's answer. If you use the mobile version of facebook's site (m.facebook.com) it makes it much easier.
NOTE: This might be a violation of Facebook's Application TOS.
Edit:
Here is some ruby code that will do the trick, using the Mechanize Gem
require 'mechanize'
agent = Mechanize.new
agent.user_agent_alias = 'Mac Safari'
page = agent.get('http://m.facebook.com')
form = page.forms.first
# enter credentials
form.pass = 'user password'
form.email = 'user#example.com'
page = agent.submit form
# go straight to page to post on
page = agent.get("http://m.facebook.com/wall.php?id=PAGE_ID_NUM")
form = page.forms.first
form.message = "#[139730900025:PhotoGrabber] is awesome"
page = agent.submit form
NOTE: Obviously (as tiagoboldt kindly pointed out) it would be wrong to store / utilise the credentials of other people in your application. This approach would only be appropriate for making posts from a facebook account that you controlled.
That said, back to the original question of putting an #mention in a wall post, I have noticed that whilst the post and #mention go up on the wall fine, this method does not propagate the post to the mentioned user/page's wall. Not sure if that is important to you.