Sha256: a35764fb522b8427aef01f2a1abf7cf85650cc89b954c7e7ac342c3b6c00d431
Contents?: true
Size: 721 Bytes
Versions: 2
Compression:
Stored size: 721 Bytes
Contents
module Popularity class RedditShare < Crawler include Popularity::ContainerMethods stats :comments, :score, :posts def initialize(*args) super(*args) posts_json = response_json["data"]["children"] posts_json.each do |child| new_json = response_json.clone new_json["data"]["children"] = [child] url = "http://reddit.com#{child["data"]["permalink"]}" post = RedditResult.new(url, JSON.dump([new_json])) self.add_result(post) end self end def posts @results.size rescue 0 end def name "reddit" end def request_url "http://www.reddit.com/r/search/search.json?q=url:#{@url}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
popularity-0.3.0 | lib/popularity/networks/reddit_share.rb |
popularity-0.2.1 | lib/popularity/networks/reddit_share.rb |