Skip to content

canhlinh/go-fbvideo

Repository files navigation

go-fbvideo

A small lib to help me upload video to a facebook resource (user, page, group, event)

GoDoc

Example:

package main

import (
	"fmt"
	"log"

	"github.com/canhlinh/go-fbvideo"
)

func main() {
	// You have to export your acess token to FB_ACCESS_TOKEN variable
	// run command: export FB_ACCESS_TOKEN="Your access token"
	accessToken := fbvideo.GetAccessToken()
	me, err := fbvideo.GetMe(accessToken)
	if err != nil {
		panic(err)
	}
	meID := me["id"].(string)

	uploadSession := fbvideo.NewUploadSession("../testdata/SampleVideo_720x480_10mb.mp4", meID, accessToken)

	// Uploads the video to your wall, only you can see it
	option := fbvideo.Option{Privacy: &fbvideo.Privacy{Value: fbvideo.PrivacySelf}}
	videoID, err := uploadSession.Upload(option)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("video_id %s", videoID)
}

About

A simple library upload video to FACEBOOK

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages