Sha256: 50ed513644c71308c1a419e7a7b8b5c423c064d0af3917895174de05a257a882

Contents?: true

Size: 927 Bytes

Versions: 3

Compression:

Stored size: 927 Bytes

Contents

file_path = ARGV.shift
channel = ARGV.shift || 'default'
title = ARGV.shift || "Topublish uploaded at #{Time.now.strftime '%y-%m-%d-%H-%M'}"

abort "USAGE: upload.rb MP4-PATH [CHANNEL [TITLE]]"  unless
  file_path && ARGV.empty?

warn "Youtubbing '#{file_path}' with #{title}"

WE_URI = 'http://localhost'

require_relative 'google_youtube'

youtube = google_youtube(WE_URI, channel) do |auth_url|
  puts "Open the following URL in your browser and authorize the application."
  puts "(you'll have to copy the code= URL param when redrircted to #{WE_URI})"
  puts auth_url
  puts "Paste the authorization code."
  $stdin.gets.chomp
end

metadata  = {
  snippet: {
    title: title
  },
  status: {
    privacy_status: 'private'
  }
}

video =
  youtube.insert_video('snippet,status', metadata, upload_source: file_path, content_type: 'video/mp4')

if video.status.upload_status == 'uploaded'
  warn "OK"
else
  warn "FAIL"
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ffmprb-0.12.3 exp/youtubby/upload.rb
ffmprb-0.12.2 exp/youtubby/upload.rb
ffmprb-0.12.1 exp/youtubby/upload.rb