https://github.com/mrdotb/facebook-api-video-upload
:ok_hand: A handy function to upload video in chunk on the facebook graph.
https://github.com/mrdotb/facebook-api-video-upload
facebook-api upload-videos
Last synced: 6 months ago
JSON representation
:ok_hand: A handy function to upload video in chunk on the facebook graph.
- Host: GitHub
- URL: https://github.com/mrdotb/facebook-api-video-upload
- Owner: mrdotb
- License: mit
- Created: 2016-06-05T01:25:17.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-09-03T11:29:27.000Z (over 1 year ago)
- Last Synced: 2024-12-16T04:08:26.545Z (6 months ago)
- Topics: facebook-api, upload-videos
- Language: JavaScript
- Homepage:
- Size: 22.2 MB
- Stars: 56
- Watchers: 3
- Forks: 23
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license
Awesome Lists containing this project
README
# facebook-api-video-upload
> Upload a video in chunk on the facebook api. [more info](https://developers.facebook.com/docs/graph-api/video-uploads)## Install
```
$ npm i facebook-api-video-upload --save
```
Tested on OS X and Linux.## Usage
```javascript
const fs = require('fs');
const fbUpload = require('facebook-api-video-upload');const args = {
token: "YOURTOKEN", // with the permission to upload
id: "YOURID", //The id represent {page_id || group_id}
stream: fs.createReadStream('./fixture.mp4'), //path to the video,
title: "my video",
description: "my description",
thumb: {
value: fs.createReadStream('./fixture.jpg'),
options: {
filename: 'fixture.jpg',
contentType: 'image/jpg'
}
}
// if you want the default thumb from the video just remove the field
// you can add any extra fields from the api https://developers.facebook.com/docs/graph-api/reference/page/videos/#Creating
// all keys except token, id, stream are passed to the final request
};fbUpload(args).then((res) => {
console.log('res: ', res);
//res: { success: true, video_id: '1838312909759132' }
}).catch((e) => {
console.error(e);
});
```## Note
The Video API allows you to publish Videos on Pages and Groups. Publishing on Users is not supported. [Read more](https://developers.facebook.com/docs/video-api/guides/publishing)## License
MIT © [MrdotB](https://github.com/MRdotB)