class Yt::VideoAudit::EndCard

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.

Public Instance Methods

description() click to toggle source
# File lib/yt/video_audit/end_card.rb, line 13
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
title() click to toggle source
# File lib/yt/video_audit/end_card.rb, line 9
def title
  'Possible End Card Annotations'
end

Private Instance Methods

valid?(video) click to toggle source
# File lib/yt/video_audit/end_card.rb, line 20
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