Class: VkMusic::WebParser::Playlist

Inherits:
Base
  • Object
show all
Defined in:
lib/vk_music/web_parser/playlist.rb

Overview

Playlist mobile web page parser

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from VkMusic::WebParser::Base

Instance Method Details

#audiosArray<Audio>

Returns:



8
9
10
# File 'lib/vk_music/web_parser/playlist.rb', line 8

def audios
  Utility::AudioItemsParser.call(node, @client_id)
end

#real_sizeInteger?

Returns:

  • (Integer?)


26
27
28
29
30
# File 'lib/vk_music/web_parser/playlist.rb', line 26

def real_size
  content = node.at_css('.audioPlaylist__footer').content
  matches = content.gsub(/\s/, '').match(/^(\d+)/)&.captures
  matches ? Integer(matches.first, 10) : nil
end

#subtitleString?

Returns:

  • (String?)


18
19
20
21
22
23
# File 'lib/vk_music/web_parser/playlist.rb', line 18

def subtitle
  result = node.at_css('.audioPlaylist__subtitle').content.strip
  return if result.nil? || result.empty?

  result
end

#titleString

Returns:

  • (String)


13
14
15
# File 'lib/vk_music/web_parser/playlist.rb', line 13

def title
  node.at_css('.audioPlaylist__title').content.strip
end