class Nokaya::ImageshackUser

Public Class Methods

new(args, options = {}) click to toggle source
Calls superclass method Nokaya::Basic::new
# File lib/nokaya/imageshack_user.rb, line 6
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 Instance Methods

album(page) click to toggle source
# File lib/nokaya/imageshack_user.rb, line 22
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
author_name() click to toggle source
# File lib/nokaya/imageshack_user.rb, line 18
def author_name
  @args[0].split('/').last.chomp('/')
end