Sha256: 27647704cd1693babbc61d2ba70ff3730db3b9495ee3a2fc4e2e0718e4913aa0

Contents?: true

Size: 858 Bytes

Versions: 1

Compression:

Stored size: 858 Bytes

Contents

require 'yt'
require 'yt/annotations'

module Yt
  module Audit
    # Audit any info card of a video
    # @param [String] video_id the video to audit.
    # @return true if the video has any info card.
    # @raise [NoMethodError] if video_id is not a valid video.
    def self.has_info_cards?(video_id)
      Yt::Annotations.for(video_id).any? do |annotation|
        annotation.is_a? Yt::Annotations::Card
      end
    end

    # Audit brand anchoring of a video
    # @param [String] video_id the video to audit.
    # @param [String] brand name of the video to audit.
    # @return true if the video title includes brand name.
    # @raise [Yt::Errors::NoItems] if video_id is not a valid video.
    def self.has_brand_anchoring?(video_id, brand)
      video_title = Yt::Video.new(id: video_id).title
      video_title.include? brand
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yt-audit-0.1.0 lib/yt/audit.rb