B
B
bernaud2017-11-14 23:25:29
PHP
bernaud, 2017-11-14 23:25:29

facebook api. Is it possible to download video from youtube link?

In general, the result should be uploading a video to Facebook hosting.
The code that gives the error "Graph returned an error: Sorry, the video file you selected is in a format that we don't support."

$video = 'https://youtu.be/видос';

$data = [
  'title' => 'тайтл',
  'description' => 'дискрипшн',
  'source' => $fb->videoToUpload($video),
];

try {
  $response = $fb->post('/айди группы/videos', $data);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  // When Graph returns an error
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  // When validation fails or other local issues
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}

$graphNode = $response->getGraphNode();
var_dump($graphNode);

echo 'Video ID: ' . $graphNode['id'];

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Philipp, 2017-11-14
@bernaud

No. It won't work. Either download a video from Youtube and make a full-fledged applause or just share a link with a video.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question