Module: VkMusic::Utility::PlaylistNodeParser

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

Overview

Read inner of text-childrens of Nokogiri::XML::Node node

Class Method Summary collapse

Class Method Details

.call(node) ⇒ Playlist

Parameters:

  • node (Nokogiri::XML::Node)

Returns:



9
10
11
12
13
14
15
16
17
18
# File 'lib/vk_music/utility/playlist_node_parser.rb', line 9

def self.call(node)
  url = node.at_css('.audioPlaylists__itemLink').attribute('href').value
  owner_id, id, access_hash = PlaylistUrlParser.call(url)

  Playlist.new([],
               id: id, owner_id: owner_id, access_hash: access_hash,
               title: node.at_css('.audioPlaylists__itemTitle').content,
               subtitle: node.at_css('.audioPlaylists__itemSubtitle').content,
               real_size: nil)
end