Class: Popularity::Soundcloud

Inherits:
Crawler
  • Object
show all
Defined in:
lib/popularity/networks/soundcloud.rb

Instance Attribute Summary

Attributes inherited from Crawler

#url

Instance Method Summary collapse

Methods inherited from Crawler

#as_json, #async_done?, #fetch, #fetch_async, #has_response?, #host, #initialize, #name, property_names, #response, stats, #total

Constructor Details

This class inherits a constructor from Popularity::Crawler

Instance Method Details

#commentsObject



13
14
15
# File 'lib/popularity/networks/soundcloud.rb', line 13

def comments
  response.scan(/\"soundcloud:comments_count\" content=\"([0-9]*)\"/).flatten.first.to_f.to_i
end

#downloadsObject



17
18
19
# File 'lib/popularity/networks/soundcloud.rb', line 17

def downloads
  response.scan(/\"soundcloud:download_count\" content=\"([0-9]*)\"/).flatten.first.to_f.to_i
end

#likesObject



9
10
11
# File 'lib/popularity/networks/soundcloud.rb', line 9

def likes
  response.scan(/\"soundcloud:like_count\" content=\"([0-9]*)\"/).flatten.first.to_f.to_i
end

#playsObject



5
6
7
# File 'lib/popularity/networks/soundcloud.rb', line 5

def plays
  response.scan(/\"soundcloud:play_count\" content=\"([0-9]*)\"/).flatten.first.to_f.to_i
end

#valid?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/popularity/networks/soundcloud.rb', line 21

def valid?
  host == 'soundcloud.com'
end