为什么 facebook api-video 连接超时?

发布于 2024-09-16 18:39:53 字数 1521 浏览 2 评论 0原文

这是我尝试的 API 调用:

http://developers.facebook.com/ docs/reference/rest/video.upload

(视频上传在新的 Graph API 中不可用。)

我尝试了参数的多种变体。下面的代码是我最好的猜测。如果我将参数修改为明显不正确,更改为 http(而不是 https)或尝试使用 api.facebook.com 进行视频,我会收到正确的错误。

然而,我下面的代码在报告之前只等待几分钟:

ETIMEDOUT:连接超时

还包括上传照片的工作代码 - 几乎相同。

Ruby:

# Facebook Old-API method - testing only - this works.
def post_photo
  url = "https://api.facebook.com/method/photos.upload"
  body = {
    nil => File.new(self.media.media_files.first.source_file, 'rb'),
    :access_token => self.session.auth_data[:access_token],
    :callback => "none",
    :aid => "Test Photos",
    :caption => "Test",
    :uid => self.session.auth_data[:uid],
  }
  response = RestClient.post url, body
end

# Facebook Old-API method - doesn't work - connection timeout.
def post_video
  url = "https://api-video.facebook.com/method/video.upload"
  body = {
    :nil => File.new(self.media.media_files.first.source_file, 'rb'),
    :access_token => self.session.auth_data[:access_token],
    :callback => "none",
    :title => "Test title",
    :description => "Test description",
    :privacy => "{ value: 'EVERYONE' }",
    :uid => self.session.auth_data[:uid],
  }
  response = RestClient.post url, body
end

PS:我在澳大利亚 - API 是否仅限于美国等?

谢谢

This is the API call Im attempting:

http://developers.facebook.com/docs/reference/rest/video.upload

(Video upload is not available in the new Graph API.)

I have tried many variations on the parameters. The code below is my best guess. If I modify the params to be obviously incorrect, change to http (not https) or try to use api.facebook.com for video, I get proper errors back.

However, my code below just waits a few minutes before reporting:

ETIMEDOUT: Connection timed out

Also included is working code to upload a photo - which is almost identical.

Ruby:

# Facebook Old-API method - testing only - this works.
def post_photo
  url = "https://api.facebook.com/method/photos.upload"
  body = {
    nil => File.new(self.media.media_files.first.source_file, 'rb'),
    :access_token => self.session.auth_data[:access_token],
    :callback => "none",
    :aid => "Test Photos",
    :caption => "Test",
    :uid => self.session.auth_data[:uid],
  }
  response = RestClient.post url, body
end

# Facebook Old-API method - doesn't work - connection timeout.
def post_video
  url = "https://api-video.facebook.com/method/video.upload"
  body = {
    :nil => File.new(self.media.media_files.first.source_file, 'rb'),
    :access_token => self.session.auth_data[:access_token],
    :callback => "none",
    :title => "Test title",
    :description => "Test description",
    :privacy => "{ value: 'EVERYONE' }",
    :uid => self.session.auth_data[:uid],
  }
  response = RestClient.post url, body
end

PS: Im in Australia - is the API limited to eg the USA?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文