Sha256: b9597a5cce81d64100e4813d0c2d43e292c7b9921d105599f380852cf59b07ab

Contents?: true

Size: 804 Bytes

Versions: 1

Compression:

Stored size: 804 Bytes

Contents

# encoding: utf-8
module Nokaya

  class ADN < Basic

    attr_reader :author

    def initialize args, options = {}
      super(args, options)
      url = if options[:post]
              "https://photos.app.net/#{args[0]}/1"
            else
              args[0]
            end
      @type = :adn
      parsed = parse(url)
      @urls = [get_basic(parsed)].compact
      @author = author_name(parsed)
      @filenames = name_files()
    end

    private

    def author_name page
      page.css('.p-nickname')[0].text unless page.nil?
    end

    def post_id args
      /\d+{2}/.match(args[0])
    end

    def name_files
      unless @urls.empty?
        @name ||= @workers.sanitize(@author)
        ["#{@type.to_s}-#{@name}-#{post_id(args)}.jpg"]
      else
        []
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nokaya-0.1.6 lib/nokaya/adn.rb