Module: VkMusic::Utility::AudioItemsParser

Defined in:
lib/vk_music/utility/audio_items_parser.rb

Overview

Parse Audio from Nokogiri::XML::Node

Class Method Summary collapse

Class Method Details

.call(node, client_id) ⇒ Array<Audio>

Parameters:

  • node (Nokogiri::XML::Node)
  • client_id (Integer)

Returns:



10
11
12
13
14
15
# File 'lib/vk_music/utility/audio_items_parser.rb', line 10

def self.call(node, client_id)
  node.css('.audio_item.ai_has_btn,.audio_item.audio_item_disabled').map do |elem|
    data = JSON.parse(elem.attribute('data-audio').value)
    Utility::AudioDataParser.call(data, client_id)
  end
end