class YoutubeAudio::ExtractDecodeFunction

Constants

CIPHER_TEST

Attributes

player_script[R]

Public Class Methods

new(player_script) click to toggle source
# File lib/youtube_audio/extract_decode_function.rb, line 8
def initialize(player_script)
  @player_script = player_script
end

Public Instance Methods

cipher_helper_object_name() click to toggle source
# File lib/youtube_audio/extract_decode_function.rb, line 12
def cipher_helper_object_name
  @cipher_helper_object_name ||=
    decipher_function.scan(/\;([a-zA-Z0-9]{0,255})\./).flatten.first
end
cipher_helpers_object() click to toggle source
# File lib/youtube_audio/extract_decode_function.rb, line 17
def cipher_helpers_object
  object_decibper_index = player_script.index("var #{cipher_helper_object_name}={")
  object_decibper_index_end = player_script[object_decibper_index..-1].index('};')
  player_script[object_decibper_index..object_decibper_index + object_decibper_index_end]
end
decipher_function() click to toggle source
# File lib/youtube_audio/extract_decode_function.rb, line 23
def decipher_function
  @decipher_function ||=
    player_script.scan(Regexp.new(function_pattern)).flatten.first
end
decryption_function() click to toggle source
# File lib/youtube_audio/extract_decode_function.rb, line 28
def decryption_function
  @decryption_function ||= player_script.scan(CIPHER_TEST).flatten.first
end

Private Instance Methods

function_pattern() click to toggle source
# File lib/youtube_audio/extract_decode_function.rb, line 34
def function_pattern
  @function_pattern ||=
    '(' + decryption_function + '=function\\([a-zA-Z0-9_]+\\)\\{.+?\\})'
end