Sha256: 6d2985daf4feb6fb99b7651570a4ca4b261a8c200f7f14f2cac4d1300dd3e595

Contents?: true

Size: 724 Bytes

Versions: 1

Compression:

Stored size: 724 Bytes

Contents

module Dramavladimir
  class Announce
    attr_accessor :doc, :url

    def initialize(url, attributes = {})
      @url = url
    end

    def content
      doc.css('#main-mid p').map { |c| c.inner_text }.join('<br />').gsub(/\n|\t/, '').sub(/title=.JoomlaWorks AllVideos Player.>/, '')
    end

    def video
      return if doc.css('.avPlayerWrapper.avVideo').empty?
      doc.at_css('.avPlayerWrapper.avVideo iframe').attribute('src').value
    end

    def images
      return if doc.nil? || doc.css('.rokbox-album-inner').empty?
      doc.css('.rokbox-album-inner a').map { |image| "#{@site}#{image.attribute('href').value}" }
    end

    private

    def doc
      @doc ||= Dramavladimir.parse(url)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dramavladimir-0.1.1 lib/dramavladimir/announce.rb