lib/popularity/networks/soundcloud.rb in popularity-0.1.1 vs lib/popularity/networks/soundcloud.rb in popularity-0.2.1
- old
+ new
@@ -1,7 +1,9 @@
module Popularity
class Soundcloud < Crawler
+ stats :plays, :likes, :comments, :downloads
+
def plays
response.scan(/\"soundcloud:play_count\" content=\"([0-9]*)\"/).flatten.first.to_f.to_i
end
def likes
@@ -14,21 +16,10 @@
def downloads
response.scan(/\"soundcloud:download_count\" content=\"([0-9]*)\"/).flatten.first.to_f.to_i
end
- def as_json(options = {})
- {"plays" => plays,
- "likes" => likes,
- "comments" => comments,
- "downloads" => downloads }
- end
-
- def total
- plays + likes + downloads + comments
- end
-
def valid?
host == 'soundcloud.com'
end
protected
@@ -39,6 +30,6 @@
def request_url
@url
end
end
-end
\ No newline at end of file
+end