module VkMusic::Utility::LastProfilePostLoader
Get user or group id from url
Constants
- VK_PATH
vk.com url regex
Public Class Methods
call(agent, url: nil, owner_id: nil)
click to toggle source
@param agent [Mechanize] @param url [String] URL to profile page @return [Array(owner_id?, post_id?)]
# File lib/vk_music/utility/last_profile_post_loader.rb, line 16 def self.call(agent, url: nil, owner_id: nil) path = url&.match(VK_PATH)&.captures&.first request = VkMusic::Request::Profile.new(profile_id: owner_id, profile_custom_path: path) request.call(agent) [request.id, request.last_post_id] rescue Mechanize::ResponseCodeError [nil, nil] end