Sha256: ccfcc51361e2dbe8cf52ff12182355bc6d53e6a90d2a7eb3e942dee081cbf853

Contents?: true

Size: 845 Bytes

Versions: 2

Compression:

Stored size: 845 Bytes

Contents

# encoding: utf-8
module Nokaya

  class ImageshackUser < Basic

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

    private

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

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

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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