Sha256: 29ea78e7d91db7305c750b0988b847576d14e9f54ae65e6635f3419440d7c693

Contents?: true

Size: 718 Bytes

Versions: 2

Compression:

Stored size: 718 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()
      @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
      /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.4 lib/nokaya/flickr_album.rb
nokaya-0.1.3 lib/nokaya/flickr_album.rb