Class: YoutubeAudio::Decipher

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

Constant Summary collapse

URL =
'https://www.youtube.com'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(script_player_url) ⇒ Decipher

Returns a new instance of Decipher.



8
9
10
# File 'lib/youtube_audio/decipher.rb', line 8

def initialize(script_player_url)
  @script_player_url = script_player_url
end

Instance Attribute Details

#script_player_urlObject (readonly)

Returns the value of attribute script_player_url.



5
6
7
# File 'lib/youtube_audio/decipher.rb', line 5

def script_player_url
  @script_player_url
end

Instance Method Details

#decipher(cipher) ⇒ Object

Parameters:

  • cipher (string)

    youtube signature



13
14
15
16
17
18
19
20
# File 'lib/youtube_audio/decipher.rb', line 13

def decipher(cipher)
  klass = extract_decode_function_handler
  miniracer_klass = miniracer_context

  miniracer_klass.eval(klass.cipher_helpers_object)
  miniracer_klass.eval("var #{klass.decipher_function}")
  miniracer_klass.eval("#{klass.decryption_function}('#{cipher}')")
end