Sha256: feff752537702a687c9b74b4c49042378197f1201842d695235c55585f5369be

Contents?: true

Size: 697 Bytes

Versions: 2

Compression:

Stored size: 697 Bytes

Contents

# encoding: utf-8
module Nokaya

  class ImgurAlbum < Basic

    attr_reader :author

    def initialize args, options = {}
      super(args, options)
      @type = :imgur
      parsed = parse(args[0])
      @author = author_name(parsed)
      @urls = album(parsed)
      @path = "#{@path}/imgur-#{@author}-#{@workers.timed}"
      @filenames = name_files()
    end

    private

    def album page
      return [] if page.nil?
      refs = page.css('#imagelist .posts .post a')
      refs.map {|l| "http:#{l['href']}"}
    end

    def author_name page
      return [] if page.nil?
      res = page.css('.description')[0].children[1].children.text
      @workers.sanitize(res)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nokaya-0.1.6 lib/nokaya/imgur_album.rb
nokaya-0.1.5 lib/nokaya/imgur_album.rb