Sha256: dc659c97c85efcee296d1095ee2647584557c8e144a3fd0703096b91cb78e32a

Contents?: true

Size: 876 Bytes

Versions: 7

Compression:

Stored size: 876 Bytes

Contents

require 'yt/video_audit/base'

module Yt
  module VideoAudit
    # Count how many subject videos have any end card. An end card
    # can be described as an annotation, not an info card, with a link in it,
    # at the end of video, stays for more than 5 seconds.
    class EndCard < Base
      def title
        'Possible End Card Annotations'
      end

      def description
        'The number of videos with a link annotation'\
        ' longer than 5 seconds, not an info card, at the end of its duration'
      end

    private

      def valid?(video)
        Yt::Annotations.for(video.id).any? do |annotation|
          !annotation.is_a?(Yt::Annotations::Card) && annotation.link &&
            (annotation.ends_at.floor..annotation.ends_at.ceil).include?(video.seconds) &&
            video.seconds - annotation.starts_at > 5
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
yt-audit-0.6.0 lib/yt/video_audit/end_card.rb
yt-audit-0.5.5 lib/yt/video_audit/end_card.rb
yt-audit-0.5.4 lib/yt/video_audit/end_card.rb
yt-audit-0.5.3 lib/yt/video_audit/end_card.rb
yt-audit-0.5.2 lib/yt/video_audit/end_card.rb
yt-audit-0.5.1 lib/yt/video_audit/end_card.rb
yt-audit-0.5.0 lib/yt/video_audit/end_card.rb