这是我尝试的API调用:
http://developers.facebook.com/docs/reference/rest/video.upload
(新的图谱API中没有视频上传功能。)
我尝试了很多参数。下面的代码是我最好的猜测。如果我修改params显然不正确,更改为http(而不是https)或尝试使用api.facebook.com进行视频,我会收到正确的错误。
但是,我的代码只是在报告之前等了几分钟:
ETIMEDOUT:连接超时
还包括用于上传照片的工作代码 - 几乎完全相同。
红宝石:
# 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是否仅限于美国?
由于