Sha256: aba206cda6d0bbde4d60856b24f2e85ba77bc3c5e5352232b9f7b851f9566284

Contents?: true

Size: 728 Bytes

Versions: 2

Compression:

Stored size: 728 Bytes

Contents

# encoding: utf-8
module Nokaya

  class FlickrAlbum < Basic

    attr_reader :author

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

    private

    def title page
      @workers.sanitize(page.css('.set-title')[0].text) unless page.nil?
    end

    def album page
      return [] if page.nil?
      refs = page.css('.pc_img')
      refs.map {|l| l['data-defer-src']}
    end

    def author_name
      /photos\/\w+/.match(@args[0]).to_s.split('/')[1]
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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