class YoutubeAudio::PlayerResponse
Attributes
script_player_url[R]
Public Class Methods
new(response_raw, script_player_url: nil)
click to toggle source
@response_raw url [Hash]
# File lib/youtube_audio/player_response.rb, line 8 def initialize(response_raw, script_player_url: nil) @response_raw = response_raw @script_player_url = script_player_url end
Public Instance Methods
formats()
click to toggle source
# File lib/youtube_audio/player_response.rb, line 13 def formats (@response_raw&.dig('streamingData', 'adaptiveFormats') || []).map do |f| to_youtube_format(f) end end
to_youtube_format(format_raw)
click to toggle source
# File lib/youtube_audio/player_response.rb, line 19 def to_youtube_format(format_raw) Format.new(format_raw, script_player_url: script_player_url) end