class VkMusic::WebParser::Profile
Profile
page parser
Constants
- BASIS_LINK_SELECTOR
CSS selector for link in basis
- ID_CONTAINING_HREF
Regex for href which contains id of profile
- POST_ANCHOR_NAME_REGEX
Regex for ID of .wall_item anchor
Public Instance Methods
id()
click to toggle source
Profile
id
# File lib/vk_music/web_parser/profile.rb, line 20 def id link = node.link_with(href: ID_CONTAINING_HREF, css: BASIS_LINK_SELECTOR) return unless link Integer(link.href.match(ID_CONTAINING_HREF).captures.first, 10) end
last_post_id()
click to toggle source
Last post ID
# File lib/vk_music/web_parser/profile.rb, line 28 def last_post_id ids = node.css('.wall_posts .wall_item').map do |el| str = el.at_css('.post__anchor')&.attr('name')&.match(POST_ANCHOR_NAME_REGEX)&.captures&.last str ? Integer(str, 10) : nil end ids.compact.max end