Upload videos to youtube using the YouTube data API. Broken Pipe (Errno :: EPIPE)

I am trying to upload a local video file to my youtube account using youtube api data.

Example: https://github.com/youtube/api-samples/blob/master/ruby/upload_video.rb

Call:

$ ruby upload_video.rb --file video.mp4 

I get an error message:

/Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/openssl/buffering.rb:326:in `syswrite': Broken pipe (Errno::EPIPE)
from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/openssl/buffering.rb:326:in `do_write'
from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/openssl/buffering.rb:344:in `write'
from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/http/generic_request.rb:202:in `copy_stream'
from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/http/generic_request.rb:202:in `send_request_with_body_stream'
from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/http/generic_request.rb:132:in `exec'
...
from upload_video.rb:73:in `main'
from upload_video.rb:91:in `<main>'

upload_video.rb (line 73):

videos_insert_response = client.execute!(
  :api_method => youtube.videos.insert,
  :body_object => body,
  :media => Google::APIClient::UploadIO.new(opts[:file], 'video/*'),
  :parameters => {
    :uploadType => 'resumable',
    :part => body.keys.join(',')
  }
)
+4
source share
1 answer

Google-api- , HTTP-: Net:: HTTP. , . - . httpclient, . - whatever.rb( , google):

Faraday.default_adapter = :httpclient

HTTP- : https://github.com/lostisland/faraday#faraday

+10

Source: https://habr.com/ru/post/1544443/


All Articles