Class: HeySpread::YouClone

Inherits:
Object
  • Object
show all
Defined in:
lib/heyspread.rb

Overview

Export videos from a YouTube account to any other video sites

Export all the Youtube videos of a given account to Dailymotion:

export = YouClone.new
export. = ["login", "password"]
export.destinations["dailymotion"] = ["login", "password"]
export.save

If you don’t set the destinations, you’ll use your saved Credentials

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(destinations = {}) ⇒ YouClone

Set the destinations (including YouTube)

export = YouClone.new(
  "youtube" => ["login", "password"],
  "dailymotion" => ["login", "password"]
)


428
429
430
# File 'lib/heyspread.rb', line 428

def initialize(destinations={})
	@destinations = destinations
end

Instance Attribute Details

#destinationsObject

Returns the value of attribute destinations.



420
421
422
# File 'lib/heyspread.rb', line 420

def destinations
  @destinations
end

Instance Method Details

#saveObject

Export the videos of a YouTube account to any other video sites



440
441
442
443
444
445
446
447
448
449
450
451
# File 'lib/heyspread.rb', line 440

def save
	credentials = {}
    if @destinations
      @destinations.each_pair do |site, c| 
        credentials.merge!(site => "#{c[0]}:#{c[1]}")
      end
    end
	
	HTTP.post("/youclone", credentials)
	
	true
end

#youtube_account=(credentials = []) ⇒ Object

Set the YouTube account

export. = ["login", "password"]


435
436
437
# File 'lib/heyspread.rb', line 435

def youtube_account=(credentials=[])
	@destinations["youtube"] = credentials
end