Sha256: b587f92654f0e54ff9a8437bf6a4392a251fa319d9bb8efefc83c36f909ea029

Contents?: true

Size: 520 Bytes

Versions: 2

Compression:

Stored size: 520 Bytes

Contents

require 'nokogiri'
module Stars
  class Favstar
    include HTTParty
    base_uri 'favstar.fm'

    def recent(username)
      self.class.get("/users/#{username}/rss",
                      :format => :xml)['rss']['channel']['item']
    end
    
    def show(url)
      # hardcode 17 to strip favstar domain for now
      html = self.class.get(url[17..200], :format => :html)
      Nokogiri::HTML(html).css('.avatarList img').collect do |img|
        "    ★  #{img.attributes['alt'].value}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stars-0.2.1 lib/stars/favstar.rb
stars-0.2.0 lib/stars/favstar.rb