Sha256: 80eaeef49cbbaf267e190f2d3cc6aa0ce4576b6dae3a488aeb4b12e8ae5f715d

Contents?: true

Size: 653 Bytes

Versions: 4

Compression:

Stored size: 653 Bytes

Contents

# encoding: utf-8
module Nokaya

  class Photonet < Basic

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

    private

    def album page
      return [] if page.nil?
      refs = page.css('.trp-top a')
      refs.map do |lin|
        "http://gallery.photo.net/photo/#{lin['href'].split("=").last}-lg.jpg"
      end
    end

    def name_files
      @urls.map do |url|
        "#{@type.to_s}-#{File.basename(url).gsub('-lg', '')}"
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nokaya-0.1.6 lib/nokaya/photonet.rb
nokaya-0.1.5 lib/nokaya/photonet.rb
nokaya-0.1.4 lib/nokaya/photonet.rb
nokaya-0.1.3 lib/nokaya/photonet.rb