Electron Desktop app to upload Video to Facebook Page - facebook

Hi I need help with implementing a very simple Electron App, which has a very basic input form
for title, description and select file.
Then a user selects upload and it should upload the small video (35 mb) into my fb page.
I've tried using the FB api SDK, but it's not clear how you set it up. I even tried the unofficial npm package facebook-api-video-upload and that didn't work at all.
Now, I've been successful with executing a cURL call on terminal and having the video upload perfectly,
It looked something like this:
cURL -X POST "https://graph-video.facebook.com/....." -F "access_token=...." -F "....=#video.mp4"
So I tried executing this command via my electron app, and the only method that got a response was executing via a XMLHttpRequest(). But the problem is, the response my app gets is that the video is too large?? I've even tried uploading the same exact video.
Btw I wish to do this via JS/electron on desktop, don't want to set up server and use FB php's script.
Any help much appreciated.
(anonymous) # mainWindow.html:239
mainWindow.html:236 {
"error": {
"message": "There was a problem uploading your video file. Please try again.",
"type": "OAuthException",
"code": 390,
"error_subcode": 1363030,
"is_transient": true,
"error_user_title": "Video Upload Time Out",
"error_user_msg": "Your video upload timed out before it could be completed. This is probably because of a slow network connection or because the video you're trying to upload is too large. Please try again.",
"fbtrace_id": "..."
}
}

Related

What is https://i.instagram.com/api/v1

I am digging into Instagram APIs and find out a URL https://i.instagram.com/api/v1 which used by many git repos(some are recently updated) but when I go to Instagram there is no such url available there. Can anyone guide me what is the use of this url and how I can use it because when I hit
https://i.instagram.com/api/v1/accounts/login/
by POSTMAN i got below message
{
"message": "Your version of Instagram is out of date. Please upgrade your app to log in to Instagram.",
"status": "fail",
"error_type": "needs_upgrade"
}
One more thing. I am with my friend who work in android he has done reverse engineering on a app which use for increase followers and that app is also using same endpoints and working on that app.
It's November 2021, and somehow the API https://i.instagram.com/api/v1 still works, but I believe they have changed the way you use it.
NOTE: The given information is just for educational purposes
Let's take the user/{user_id}/info endpoint of this API, which returns basic information about the user_id.
The URL with this endpoint would be
https://i.instagram.com/api/v1/users/176702683/info/
If you paste this link into your browser you'll get the following message
{"message":"useragent mismatch","status":"fail"}
This means that API must be called via mobile user-agent. read more about user-agent here
We can solve this problem by providing a mobile user-agent string.
Using python requests library
!pip install requests
import requests
URL = https://i.instagram.com/api/v1/users/176702683/info/
headers = {'User-Agent':'Instagram 76.0.0.15.395 Android (24/7.0; 640dpi; 1440x2560; samsung; SM-G930F; herolte; samsungexynos8890; en_US; 138226743)'}
# samsung mobile user-agent
response = requests.get(url, headers=headers)
print(response.json())
Output:
{
"user": {
"username": "marcelotwelve",
"pk": 176702683,
"profile_pic_url": "https://instagram.fzrh3-1.fna.fbcdn.net/v/t51.2885-19/233796637_544571223333074_8761964745157634211_n.jpg?stp=dst-jpg_s150x150\\u0026_nc_ht=instagram.fzrh3-1.fna.fbcdn.net\\u0026_nc_cat=1\\u0026_nc_ohc=Cfk2kHCxgbIAX_vgNjn\\u0026edm=AEF8tYYBAAAA\\u0026ccb=7-5\\u0026oh=00_AT-tuXbAbsIkvmJqm_akQS__UPDtEXZxZChx2lO-9Wb0FQ\\u0026oe=62A8115E\\u0026_nc_sid=a9513d"
},
"status": "ok"
}
NOTE: Please be aware of how you use it
It is actually an API, that you can only use from your phone application, thats why it say it needs upgrade. you can download an addon for chrome / firefox to switch user agents, and after that you will be able to see the content.
It's worth checking there is lots of info about any user on insa
this response is a default error caused by having no cookie set
inspect instagram, you can see a redirect first (this way they fill initial cookies set for you). copy paste it to postman and try again

How to get high quality video source url for videos uploaded on facebook public page using graph api V2.1

I am trying to get high quality video source url for videos uploaded on public page by admin and normal users.
By using graph api v2.1 I can get all videos uploaded on this page by using
https://graph.facebook.com/v2.1/547830001966077/feed
But when I try to get details of each video by using following method, sometimes it gives error and sometime it works,
For E.g.
v2.1/817476674942956 => Working
But for shared story
v2.1/10201407437548351 => Not working
Error Details:
{
"error": {
"message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100
}
}
If we load this video in browser, its showing HD option at bottom,
https://www.facebook.com/photo.php?v=10201407437548351
So I would like to know is there any way to get high quality source url for videos for all users from a public page.
Thank you.

Facebook returning a 206 response only from a determined server

I'm trying to post a feed using Facebook javascript API (FB.ui). When I post the feed, the image field appears empty.
Of course I've tried the URL from the example provided by facebook http://www.fbrell.com/f8.jpg and it works fine. Then I downloaded this image and uploaded to my server and tried again and got nothing.
Using the facebook debugger, the facebook example image returns a 200 message, and the same image from my server returns a 206 message, which I believe is the reason why it's not showing in the feed dialog.
This is the Graph API output from debugger:
{
"id": "530885910309390",
"url": "http://www.zx-works.com/img/f8.jpg",
"type": "website",
"title": "http://www.zx-works.com/img/f8.jpg",
"updated_time": "2013-06-01T18:48:22+0000",
"created_time": "2013-06-01T18:23:58+0000",
"is_scraped": true
}
Question is: what can possibly change from one server to another to facebook not get the image correctly? Is something I can do to fix it from my server side? It's running Apache 2.2.24. Someone runned into this problem before?
Facebook uses ipv6 to scrap your website. Is your DNS set to ipv6? Did your server controlpanel (like directadmin) allow ipv6 access?
Otherwise, contact your hosting company to answer these questions and you'll be fine!

Error with Twitter link

Yesterday I started a new app on Facebook. Today I got the message that when people copy the link to Twitter they get an error. This is what you get:
{
"error": {
"message": "Unknown path components: /your_namespace:your_action",
"type": "OAuthException",
"code": 2500
}
}
What does this mean? What could be the problem?
Are you actually sending the POST action link to Twitter? Why?
I think you misunderstood how Open Graph works. Basically, you should be the one publishing actions when users take an action using your service. You can use a server-side or a client-side language to POST request (when you click a link, your browser actually makes a GET request, not a POST) to https://graph.facebook.com/me/namespace:action?access_token=ACCESS_TOKEN&OBJECT_PATH=OBJECT_URL
Note that you need to create an app, use it to authenticate users to get the access token and also set your custom actions / objects. These will need to be approved before you can actually use them.
You should start by taking a look at the sample apps to see how they work: https://developers.facebook.com/docs/samples/

"message": "Invalid redirect_uri:"

So a few months ago my facebook app worked, and now I get a:
{ "error": { "type": "OAuthException", "message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration." }
So I googled about that, and read that the cause might be that I didn't specify a site domain in the app settings. So I did that, but Facebook told me that this won't work unless I also specified a website or mobile device adress. But up to now I had this just set as App and neither Website nor mobile thingy. So now I also have to check "website" in addition to "application?" This is confusing.
Anyway, so I thought "whatever" and set it also as website in the app settings. But I still get the same error.
I read something about a channel file? So I have to create one of those or something?
I'm lost and thankful for any advice.
This error is almost always when you're trying to redirect the user to a URL other than your app or website, check that you're actually redirecting them to the correct place