class SoundcloudPlugin

SitePlugin for Soundcloud

Need an client ID (soundcloud_client_id).

Public Class Methods

can_handle?(site) click to toggle source
# File plugins/soundcloud_plugin.rb, line 11
def self.can_handle?(site) 
    site =~ %r^https?:\/\/(www\.)?soundcloud\.com\/[a-zA-Z0-9\/_-]+$/
end
new(options) click to toggle source
# File plugins/soundcloud_plugin.rb, line 16
def initialize(options)
    @client = Soundcloud.new(:client_id => options[:soundcloud_client_id])
end

Public Instance Methods

get(url) click to toggle source
# File plugins/soundcloud_plugin.rb, line 20
def get(url)
    track = @client.get('/resolve', :url => url)
    url.gsub(%rhttp:\/\//, 'https://')

    {:title => track.title, :author => track.user.username, :url => url}
end