Class: YoutubeAudio::PlayerResponse
- Inherits:
-
Object
- Object
- YoutubeAudio::PlayerResponse
- Defined in:
- lib/youtube_audio/player_response.rb
Instance Attribute Summary collapse
-
#script_player_url ⇒ Object
readonly
Returns the value of attribute script_player_url.
Instance Method Summary collapse
- #formats ⇒ Object
-
#initialize(response_raw, script_player_url: nil) ⇒ PlayerResponse
constructor
A new instance of PlayerResponse.
- #to_youtube_format(format_raw) ⇒ Object
Constructor Details
#initialize(response_raw, script_player_url: nil) ⇒ PlayerResponse
Returns a new instance of PlayerResponse.
8 9 10 11 |
# 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 |
Instance Attribute Details
#script_player_url ⇒ Object (readonly)
Returns the value of attribute script_player_url.
5 6 7 |
# File 'lib/youtube_audio/player_response.rb', line 5 def script_player_url @script_player_url end |
Instance Method Details
#formats ⇒ Object
13 14 15 16 17 |
# 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 |