Sha256: 7cb6695a19dcf225190309d6870c43358fd84bb1668e2c0919f338cc2a0a4189

Contents?: true

Size: 877 Bytes

Versions: 1

Compression:

Stored size: 877 Bytes

Contents

# encoding: utf-8
module Nokaya

  class ImageshackUser < Basic

    def initialize args, options
      super(args, options)
      @type = :imageshack
      parsed = self.parse(args[0])
      @image_url = album(parsed)
      @author = author()
      @path = "#{@path}/imageshack-#{@author}-#{@workers.timed}"
      @file_name = name()
    end

    private

    def author
      @args[0].split('/').last.chomp('/')
    end

    def album page
      refs = page.css('a.hero-wrapper')
      temp = refs.map {|li| "https://imageshack.com#{li['href']}"}
      puts Status.toresolve(temp.length)
      temp.map do |p|
        puts Status.resolving(p)
        ref = self.parse(p).css('figure.image img')
        "http:#{ref[0]['src']}"
      end
    end

    def name
      @image_url.map do |url|
        "#{@type.to_s}-#{@author}-#{File.basename(url)}"
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nokaya-0.1.1 lib/nokaya/imageshack_user.rb