Sha256: b5cdcb0bb9f0163be2ff132fc8b1cb24b4b3dd117efd35b4f3d3361977430b34

Contents?: true

Size: 687 Bytes

Versions: 2

Compression:

Stored size: 687 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(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 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.4 lib/nokaya/imgur_album.rb
nokaya-0.1.3 lib/nokaya/imgur_album.rb